aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-11 11:55:34 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-12 06:56:29 -0500
commit2d0cf24efddb3e5c688a9376849f790e1c95f53d (patch)
tree89852309f83d69ba5b271f6a5f1ee7a61e43c1c9 /scripts
parent24637dc76936f3e36e1d8cc119dcb0ad5c6da26e (diff)
downloadsubsurface-2d0cf24efddb3e5c688a9376849f790e1c95f53d.tar.gz
build system: do something more reasonable if subsurface is a symlink
This actually changes behavior compared to what we did before. But it seems reasonabel. If ./subsurface is a link to a different directory, then assume that we want a true out of tree build in the current directory. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 39aa15141..c58d4fd32 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -9,22 +9,40 @@
#
# it installs the libraries and subsurface in the install-root subdirectory
# of the current directory (except on Mac where the Subsurface.app ends up
-# in subsurface/build
+# in subsurface/build)
+#
+# by default it puts the build folders in
+# ./subsurface/llibdivecomputer/build (libdivecomputer build)
+# ./subsurface/build (desktop build)
+# ./subsurface/build-mobile (mobile build)
#
# there is basic support for building from a shared directory, e.g., with
# one subsurface source tree on a host computer, accessed from multiple
# VMs as well as the host to build without stepping on each other - the
# one exceptioin is running autotools for libdiveconputer which has to
# happen in the shared libdivecomputer folder
-
-# create a log file of the build
+# one way to achieve this is to have ./subsurface be a symlink; in that
+# case the build directories are libdivecomputer/build, build, build-mobile
+# alternatively a build prefix can be explicitly given with -build-prefix
+# that build prefix is directly pre-pended to the destinations mentioned
+# above - if this is a directory, it needs to end with '/'
# don't keep going if we run into an error
set -e
+# create a log file of the build
+
exec 1> >(tee build.log) 2>&1
SRC=$(pwd)
+
+if [[ -L subsurface && -d subsurface ]] ; then
+ # ./subsurface is a symbolic link to the source directory, so let's
+ # set up a prefix that puts the build directories in the current directory
+ # but this can be overwritten via the command line
+ BUILD_PREFIX="${SRC}/"
+fi
+
PLATFORM=$(uname)
BTSUPPORT="ON"