@@ -26,35 +26,54 @@ case "$(uname -s)" in
26
26
;;
27
27
esac
28
28
29
- function update_cmakelists () {
29
+ function update_cmakelists_source () {
30
30
src_root=" $here /Sources/$1 "
31
-
31
+
32
32
# Build an array with the rest of the arguments
33
33
shift
34
34
src_exts=(" $@ " )
35
35
echo " Finding source files (${src_exts[@]} ) under $src_root "
36
-
36
+
37
37
num_exts=${# src_exts[@]}
38
-
38
+
39
39
# Build file extensions argument for `find`
40
40
declare -a exts_arg
41
41
exts_arg+=(-name " ${src_exts[0]} " )
42
42
for (( i= 1 ; i< $num_exts ; i++ )) ;
43
43
do
44
44
exts_arg+=(-o -name " ${src_exts[$i]} " )
45
45
done
46
-
46
+
47
47
# Wrap quotes around each filename since it might contain spaces
48
48
srcs=$( $find " ${src_root} " -type f \( " ${exts_arg[@]} " \) -printf ' "%P"\n' | LC_ALL=POSIX sort)
49
49
echo " $srcs "
50
-
50
+
51
51
# Update list of source files in CMakeLists.txt
52
52
# The first part in `BEGIN` (i.e., `undef $/;`) is for working with multi-line;
53
53
# the second is so that we can pass in a variable to replace with.
54
54
perl -pi -e ' BEGIN { undef $/; $replace = shift } s/add_library\(([^\n]+)\n([^\)]+)/add_library\($1\n$replace/' " $srcs " " $src_root /CMakeLists.txt"
55
55
echo " Updated $src_root /CMakeLists.txt"
56
56
}
57
57
58
- update_cmakelists " CCryptoBoringSSL" " *.c"
59
- update_cmakelists " CCryptoBoringSSLShims" " *.c"
60
- update_cmakelists " Crypto" " *.swift"
58
+ function update_cmakelists_assembly() {
59
+ src_root=" $here /Sources/$1 "
60
+ echo " Finding assembly files (.S) under $src_root "
61
+
62
+ mac_asms=$( $find " ${src_root} " -type f -name " *.mac.x86_64.S" -printf ' %P\n' | LC_ALL=POSIX sort)
63
+ linux_asms=$( $find " ${src_root} " -type f -name " *.linux.x86_64.S" -printf ' %P\n' | LC_ALL=POSIX sort)
64
+ echo " $mac_asms "
65
+ echo " $linux_asms "
66
+
67
+ # Update list of assembly files in CMakeLists.txt
68
+ # The first part in `BEGIN` (i.e., `undef $/;`) is for working with multi-line;
69
+ # the second is so that we can pass in a variable to replace with.
70
+ perl -pi -e ' BEGIN { undef $/; $replace = shift } s/Darwin\)\n(.+)target_sources\(([^\n]+)\n([^\)]+)/Darwin\)\n$1target_sources\($2\n$replace/' " $mac_asms " " $src_root /CMakeLists.txt"
71
+ perl -pi -e ' BEGIN { undef $/; $replace = shift } s/Linux\)\n(.+)target_sources\(([^\n]+)\n([^\)]+)/Linux\)\n$1target_sources\($2\n$replace/' " $linux_asms " " $src_root /CMakeLists.txt"
72
+ echo " Updated $src_root /CMakeLists.txt"
73
+ }
74
+
75
+ update_cmakelists_source " CCryptoBoringSSL" " *.c"
76
+ update_cmakelists_source " CCryptoBoringSSLShims" " *.c"
77
+ update_cmakelists_source " Crypto" " *.swift"
78
+
79
+ update_cmakelists_assembly " CCryptoBoringSSL" " x86_64"
0 commit comments