aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build.sh
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-07-25 08:51:49 +0200
committerSven Gothel <[email protected]>2022-07-25 08:51:49 +0200
commit78489714eb9caef9bf75e01d58a062d5823c7a1c (patch)
tree3d6969e0cbe3e5d711b49ca75edd90952ef968b0 /scripts/build.sh
parent85d88a4ad83e021ea0f9b610b65519cbca021236 (diff)
Update scripts, analog to jaulib v0.14.0-37-g8e76c99
Diffstat (limited to 'scripts/build.sh')
-rw-r--r--scripts/build.sh59
1 files changed, 33 insertions, 26 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 1540a4d..5297459 100644
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -4,21 +4,11 @@ sdir=`dirname $(readlink -f $0)`
rootdir=`dirname $sdir`
bname=`basename $0 .sh`
-. $sdir/setup-machine-arch.sh
+. $rootdir/jaulib/scripts/setup-machine-arch.sh
-logfile=$rootdir/$bname-$archabi.log
+logfile=$rootdir/$bname-$os_name-$archabi.log
rm -f $logfile
-if [ -e /usr/lib/jvm/java-17-openjdk-$archabi ] ; then
- export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$archabi
-elif [ -e /usr/lib/jvm/java-11-openjdk-$archabi ] ; then
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-$archabi
-fi
-if [ ! -e $JAVA_HOME ] ; then
- echo $JAVA_HOME does not exist
- exit 1
-fi
-
CPU_COUNT=`getconf _NPROCESSORS_ONLN`
# run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8'
@@ -28,30 +18,47 @@ export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
buildit() {
+ if [ -z "$JAVA_HOME" -o ! -e "$JAVA_HOME" ] ; then
+ echo "WARNING: JAVA_HOME $JAVA_HOME does not exist"
+ else
+ echo JAVA_HOME $JAVA_HOME
+ fi
echo rootdir $rootdir
echo logfile $logfile
echo CPU_COUNT $CPU_COUNT
+ dist_dir="dist-$os_name-$archabi"
+ build_dir="build-$os_name-$archabi"
+ echo dist_dir $dist_dir
+ echo build_dir $build_dir
+
cd $rootdir
- rm -rf dist-$archabi
- mkdir -p dist-$archabi/bin
- rm -rf build-$archabi
- mkdir -p build-$archabi
- cd build-$archabi
+ rm -rf $dist_dir
+ mkdir -p $dist_dir
+ rm -rf $build_dir
+ mkdir -p $build_dir
+ cd $build_dir
# CLANG_ARGS="-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++"
- #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON ..
- cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON ..
- #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON -DDEBUG=ON ..
+ #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON ..
+ cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON ..
+ #cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/$dist_dir -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DTEST_WITH_SUDO=ON -DUSE_LIBCURL=ON -DDEBUG=ON ..
- make -j $CPU_COUNT install test
+ make -j $CPU_COUNT install
if [ $? -eq 0 ] ; then
- echo "BUILD SUCCESS $bname $archabi"
- # cp -a examples/* $rootdir/dist-$archabi/bin
- cd $rootdir
- return 0
+ echo "BUILD SUCCESS $bname $os_name $archabi"
+ make test
+ if [ $? -eq 0 ] ; then
+ echo "TEST SUCCESS $bname $os_name $archabi"
+ cd $rootdir
+ return 0
+ else
+ echo "TEST FAILURE $bname $os_name $archabi"
+ cd $rootdir
+ return 1
+ fi
else
- echo "BUILD FAILURE $bname $archabi"
+ echo "BUILD FAILURE $bname $os_name $archabi"
cd $rootdir
return 1
fi