From 252afcc86e7e87341dc6f9663eacc5bb3bb2da30 Mon Sep 17 00:00:00 2001 From: Micah Kornfield Date: Wed, 16 Mar 2016 07:14:14 +0000 Subject: [PATCH] some fixes for errors encountered on not fully setup systems --- cpp/setup_build_env.sh | 9 +++++++-- cpp/thirdparty/build_thirdparty.sh | 9 ++++++--- cpp/thirdparty/download_thirdparty.sh | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cpp/setup_build_env.sh b/cpp/setup_build_env.sh index e9901bdbecd42..d7883565a4c4c 100755 --- a/cpp/setup_build_env.sh +++ b/cpp/setup_build_env.sh @@ -1,9 +1,14 @@ #!/bin/bash SOURCE_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd) +check_run() { +rc=eval $1 +echo $rc +if [[ $rc ]]; then echo $1 failed with exit code $rc!; kill -INT $$; fi +} -./thirdparty/download_thirdparty.sh -./thirdparty/build_thirdparty.sh +check_run ./thirdparty/download_thirdparty.sh +check_run ./thirdparty/build_thirdparty.sh source thirdparty/versions.sh export GTEST_HOME=$SOURCE_DIR/thirdparty/$GTEST_BASEDIR diff --git a/cpp/thirdparty/build_thirdparty.sh b/cpp/thirdparty/build_thirdparty.sh index 46794def400eb..fa33d678412f5 100755 --- a/cpp/thirdparty/build_thirdparty.sh +++ b/cpp/thirdparty/build_thirdparty.sh @@ -44,18 +44,21 @@ ln -sf lib "$PREFIX/lib64" # use the compiled tools export PATH=$PREFIX/bin:$PATH +type cmake >/dev/null 2>&1 || { echo >&2 "cmake not installed. Aborting."; exit 1; } +type make >/dev/null 2>&1 || { echo >&2 "make not installed. Aborting."; exit 1; } # build googletest +GOOGLETEST_ERROR="failed for googletest!" if [ -n "$F_ALL" -o -n "$F_GTEST" ]; then cd $TP_DIR/$GTEST_BASEDIR if [[ "$OSTYPE" == "darwin"* ]]; then - CXXFLAGS=-fPIC cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-value -Wno-ignored-attributes" + CXXFLAGS=-fPIC cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-value -Wno-ignored-attributes" || { echo "cmake $GOOGLETEST_ERROR" ; exit 1; } else - CXXFLAGS=-fPIC cmake . + CXXFLAGS=-fPIC cmake . || { echo "cmake $GOOGLETEST_ERROR"; exit 1; } fi - make VERBOSE=1 + make VERBOSE=1 || { echo "Make $GOOGLETEST_ERROR" ; exit 1; } fi echo "---------------------" diff --git a/cpp/thirdparty/download_thirdparty.sh b/cpp/thirdparty/download_thirdparty.sh index 8ffb22a93f7e2..f30cbe93e7b17 100755 --- a/cpp/thirdparty/download_thirdparty.sh +++ b/cpp/thirdparty/download_thirdparty.sh @@ -8,6 +8,7 @@ TP_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd) source $TP_DIR/versions.sh download_extract_and_cleanup() { + type curl >/dev/null 2>&1 || { echo >&2 "curl not installed. Aborting."; exit 1; } filename=$TP_DIR/$(basename "$1") curl -#LC - "$1" -o $filename tar xzf $filename -C $TP_DIR