aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-18 08:46:11 +0200
committerSven Gothel <[email protected]>2020-06-18 08:46:11 +0200
commit751f78a261031217f92a2364a7a8666d1fb633e4 (patch)
tree4fc3a51278e73e66b9a2e503743a5f700c7417ff /scripts
parentde3c7489c7c58923270202ed929f97cd90bd5b99 (diff)
Use generic 'setup-machine-arch.sh' for unified build.sh and rebuild.sh scripts
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-armhf.sh28
-rwxr-xr-xscripts/build-x86_64.sh28
-rw-r--r--scripts/build.sh41
-rwxr-xr-xscripts/rebuild-armhf.sh21
-rwxr-xr-xscripts/rebuild-x86_64.sh21
-rw-r--r--scripts/rebuild.sh36
-rw-r--r--scripts/setup-machine-arch.sh35
7 files changed, 112 insertions, 98 deletions
diff --git a/scripts/build-armhf.sh b/scripts/build-armhf.sh
deleted file mode 100755
index edae761b..00000000
--- a/scripts/build-armhf.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#! /bin/sh
-
-sdir=`dirname $(readlink -f $0)`
-rootdir=`dirname $sdir`
-logfile=`basename $0 .sh`.log
-rm -f $logfile
-
-export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf
-
-doit() {
- echo rootdir $rootdir
- echo logfile $logfile
-
- cd $rootdir
- rm -rf dist-armhf
- mkdir -p dist-armhf/bin
- rm -rf build-armhf
- mkdir build-armhf
- cd build-armhf
- cmake -DCMAKE_INSTALL_PREFIX=$rootdir/dist-armhf -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON ..
- #cmake -DCMAKE_INSTALL_PREFIX=$rootdir/dist-armhf -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON ..
- make install test
- cp -a examples/* $rootdir/dist-armhf/bin
-
- cd $rootdir
-}
-
-doit 2>&1 | tee $logfile
diff --git a/scripts/build-x86_64.sh b/scripts/build-x86_64.sh
deleted file mode 100755
index 2817979a..00000000
--- a/scripts/build-x86_64.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#! /bin/sh
-
-sdir=`dirname $(readlink -f $0)`
-rootdir=`dirname $sdir`
-logfile=`basename $0 .sh`.log
-rm -f $logfile
-
-export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
-
-doit() {
- echo rootdir $rootdir
- echo logfile $logfile
-
- cd $rootdir
- rm -rf dist-x86_64
- mkdir -p dist-x86_64/bin
- rm -rf build-x86_64
- mkdir -p build-x86_64
- cd build-x86_64
- cmake -DCMAKE_INSTALL_PREFIX=$rootdir/dist-x86_64 -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON ..
- #cmake -DCMAKE_INSTALL_PREFIX=$rootdir/dist-x86_64 -DBUILDJAVA=ON -DBUILDEXAMPLES=ON -DBUILD_TESTING=ON -DDEBUG=ON ..
- make install test
- cp -a examples/* $rootdir/dist-x86_64/bin
-
- cd $rootdir
-}
-
-doit 2>&1 | tee $logfile
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
diff --git a/scripts/rebuild-armhf.sh b/scripts/rebuild-armhf.sh
deleted file mode 100755
index bf39de68..00000000
--- a/scripts/rebuild-armhf.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-
-sdir=`dirname $(readlink -f $0)`
-rootdir=`dirname $sdir`
-logfile=`basename $0 .sh`.log
-rm -f $logfile
-
-export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf
-
-doit() {
- echo rootdir $rootdir
- echo logfile $logfile
-
- cd $rootdir/build-armhf
- make install test
- cp -a examples/* $rootdir/dist-armhf/bin
-
- cd $rootdir
-}
-
-doit 2>&1 | tee $logfile
diff --git a/scripts/rebuild-x86_64.sh b/scripts/rebuild-x86_64.sh
deleted file mode 100755
index 11ad1f87..00000000
--- a/scripts/rebuild-x86_64.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-
-sdir=`dirname $(readlink -f $0)`
-rootdir=`dirname $sdir`
-logfile=`basename $0 .sh`.log
-rm -f $logfile
-
-export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
-
-doit() {
- echo rootdir $rootdir
- echo logfile $logfile
-
- cd $rootdir/build-x86_64
- make install test
- cp -a examples/* $rootdir/dist-x86_64/bin
-
- cd $rootdir
-}
-
-doit 2>&1 | tee $logfile
diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh
new file mode 100644
index 00000000..eba3e8a6
--- /dev/null
+++ b/scripts/rebuild.sh
@@ -0,0 +1,36 @@
+#! /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/build-$archabi
+ make 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 00000000..a51b55c2
--- /dev/null
+++ b/scripts/setup-machine-arch.sh
@@ -0,0 +1,35 @@
+#!/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"
+ ;;
+ "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
+