summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-13 17:20:50 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-13 18:26:29 +0100
commitbd68ff98c2cad49ebb4495ce977a9d907853d1aa (patch)
tree87b742f69327cffc7e4258cf9f431133bcad453f
parent537a0c4f0d82f2743353ebddffef1af564a7e4b3 (diff)
downloadwireshark-notes-bd68ff98c2cad49ebb4495ce977a9d907853d1aa.tar.gz
sync-build.sh: switch to lld, remove unused stuff
Remove ENABLE_xxx options that are enabled by default, check CMakeOptions.txt instead if you want to see available values. Skip rebuilding if only tests change. Remove -fsanitize options since these are set via CMake options. Use lld instead of gold since it is almost twice as fast as gold: lld 4.8s gold 9.2s bfd 10.8s Tested (n=3) with lld 7.0.1-1 and binutils 2.31.1-4 on Arch Linux, Linux 4.19.12-arch1-1-ARCH, i7-6700HQ, wireshark v2.9.1rc0-363-g178d81f804. Commands: time cmake -GNinja /tmp/wireshark -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_FLAGS="-fdiagnostics-color -fuse-ld=lld" \ -DCMAKE_CXX_FLAGS="-fdiagnostics-color -fuse-ld=lld" \ -DDISABLE_WERROR=1 -DENABLE_ASAN=1 -DENABLE_UBSAN=1 time ninja && rm -rf run time ninja # measured this with various -fuse-ld= values. Total build time is about 21s for cmake, 3m18s for the initial ninja. Ignoring the noise, a full build somehow takes about the same time as with gold, but incremental builds with lld are consistently faster.
-rwxr-xr-xsync-build.sh21
1 files changed, 8 insertions, 13 deletions
diff --git a/sync-build.sh b/sync-build.sh
index 9a7c1bf..01da66d 100755
--- a/sync-build.sh
+++ b/sync-build.sh
@@ -49,12 +49,12 @@ CXX=${CXX:-c++}
# For clang, `-O1` (or `-g`?) seems necessary to get something other than
# "<optimized out>".
# -O1 -g -gdwarf-4 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer
-_default_flags=\ -fsanitize=address
-_default_flags+=\ -fsanitize=undefined
-_default_flags+=\ -fdiagnostics-color
-_default_flags+=\ -fuse-ld=gold
-# Supported in GCC since 2007 (?), but only in Clang 3.8
+_default_flags=-fdiagnostics-color
+_default_flags+=\ -fuse-ld=lld
+# -fdebug-prefix-map is supported in GCC since 2007 (?), but only in Clang 3.8
# In GDB, use "dir /tmp/wireshark" to add the source directory anyway.
+# -fmacro-prefix-map (and -ffile-prefix-map) is added in GCC 8,
+# hopefully in Clang 8 as well via https://reviews.llvm.org/D49466
_default_flags+=" -fdebug-prefix-map=$builddir="
_default_flags+=" -fdebug-prefix-map=$remotesrcdir="
CFLAGS="${CFLAGS-$_default_flags -fno-common}${EXTRA_CFLAGS:+ $EXTRA_CFLAGS}"
@@ -124,16 +124,11 @@ if $force_cmake || [ ! -e $builddir/CMakeCache.txt ]; then
-DCMAKE_INSTALL_PREFIX=/tmp/wsroot \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DCMAKE_INSTALL_RPATH=$(printf %q "$RPATH") \
- -DENABLE_KERBEROS=1 \
- -DENABLE_SBC=1 \
-DENABLE_SMI=0 \
- -DENABLE_GNUTLS=1 \
- -DENABLE_LUA=1 \
-DCMAKE_BUILD_TYPE=Debug \
-DDISABLE_WERROR=1 \
-DENABLE_ASAN=1 \
-DENABLE_UBSAN=1 \
- -DENABLE_EXTRA_COMPILER_WARNINGS=0 \
$remotesrcdir \
-DCMAKE_LIBRARY_PATH=$LIBDIR \
-DCMAKE_C_FLAGS=$(printf %q "$CFLAGS") \
@@ -158,11 +153,11 @@ trap cleanup EXIT
round=0
monitor_changes() {
- # Wait for changes, but ignore .git/ and vim swap files
- # and also pytest_cache and Python 3 cache directory.
+ # Wait for changes, but ignore .git/, vim swap files, tests, the
+ # pytest_cache and Python 3 cache directory.
# NOTE: you cannot add multiple --exclude options, they must be combined
inotifywait -r -m -e close_write \
- --exclude='/(\.[^/]+)?\.swp?.$|~$|\/(\.git|\.pytest_cache|__pycache__)/' \
+ --exclude='/(\.[^/]+)?\.swp?.$|~$|\/(\.git|test|\.pytest_cache|__pycache__)/' \
"$localsrcdir/" |
while read x; do
printf '\e[36m%s\e[m\n' "Trigger $((++round)): $x" >&2