diff mbox

[5/6] build.sh: make relocated build configurable

Message ID 1431362411-8686-6-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss May 11, 2015, 4:40 p.m. UTC
So users can disable it

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 build.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/build.sh b/build.sh
index cbef61b..eb7328b 100755
--- a/build.sh
+++ b/build.sh
@@ -29,6 +29,7 @@  export CPP_TEST="${CPP_TEST:-0}"
 export DISTCHECK="${DISTCHECK:-0}"
 export DRYRUN="${DRYRUN:-0}"
 export BUILD_DEPS="${BUILD_DEPS:-1}"
+export RELOCATE_TEST="${RELOCATE_TEST:-1}"
 E_VALGRIND="${E_VALGRIND:-0}"
 if [[ ! -z ${TEST_LIST} ]]; then
     export TESTS="${TEST_LIST}"
@@ -86,6 +87,7 @@  usage() {
     echo -e "\tNUM_CPUS:\t add parallel make, default: _NPROCESSORS_ONLN"
     echo -e "\tCLEANUP:\t to save workspace set CLEANUP=0, default: ${CLEANUP}"
     echo -e "\tBUILD_DEPS:\t build dependencies, 0: no, 1: yes, 2: yes and exit afterwards, default: ${BUILD_DEPS}"
+    echo -e "\tRELOCATE_TEST:\t build ODP in relocated directory, default: ${RELOCATE_TEST}"
     echo -e "\tM32_ON_64:\t enable 32 bit builds on a 64 bit host, default: 0"
     echo -e "\tDOXYGEN_HTML:\t build doxygen-html, default: 0"
     echo -e "\tCLANG:\t\t build with clang, default: 0"
@@ -174,6 +176,7 @@  if [[ ${CPP_TEST} -eq 1 ]]; then
     fi
 fi
 pushd ${ODP_BUILDDIR} > /dev/null
+exit_on_error git clean -xdf || exit 1
 exit_on_error ./bootstrap
 echo ./configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} ${M32_CC} ${M32_LD}
 exit_on_error ./configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} ${M32_CC} ${M32_LD}
@@ -217,19 +220,23 @@  elif [[ ${E_VALGRIND} -eq 1 ]]; then
 else
     exit_on_error make -j ${NUM_CPUS}
     exit_on_error make install
-    exit_on_error git clean -xdf || exit 1
-    exit_on_error ./bootstrap
-    mkdir ${ODP_BUILDDIR}/testdir
-    pushd ${ODP_BUILDDIR}/testdir > /dev/null
-    exit_on_error ../configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} ${M32_CC} ${M32_LD}
-    exit_on_error make -j ${NUM_CPUS}
-    exit_on_error make install
+    if [[ ${RELOCATE_TEST} -eq 1 ]]; then
+        exit_on_error git clean -xdf || exit 1
+        exit_on_error ./bootstrap
+        mkdir ${ODP_BUILDDIR}/testdir
+        pushd ${ODP_BUILDDIR}/testdir > /dev/null
+        exit_on_error ../configure ${GPLATFORM} ${DSTDIR} ${CROSS_HOST} ${EXTRA_FLAGS} ${M32_CC} ${M32_LD}
+        exit_on_error make -j ${NUM_CPUS}
+        exit_on_error make install
+    fi
     if [[ ${M32_ON_64} -eq 1 ]]; then
         file test/performance/odp_scheduling
     else
         [[ -n ${ARCH} ]] || exit_on_error make check -e
     fi
-    popd > /dev/null
+    if [[ ${RELOCATE_TEST} -eq 1 ]]; then
+        popd > /dev/null
+    fi
 fi
 
 popd > /dev/null