X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Fbabeltrace%2Fbuild.sh;h=b6590a78b9323c358990d1468a2db8910c27d790;hb=e04f80ef6be68cf75ef15158c784f3232ce8145d;hp=0d8fdaf38f5d9ff0a73143c7bf58418ca48a7e1f;hpb=1f620ba015cc9617640fbfcdb9fbe84f323af527;p=lttng-ci.git diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index 0d8fdaf..b6590a7 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -80,9 +80,6 @@ SRCDIR="$WORKSPACE/src/babeltrace" TMPDIR="$WORKSPACE/tmp" PREFIX="$WORKSPACE/build" -# The build dir defaults to the source dir -BUILDDIR="$SRCDIR" - # Create install and tmp directories rm -rf "$PREFIX" "$TMPDIR" mkdir -p "$PREFIX" "$TMPDIR" @@ -270,38 +267,66 @@ esac # Make sure to move to the build dir and run configure # before continuing. case "$build" in - oot) - echo "Out of tree build" +oot) + echo "Out of tree build" + + # Create and enter a temporary build directory + builddir=$(mktemp -d) + cd "$builddir" + + "$SRCDIR/configure" --prefix="$PREFIX" "${CONF_OPTS[@]}" + ;; - BUILDDIR="$WORKSPACE/oot" - mkdir -p "$BUILDDIR" - cd "$BUILDDIR" +dist) + echo "Distribution in-tree build" - "$SRCDIR/configure" --prefix="$PREFIX" "${CONF_OPTS[@]}" - ;; + # Run configure and generate the tar file + # in the source directory + ./configure + $MAKE dist - dist) - echo "Distribution out of tree build" - BUILDDIR="$(mktemp -d)" + # Create and enter a temporary build directory + builddir=$(mktemp -d) + cd "$builddir" + + # Extract the distribution tar in the build directory, + # ignore the first directory level + $TAR xvf "$SRCDIR"/*.tar.* --strip 1 + + ./configure --prefix="$PREFIX" "${CONF_OPTS[@]}" + ;; - # Initial configure and generate tarball - "$SRCDIR/configure" - $MAKE dist +oot-dist) + echo "Distribution out of tree build" - mkdir -p "$BUILDDIR" - cp ./*.tar.* "$BUILDDIR/" - cd "$BUILDDIR" + # Create and enter a temporary build directory + builddir=$(mktemp -d) + cd "$builddir" - # Ignore level 1 of tar - $TAR xvf ./*.tar.* --strip 1 + # Run configure out of tree and generate the tar file + "$SRCDIR/configure" + $MAKE dist - ./configure --prefix="$PREFIX" "${CONF_OPTS[@]}" - ;; + dist_srcdir="$(mktemp -d)" + cd "$dist_srcdir" - *) - echo "Standard in-tree build" - ./configure --prefix="$PREFIX" "${CONF_OPTS[@]}" - ;; + # Extract the distribution tar in the new source directory, + # ignore the first directory level + $TAR xvf "$builddir"/*.tar.* --strip 1 + + # Create and enter a second temporary build directory + builddir="$(mktemp -d)" + cd "$builddir" + + # Run configure from the extracted distribution tar, + # out of the source tree + "$dist_srcdir/configure" --prefix="$PREFIX" "${CONF_OPTS[@]}" + ;; + +*) + echo "Standard in-tree build" + ./configure --prefix="$PREFIX" "${CONF_OPTS[@]}" + ;; esac # We are now inside a configured build directory @@ -332,7 +357,7 @@ find "$PREFIX/lib" -name "*.la" -exec rm -f {} \; # Clean temp dir for dist build if [ "$build" = "dist" ]; then cd "$SRCDIR" - rm -rf "$BUILDDIR" + rm -rf "$builddir" fi # Exit with the return code of the test suite