diff options
author | Sven Gothel <[email protected]> | 2021-03-02 04:38:07 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-03-02 04:38:07 +0100 |
commit | 8185e020ddc8d62670e4093b4656d3791df28370 (patch) | |
tree | 8a6000494a481b84548e861702a4bf25b706be3e /scripts |
Initial commit - Skeleton Project
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build.sh | 60 | ||||
-rw-r--r-- | scripts/rebuild.sh | 43 | ||||
-rw-r--r-- | scripts/setup-machine-arch.sh | 41 |
3 files changed, 144 insertions, 0 deletions
diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..b37ba3d --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,60 @@ +#! /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 + +CPU_COUNT=`getconf _NPROCESSORS_ONLN` + +# run as root 'dpkg-reconfigure locales' enable 'en_US.UTF-8' +# perhaps run as root 'update-locale LC_MEASUREMENT=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8' +export LC_MEASUREMENT=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 + +buildit() { + echo rootdir $rootdir + echo logfile $logfile + echo CPU_COUNT $CPU_COUNT + + cd $rootdir + rm -rf dist-$archabi + mkdir -p dist-$archabi/bin + rm -rf build-$archabi + mkdir -p build-$archabi + cd build-$archabi + # CLANG_ARGS="-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++" + cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILD_TESTING=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DUSE_STRIP=OFF .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DUSE_STRIP=ON -DJAVAC_DEBUG_ARGS="none" .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DGPROF=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DPERF_ANALYSIS=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON -DINSTRUMENTATION=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON -DINSTRUMENTATION_UNDEFINED=ON .. + # cmake $CLANG_ARGS -DCMAKE_INSTALL_PREFIX=$rootdir/dist-$archabi -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON -DINSTRUMENTATION_THREAD=ON .. + make -j $CPU_COUNT 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 diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh new file mode 100644 index 0000000..7155f58 --- /dev/null +++ b/scripts/rebuild.sh @@ -0,0 +1,43 @@ +#! /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 + +CPU_COUNT=`getconf _NPROCESSORS_ONLN` + +# run 'dpkg-reconfigure locales' enable 'en_US.UTF-8' +export LANG=en_US.UTF-8 +export LC_MEASUREMENT=en_US.UTF-8 + +buildit() { + echo rootdir $rootdir + echo logfile $logfile + echo CPU_COUNT $CPU_COUNT + + cd $rootdir/build-$archabi + make -j $CPU_COUNT install test + if [ $? -eq 0 ] ; then + echo "REBUILD SUCCESS $bname $archabi" + cp -a examples/* $rootdir/dist-$archabi/bin + cd $rootdir + return 0 + else + echo "REBUILD FAILURE $bname $archabi" + cd $rootdir + return 1 + fi +} + +buildit 2>&1 | tee $logfile + diff --git a/scripts/setup-machine-arch.sh b/scripts/setup-machine-arch.sh new file mode 100644 index 0000000..df6c644 --- /dev/null +++ b/scripts/setup-machine-arch.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +machine=`uname -m` + +case "$machine" in + "arm") + cpu="arm" + cpufamily="arm" + archabi="armhf" + syslibdir="arm-linux-gnueabihf" + ;; + "armv7l") + cpu="armv7l" + cpufamily="arm" + archabi="armhf" + syslibdir="arm-linux-gnueabihf" + ;; + "aarch64") + cpu="aarch64" + cpufamily="arm" + archabi="arm64" + syslibdir="aarch64-linux-gnu" + ;; + "x86_64") + cpu="x86_64" + cpufamily="x86" + archabi="amd64" + syslibdir="x86_64-linux-gnu" + ;; + *) + echo "Unsupported machine $machine" + exit 1 + ;; +esac + +echo machine $machine +echo cpu $cpu +echo cpufamily $cpufamily +echo archabi $archabi +echo syslibdir $syslibdir + |