From 238e4a88f7f5da1fb2b81035cd01e365f4e4fe43 Mon Sep 17 00:00:00 2001 From: sdbbs Date: Tue, 14 Apr 2020 23:29:08 +0200 Subject: [PATCH] sigrok-cross-linux: add option -r|--rebuild (skips: removing directories, git clone, and autogen/configure) --- cross-compile/linux/sigrok-cross-linux | 116 +++++++++++++++++-------- 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/cross-compile/linux/sigrok-cross-linux b/cross-compile/linux/sigrok-cross-linux index 6ba7037..e18956b 100755 --- a/cross-compile/linux/sigrok-cross-linux +++ b/cross-compile/linux/sigrok-cross-linux @@ -18,6 +18,21 @@ ## along with this program; if not, see . ## +# parse command line options: +# + +for opt in "$@" ; do + case $opt in + -r|--rebuild) + REBUILD=YES + echo "Got option -r|--rebuild; skipping: removing directories, git clone, and autogen/configure" + ;; + *) + # unknown option + ;; + esac +done + set -e # Uncomment/set the following to match your cross-toolchain setup. @@ -62,11 +77,16 @@ P="$PREFIX/lib/pkgconfig" C="$C --prefix=$PREFIX" # Remove build directory contents (if any) and create a new build dir. -rm -rf $BUILDDIR -mkdir $BUILDDIR +if [ ! "$REBUILD" = "YES" ]; then + rm -rf $BUILDDIR + mkdir $BUILDDIR +fi cd $BUILDDIR GIT_CLONE="git clone --depth=1" +if [ "$REBUILD" = "YES" ]; then + GIT_CLONE="echo skipped $GIT_CLONE" +fi REPO_BASE="git://sigrok.org" @@ -75,10 +95,14 @@ REPO_BASE="git://sigrok.org" # libserialport $GIT_CLONE $REPO_BASE/libserialport cd libserialport -./autogen.sh -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build +fi cd build -$SB ../configure $C +if [ ! "$REBUILD" = "YES" ]; then + $SB ../configure $C +fi $SB make $PARALLEL $V make install $V cd ../.. @@ -87,10 +111,14 @@ cd ../.. mkdir -p $PYPATH $GIT_CLONE $REPO_BASE/libsigrok cd libsigrok -./autogen.sh -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build +fi cd build -PKG_CONFIG_PATH=$P $SB ../configure $C $JDK +if [ ! "$REBUILD" = "YES" ]; then + PKG_CONFIG_PATH=$P $SB ../configure $C $JDK +fi $SB make $PARALLEL $V PYTHONPATH=$PYPATH $SB make install $V $SB make check $V @@ -99,10 +127,14 @@ cd ../.. # libsigrokdecode $GIT_CLONE $REPO_BASE/libsigrokdecode cd libsigrokdecode -./autogen.sh -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build +fi cd build -PKG_CONFIG_PATH=$P $SB ../configure $C +if [ ! "$REBUILD" = "YES" ]; then + PKG_CONFIG_PATH=$P $SB ../configure $C +fi $SB make $PARALLEL $V make install $V $SB make check $V @@ -111,39 +143,51 @@ cd ../.. # sigrok-firmware $GIT_CLONE $REPO_BASE/sigrok-firmware cd sigrok-firmware -./autogen.sh -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build +fi cd build # Nothing gets cross-compiled here, we just need 'make install' basically. -$SB ../configure $C +if [ ! "$REBUILD" = "YES" ]; then + $SB ../configure $C +fi make install $V cd ../.. if [ $BUILD_SIGROK_FIRMWARE_FX2LAFW = 1 ]; then -# sigrok-firmware-fx2lafw -$GIT_CLONE $REPO_BASE/sigrok-firmware-fx2lafw -cd sigrok-firmware-fx2lafw -./autogen.sh -mkdir build -cd build -# We're building the fx2lafw firmware on the host, no need to cross-compile. -$SB ../configure $C -make $PARALLEL $V -make install $V -cd ../.. + # sigrok-firmware-fx2lafw + $GIT_CLONE $REPO_BASE/sigrok-firmware-fx2lafw + cd sigrok-firmware-fx2lafw + if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build + fi + cd build + # We're building the fx2lafw firmware on the host, no need to cross-compile. + if [ ! "$REBUILD" = "YES" ]; then + $SB ../configure $C + fi + make $PARALLEL $V + make install $V + cd ../.. fi # sigrok-cli $GIT_CLONE $REPO_BASE/sigrok-cli cd sigrok-cli -./autogen.sh -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + ./autogen.sh + mkdir build +fi cd build -if [ `uname` = "FreeBSD" ]; then - # Temporary fix for: http://sigrok.org/bugzilla/show_bug.cgi?id=552 - PKG_CONFIG_PATH=$P $SB ../configure $C LDFLAGS=-lusb -else - PKG_CONFIG_PATH=$P $SB ../configure $C +if [ ! "$REBUILD" = "YES" ]; then + if [ `uname` = "FreeBSD" ]; then + # Temporary fix for: http://sigrok.org/bugzilla/show_bug.cgi?id=552 + PKG_CONFIG_PATH=$P $SB ../configure $C LDFLAGS=-lusb + else + PKG_CONFIG_PATH=$P $SB ../configure $C + fi fi $SB make $PARALLEL $V make install $V @@ -152,9 +196,13 @@ cd ../.. # PulseView $GIT_CLONE $REPO_BASE/pulseview cd pulseview -mkdir build +if [ ! "$REBUILD" = "YES" ]; then + mkdir build +fi cd build -PKG_CONFIG_PATH=$P $SB cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y -DENABLE_TESTS=y -DCMAKE_EXPORT_COMPILE_COMMANDS=y .. +if [ ! "$REBUILD" = "YES" ]; then + PKG_CONFIG_PATH=$P $SB cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y -DENABLE_TESTS=y -DCMAKE_EXPORT_COMPILE_COMMANDS=y .. +fi $SB make $PARALLEL $V make install $V $SB make test $V -- 2.17.1