mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
build-system: allow shared source across multiple hosts
This attempts to allow sharing a host directory across multiple builds, target use case is to have a shared source directory on a VM host and be able to build from that in a number of VMs without those builds stepping on top of each other. Instead of subsurface/build, subsurface/mobile-build, subsurface/libdivecomputer/build, use a prefix path to allow having true out of tree builds. The one shortcoming is that the autotools need to be run in the libdivecomputer directory - that means this will be run on the first system that starts a build. But that seems to cause no harm in my testing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a2717c558a
commit
24637dc769
1 changed files with 32 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# this should be run from the src directory which contains the subsurface
|
# this should be run from the src directory which contains the subsurface
|
||||||
# directory; the layout should look like this:
|
# directory; the layout should look like this:
|
||||||
#.../src/subsurface
|
# .../src/subsurface
|
||||||
#
|
#
|
||||||
# the script will build Subsurface and libdivecomputer (plus some other
|
# the script will build Subsurface and libdivecomputer (plus some other
|
||||||
# dependencies if requestsed) from source.
|
# dependencies if requestsed) from source.
|
||||||
|
@ -10,6 +10,12 @@
|
||||||
# it installs the libraries and subsurface in the install-root subdirectory
|
# it installs the libraries and subsurface in the install-root subdirectory
|
||||||
# of the current directory (except on Mac where the Subsurface.app ends up
|
# of the current directory (except on Mac where the Subsurface.app ends up
|
||||||
# in subsurface/build
|
# in subsurface/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
|
# create a log file of the build
|
||||||
|
|
||||||
|
@ -41,6 +47,14 @@ while [[ $# -gt 0 ]] ; do
|
||||||
# call this script with -build-deps
|
# call this script with -build-deps
|
||||||
BUILD_DEPS="1"
|
BUILD_DEPS="1"
|
||||||
;;
|
;;
|
||||||
|
-build-prefix)
|
||||||
|
# instead of building in build & build-mobile in the current directory, build in <buildprefix>build
|
||||||
|
# and <buildprefix>build-mobile; notice that there's no slash between the prefix and the two directory
|
||||||
|
# names, so if the prefix is supposed to be a path, add the slash at the end of it, or do funky things
|
||||||
|
# where build/build-mobile get appended to partial path name
|
||||||
|
shift
|
||||||
|
BUILD_PREFIX="$1"
|
||||||
|
;;
|
||||||
-build-with-webkit)
|
-build-with-webkit)
|
||||||
# unless you build Qt from source (or at least webkit from source, you won't have webkit installed
|
# unless you build Qt from source (or at least webkit from source, you won't have webkit installed
|
||||||
# -build-with-webkit tells the script that in fact we can assume that webkit is present (it usually
|
# -build-with-webkit tells the script that in fact we can assume that webkit is present (it usually
|
||||||
|
@ -73,7 +87,7 @@ while [[ $# -gt 0 ]] ; do
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown command line argument $arg"
|
echo "Unknown command line argument $arg"
|
||||||
echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]"
|
echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-build-prefix <PREFIX>] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -110,14 +124,14 @@ if [ $PLATFORM = Darwin ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# normally this script builds the desktop version in subsurface/build
|
# normally this script builds the desktop version in subsurface/build
|
||||||
# if the first argument is "-mobile" then build Subsurface-mobile in subsurface/build-mobile
|
# if the first argument is "-mobile" then build Subsurface-mobile in "$BUILD_PREFIX"build-mobile
|
||||||
# if the first argument is "-both" then build both in subsurface/build and subsurface/build-mobile
|
# if the first argument is "-both" then build both in subsurface/build and "$BUILD_PREFIX"build-mobile
|
||||||
BUILDGRANTLEE=0
|
BUILDGRANTLEE=0
|
||||||
|
|
||||||
if [ "$BUILD_MOBILE" = "1" ] ; then
|
if [ "$BUILD_MOBILE" = "1" ] ; then
|
||||||
echo "building Subsurface-mobile in subsurface/build-mobile"
|
echo "building Subsurface-mobile in subsurface/build-mobile"
|
||||||
BUILDS=( "MobileExecutable" )
|
BUILDS=( "MobileExecutable" )
|
||||||
BUILDDIRS=( "build-mobile" )
|
BUILDDIRS=( "${BUILD_PREFIX}build-mobile" )
|
||||||
else
|
else
|
||||||
# if no options are given, build Subsurface
|
# if no options are given, build Subsurface
|
||||||
BUILD_DESKTOP="1"
|
BUILD_DESKTOP="1"
|
||||||
|
@ -126,7 +140,7 @@ fi
|
||||||
if [ "$BUILD_DESKTOP" = "1" ] ; then
|
if [ "$BUILD_DESKTOP" = "1" ] ; then
|
||||||
echo "building Subsurface in subsurface/build"
|
echo "building Subsurface in subsurface/build"
|
||||||
BUILDS+=( "DesktopExecutable" )
|
BUILDS+=( "DesktopExecutable" )
|
||||||
BUILDDIRS+=( "build" )
|
BUILDDIRS+=( "${BUILD_PREFIX}build" )
|
||||||
if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then
|
if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then
|
||||||
PRINTING="-DNO_PRINTING=OFF"
|
PRINTING="-DNO_PRINTING=OFF"
|
||||||
if [ "$QUICK" != "1" ] ; then
|
if [ "$QUICK" != "1" ] ; then
|
||||||
|
@ -149,7 +163,7 @@ export INSTALL_ROOT
|
||||||
# make sure we find our own packages first (e.g., libgit2 only uses pkg_config to find libssh2)
|
# make sure we find our own packages first (e.g., libgit2 only uses pkg_config to find libssh2)
|
||||||
export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
|
export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
|
||||||
echo Building in $SRC, installing in $INSTALL_ROOT
|
echo Building from $SRC, installing in $INSTALL_ROOT
|
||||||
|
|
||||||
# find qmake
|
# find qmake
|
||||||
if [ ! -z $CMAKE_PREFIX_PATH ] ; then
|
if [ ! -z $CMAKE_PREFIX_PATH ] ; then
|
||||||
|
@ -340,19 +354,17 @@ if [ ! -d libdivecomputer/src ] ; then
|
||||||
git submodule update --recursive
|
git submodule update --recursive
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd libdivecomputer
|
mkdir -p "${BUILD_PREFIX}libdivecomputer/build"
|
||||||
|
cd "${BUILD_PREFIX}libdivecomputer/build"
|
||||||
|
|
||||||
mkdir -p build
|
if [ ! -f $SRC/subsurface/libdivecomputer/configure ] ; then
|
||||||
cd build
|
|
||||||
|
|
||||||
if [ ! -f ../configure ] ; then
|
|
||||||
# this is not a typo
|
# this is not a typo
|
||||||
# in some scenarios it appears that autoreconf doesn't copy the
|
# in some scenarios it appears that autoreconf doesn't copy the
|
||||||
# ltmain.sh file; running it twice, however, fixes that problem
|
# ltmain.sh file; running it twice, however, fixes that problem
|
||||||
autoreconf --install ..
|
autoreconf --install $SRC/subsurface/libdivecomputer
|
||||||
autoreconf --install ..
|
autoreconf --install $SRC/subsurface/libdivecomputer
|
||||||
fi
|
fi
|
||||||
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
|
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" $SRC/subsurface/libdivecomputer/configure --prefix=$INSTALL_ROOT --disable-examples
|
||||||
if [ $PLATFORM = Darwin ] ; then
|
if [ $PLATFORM = Darwin ] ; then
|
||||||
# remove some copmpiler options that aren't supported on Mac
|
# remove some copmpiler options that aren't supported on Mac
|
||||||
# otherwise the log gets very noisy
|
# otherwise the log gets very noisy
|
||||||
|
@ -451,22 +463,22 @@ fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
cd $SRC/subsurface
|
|
||||||
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
||||||
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
|
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
|
||||||
BUILDDIR=${BUILDDIRS[$i]}
|
BUILDDIR=${BUILDDIRS[$i]}
|
||||||
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
|
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
|
||||||
|
|
||||||
|
cd $SRC/subsurface
|
||||||
|
|
||||||
# pull the plasma-mobile components from upstream if building Subsurface-mobile
|
# pull the plasma-mobile components from upstream if building Subsurface-mobile
|
||||||
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
|
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
|
||||||
cd $SRC/subsurface
|
|
||||||
bash ./scripts/mobilecomponents.sh
|
bash ./scripts/mobilecomponents.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $SRC/subsurface/$BUILDDIR
|
mkdir -p $BUILDDIR
|
||||||
cd $SRC/subsurface/$BUILDDIR
|
cd $BUILDDIR
|
||||||
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
|
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
|
||||||
cmake -DCMAKE_BUILD_TYPE=$DEBUGRELEASE .. \
|
cmake -DCMAKE_BUILD_TYPE=$DEBUGRELEASE $SRC/subsurface \
|
||||||
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
|
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
|
||||||
${LIBGIT_ARGS} \
|
${LIBGIT_ARGS} \
|
||||||
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
|
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
|
||||||
|
|
Loading…
Add table
Reference in a new issue