Keeping old build* directories to speed up compiling (patch for bootStrap.bash)

Started by eumagga0x2a, July 24, 2016, 09:23:23 PM

Previous topic - Next topic

eumagga0x2a

Referring to http://avidemux.org/smif/index.php/topic,16742.msg75822.html#msg75822: Is it harmless to keep build* (buildCli, buildCore, buildPluginsCLI, buildPluginsCommon, buildPluginsQt5, buildPluginsSettings, buildQt5) directories from the previous build around to save time, hoping that the build system will do its job right? Or is it a recipe for disaster?

If doing such a thing is viable, what do you think about the following patch for bootStrap.bash?

diff --git a/bootStrap.bash b/bootStrap.bash
index 1995d54..b9e0e04 100644
--- a/bootStrap.bash
+++ b/bootStrap.bash
@@ -5,6 +5,7 @@
# By default we use qt5 now
#
packages_ext=""
+rebuild=0
do_core=1
do_cli=1
do_gtk=0  # Gtk is obsolete!
@@ -41,8 +42,12 @@ Process()
         fi
FAKEROOT=" -DFAKEROOT=$FAKEROOT_DIR "
         echo "Building $BUILDDIR from $SOURCEDIR with EXTRA=<$EXTRA>, DEBUG=<$DEBUG>"
-        rm -Rf ./$BUILDDIR
-        mkdir $BUILDDIR || fail mkdir
+        if [ "x$rebuild" != "x1" ] ; then
+                rm -Rf ./$BUILDDIR
+        fi
+        if [ ! -e "$BUILDDIR" ] ; then
+                mkdir $BUILDDIR || fail mkdir
+        fi
         cd $BUILDDIR
         cmake $PKG $FAKEROOT $QT_FLAVOR -DCMAKE_EDIT_COMMAND=vim -DAVIDEMUX_SOURCE_DIR=$TOP -DCMAKE_INSTALL_PREFIX=/usr $EXTRA $ASAN $DEBUG -G "$BUILDER" $SOURCEDIR || fail cmakeZ
         make  $PARAL >& /tmp/log$BUILDDIR || fail "make, result in /tmp/log$BUILDDIR"
@@ -85,6 +90,7 @@ usage()
         echo "  --deb             : Build deb packages"
         echo "  --tgz             : Build tgz packages"
         echo "  --debug           : Switch debugging on"
+        echo "  --rebuild         : Preserve existing build directories"
         echo "  --with-core       : Build core"
         echo "  --without-core    : Dont build core"
         echo "  --with-cli        : Build cli"
@@ -122,6 +128,9 @@ while [ $# != 0 ] ;do
          --debug)
                 debug=1
                 ;;
+         --rebuild)
+                rebuild=1
+                ;;
          --tgz)
                 packages_ext=tar.gz
                 PKG="$PKG -DAVIDEMUX_PACKAGER=tgz"



Jan Gruuthuse

Can you explain us a little more what exactly is the difference between these 2:
with --rebuild:
bash bootStrap.bash --rebuild --deb
without  --rebuild:
bash bootStrap.bash --deb
I understand one is building faster the the other (partial build <> complete build)

mean

without the --rebuild, it compiles from scractch
With the --rebuild, it re-compiles only what has changed (hopefully)

For quick tries, --rebuild is fine
To create deb you distribute, better not to use it