From 8b6066f1d6e7dd1cdf1ecd60bba3a919e0e629ac Mon Sep 17 00:00:00 2001
From: Maxime Graulich <maxime.graulich@gmail.com>
Date: Thu, 27 Mar 2014 11:23:39 +0000
Subject: [PATCH] iOS: check return code in build script

---
 contrib/mobile/utils/onelab_ios_build.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/contrib/mobile/utils/onelab_ios_build.sh b/contrib/mobile/utils/onelab_ios_build.sh
index 11b1c81c6a..a7fc34de3d 100755
--- a/contrib/mobile/utils/onelab_ios_build.sh
+++ b/contrib/mobile/utils/onelab_ios_build.sh
@@ -11,6 +11,14 @@ cmake_default="-DDEFAULT=0 -DCMAKE_TOOLCHAIN_FILE=$gmsh_svn/contrib/mobile/utils
 build_cmd="xcodebuild -verbose -target lib -configuration Release"
 header_cmd="xcodebuild -verbose -target getHeaders -configuration Release"
 
+function check {
+	return_code=$?
+	if [ $return_code != 0 ]; then
+		echo "last command failed (return $return_code)"
+		exit $return_code
+	fi
+}
+
 function build_gmsh {
   if [ $# -ne 1 ]; then
     echo "You must specify an architecture (e.g. armv7, armv7s, arm64, ...)"
@@ -20,10 +28,12 @@ function build_gmsh {
     mkdir $gmsh_svn/build_ios_$1
     cd $gmsh_svn/build_ios_$1
     cmake $cmake_default -DENABLE_BLAS_LAPACK=1 -DENABLE_BUILD_LIB=1 -DENABLE_MATHEX=1 -DENABLE_MESH=1 -DENABLE_ONELAB=1 -DENABLE_PARSER=1 -DENABLE_POST=1 -DENABLE_TETGEN=1 -DCMAKE_OSX_ARCHITECTURES="$1" ../
+    check
     cd -
   fi
   cd $gmsh_svn/build_ios_$1
   $build_cmd
+  check
   $header_cmd
   cd -
 }
@@ -36,10 +46,12 @@ function build_getdp {
     mkdir $getdp_svn/build_ios_$1
     cd $getdp_svn/build_ios_$1
     cmake $cmake_default -DENABLE_BLAS_LAPACK=1 -DENABLE_BUILD_LIB=1 -DENABLE_GMSH=1 -DENABLE_LEGACY=1 -DENABLE_PETSC=1 -DPETSC_INC="$petsc_framework/Headers/" -DPETSC_LIBS="$petsc_framework/petsc" -DGMSH_INC="$frameworks_dir/Gmsh.framework/Headers/" -DGMSH_LIB="$frameworks_dir/Gmsh.framework/Gmsh" -DCMAKE_OSX_ARCHITECTURES="$1" ../
+    check
     cd -
   fi
   cd $getdp_svn/build_ios_$1
   $build_cmd
+  check
   $header_cmd
   cd -
 }
-- 
GitLab