diff options
author | Sven Gothel <[email protected]> | 2020-06-18 08:46:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-18 08:46:11 +0200 |
commit | 751f78a261031217f92a2364a7a8666d1fb633e4 (patch) | |
tree | 4fc3a51278e73e66b9a2e503743a5f700c7417ff /scripts/build.sh | |
parent | de3c7489c7c58923270202ed929f97cd90bd5b99 (diff) |
Use generic 'setup-machine-arch.sh' for unified build.sh and rebuild.sh scripts
Diffstat (limited to 'scripts/build.sh')
-rw-r--r-- | scripts/build.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 00000000..d32cc22d --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,41 @@ +#! /bin/sh + +sdir=`dirname $(readlink -f $0)` +rootdir=`dirname $sdir` +bname=`basename $0 .sh` +logfile=$bname.log +rm -f $logfile + +. $sdir/setup-machine-arch.sh + +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-$archabi +if [ ! -e $JAVA_HOME ] ; then + echo $JAVA_HOME does not exist + exit 1 +fi + +buildit() { + echo rootdir $rootdir + echo logfile $logfile + + cd $rootdir + rm -rf dist-$archabi + mkdir -p dist-$archabi/bin + rm -rf build-$archabi + mkdir -p build-$archabi + cd build-$archabi + cmake -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON .. + make install test + if [ $? -eq 0 ] ; then + echo "BUILD SUCCESS $bname $archabi" + cp -a examples/* $rootdir/dist-$archabi/bin + cd $rootdir + return 0 + else + echo "BUILD FAILURE $bname $archabi" + cd $rootdir + return 1 + fi +} + +buildit 2>&1 | tee $logfile |