From 96797851ab83b869f749c3493d2b45529d07b41f Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 6 Mar 2015 18:20:09 +0100 Subject: sync-build.sh: allow running it locally Let 'localhost' bypass SSH so I can still use its watch functionality, but build locally. Use -fno-common to workaround bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65285 Disable verbose warnings and disable werror to reduce the huge trace of warnings which make me overlook real issues. --- sync-build.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sync-build.sh b/sync-build.sh index 158b5b4..0291be1 100755 --- a/sync-build.sh +++ b/sync-build.sh @@ -32,6 +32,7 @@ localsrcdir=$HOME/projects/wireshark/ # Host wireshark-builder # User foo # Hostname 10.42.0.1 +# use 'localhost' for local builds without using rsync/ssh remotehost=${1:-wireshark-builder} # Remote source dir, it can be volatile (tmpfs) since it is just a copy. On the # local side, it is recommended to create a symlink to the localsrcdir for @@ -52,7 +53,7 @@ CXX=${CXX:-c++} _default_flags=\ -fsanitize=address _default_flags+=\ -fsanitize=undefined _default_flags+=\ -fdiagnostics-color -CFLAGS="${CFLAGS-$_default_flags}${EXTRA_CFLAGS:+ $EXTRA_CFLAGS}" +CFLAGS="${CFLAGS-$_default_flags -fno-common}${EXTRA_CFLAGS:+ $EXTRA_CFLAGS}" # Default to use the same CXXFLAGS as CFLAGS (common case) CXXFLAGS="${CXXFLAGS-$CFLAGS}" @@ -104,7 +105,8 @@ if $force_cmake || [ ! -e $builddir/CMakeCache.txt ]; then -DENABLE_GNUTLS=1 \ -DENABLE_GCRYPT=1 \ -DCMAKE_BUILD_TYPE=Debug \ - -DENABLE_EXTRA_COMPILER_WARNINGS=1 \ + -DDISABLE_WERROR=1 \ + -DENABLE_EXTRA_COMPILER_WARNINGS=0 \ $remotesrcdir \ -DCMAKE_LIBRARY_PATH=$LIBDIR \ -DCMAKE_C_FLAGS=$(printf %q "$CFLAGS") \ @@ -153,20 +155,25 @@ while inotifywait -qq -e close_write "$sync"; do # Wait for a second in case I save something and want to do a ninja edit. sleep 1 - # IMPORTANT: do not sync top-level config.h or it will break OOT builds - rsync -av --delete --exclude='.*.sw?' \ - --exclude=/config.h \ - --exclude=/compile_commands.json \ - --exclude=\*.tar\* \ - "$localsrcdir/" "$remotehost:$remotesrcdir/" && - ssh -t "$remotehost" "$remotecmd" + if [[ $remotehost == localhost ]]; then + # Do not bother copying files for local builds + sh -c "$remotecmd" + else + # IMPORTANT: do not sync top-level config.h or it will break OOT builds + rsync -av --delete --exclude='.*.sw?' \ + --exclude=/config.h \ + --exclude=/compile_commands.json \ + --exclude=\*.tar\* \ + "$localsrcdir/" "$remotehost:$remotesrcdir/" && + ssh -t "$remotehost" "$remotecmd" + fi retval=$? if [ $retval -ne 0 ]; then notify-send -- "$(tty) - $(date -R)" "Build broke with $retval" sleep 2 else mkdir -p "$rundir" - [ -n "${NOCOPY:-}" ] || + [[ $remotehost == localhost ]] || [ -n "${NOCOPY:-}" ] || rsync -av --delete \ --exclude='.*.sw?' \ --exclude='*.a' \ -- cgit v1.2.1