From 437e36be81de4985cd9100fac4a91f1d4f131661 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 26 Sep 2014 23:53:57 +0200 Subject: sync-build.sh: 32-bit on 64-bit support Also allows you to override CC/CXX (for Clang support), fix /tmp/wireshark/ symlink and /tmp/wsbuild/run/ sync, enable some additional modules (but disable SBC which would be used for Bluetooth audio support), pass -DCMAKE_EXPORT_COMPILE_COMMANDS (for clang-check iirc). --- sync-build.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 14 deletions(-) (limited to 'sync-build.sh') diff --git a/sync-build.sh b/sync-build.sh index 109e6a5..cd289e4 100755 --- a/sync-build.sh +++ b/sync-build.sh @@ -33,23 +33,50 @@ builddir=/tmp/wsbuild/ # LOCAL & REMOTE program dir (Available since 1.11.x and 1.12.0) rundir="$builddir/run/" +CC=${CC:-cc} +CXX=${CXX:-c++} +# For clang, `-O1` (or `-g`?) seems necessary to get something other than +# "". +# -O1 -g -gdwarf-4 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer +CFLAGS=${CFLAGS:--fsanitize=address} +CXXFLAGS=${CXXFLAGS:--fsanitize=address} + +LIBDIR=/usr/lib +# Run with `B32=1 ./sync-build.sh` to build for multilib +if [[ ${B32:-} ]]; then + LIBDIR=/usr/lib32 + CFLAGS="$CFLAGS -m32" + CXXFLAGS="$CXXFLAGS -m32" +fi + # PATH is needed for /usr/bin/core_perl/pod2man (PCAP) +# ENABLE_QT5=1: install qt5-tools on Arch Linux +# 32-bit libs on Arch: lib32-libcap lib32-gnutls lib32-gtk2 lib32-krb5 +# lib32-portaudio lib32-geoip lib32-libnl lib32-lua remotecmd="schroot -c chroot:arch -- sh -c ' PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl; -if [ ! -d $builddir ]; then - mkdir $builddir && cd $builddir && - time cmake \ +if [ ! -e $builddir/CMakeCache.txt ]; then + mkdir -p $builddir && cd $builddir && + set -x && + time \ + CC=$CC CXX=$CXX \ + PKG_CONFIG_LIBDIR=$LIBDIR/pkgconfig \ + cmake \ -DCMAKE_INSTALL_PREFIX=/tmp/wsroot \ -DENABLE_GTK3=0 \ - -DENABLE_PORTAUDIO=0 \ - -DENABLE_QT5=0 \ - -DENABLE_GEOIP=0 \ - -DENABLE_KERBEROS=0 \ + -DENABLE_PORTAUDIO=1 \ + -DENABLE_QT5=1 \ + -DENABLE_GEOIP=1 \ + -DENABLE_KERBEROS=1 \ + -DENABLE_SBC=0 \ -DENABLE_SMI=0 \ + -DENABLE_GNUTLS=1 \ + -DENABLE_GCRYPT=1 \ -DCMAKE_BUILD_TYPE=Debug \ $remotesrcdir \ - -DCMAKE_C_FLAGS=-fsanitize=address \ - -DCMAKE_CXX_FLAGS=-fsanitize=address \ + -DCMAKE_LIBRARY_PATH=$LIBDIR \ + -DCMAKE_C_FLAGS=$(printf %q "$CFLAGS") \ + -DCMAKE_CXX_FLAGS=$(printf %q "$CXXFLAGS") \ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 fi && time make -C $builddir -j16 @@ -70,7 +97,7 @@ monitor_changes() { # Wait for changes, but ignore .git/ and vim swap files # NOTE: you cannot add multiple --exclude options, they must be combined inotifywait -r -m -e close_write \ - --exclude='/\.[^/]+\.swp?.$|~$|\/.git/' \ + --exclude='/(\.[^/]+)?\.swp?.$|~$|\/.git/' \ "$localsrcdir/" | while read x; do printf '\e[36m%s\e[m\n' "Trigger $((++round)): $x" >&2 @@ -82,8 +109,8 @@ monitor_changes() { ### MAIN ### # For gdb -if [ ! -e "$remotesrcdir" ]; then - ln -sv "$localsrcdir" "$remotesrcdir" +if [ ! -e "${remotesrcdir%%/}" ]; then + ln -sv "$localsrcdir" "${remotesrcdir%%/}" fi monitor_changes & monpid=$! @@ -94,15 +121,21 @@ 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 \ "$localsrcdir/" "$remotehost:$remotesrcdir/" && ssh -t "$remotehost" "$remotecmd" retval=$? if [ $retval -ne 0 ]; then notify-send -- "$(tty) - $(date -R)" "Build broke with $retval" - sleep 3 + sleep 2 else - rsync -av --delete --exclude='.*.sw?' "$remotehost:$rundir" "$rundir" + mkdir -p "$rundir" + rsync -av --delete \ + --exclude='.*.sw?' \ + --exclude='*.a' \ + "$remotehost:$rundir" "$rundir" notify-send -- "$(tty) - $(date -R)" "READY" fi echo Another satisfied customer. NEXT -- cgit v1.2.1