mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
scripts: expand build.sh
Add option "-src-dir <source directory>" to build options. When calling build.sh without -src-dir it uses src/subsurface as usual, but when called with -src-dir <source directory>, it uses src/<source directory> as source basis. This is a needed option, when working with "git worktree", which is used when working on different branches in parallel (e.g. master and my-feature-branch), because it allows a build directory in each worktree, and thus much faster when switching work. Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
parent
5d3691bbcd
commit
20a1b4befb
1 changed files with 32 additions and 22 deletions
|
@ -47,6 +47,7 @@ PLATFORM=$(uname)
|
||||||
|
|
||||||
BTSUPPORT="ON"
|
BTSUPPORT="ON"
|
||||||
DEBUGRELEASE="Debug"
|
DEBUGRELEASE="Debug"
|
||||||
|
SRC_DIR="subsurface"
|
||||||
|
|
||||||
# deal with all the command line arguments
|
# deal with all the command line arguments
|
||||||
while [[ $# -gt 0 ]] ; do
|
while [[ $# -gt 0 ]] ; do
|
||||||
|
@ -60,6 +61,15 @@ while [[ $# -gt 0 ]] ; do
|
||||||
# only build libdivecomputer and Subsurface - this assumes that all other dependencies don't need rebuilding
|
# only build libdivecomputer and Subsurface - this assumes that all other dependencies don't need rebuilding
|
||||||
QUICK="1"
|
QUICK="1"
|
||||||
;;
|
;;
|
||||||
|
-src-dir)
|
||||||
|
# instead of using "subsurface" as source directory, use src/<srcdir>
|
||||||
|
# this is convinient when using "git worktree" to have multiple branches
|
||||||
|
# checked out on the computer.
|
||||||
|
# remark <srcdir> must be in src (in parallel to subsurface), in order to
|
||||||
|
# use the same 3rd party set.
|
||||||
|
shift
|
||||||
|
SRC_DIR="$1"
|
||||||
|
;;
|
||||||
-build-deps)
|
-build-deps)
|
||||||
# in order to build the dependencies on Mac for release builds (to deal with the macosx-version-min for those
|
# in order to build the dependencies on Mac for release builds (to deal with the macosx-version-min for those
|
||||||
# call this script with -build-deps
|
# call this script with -build-deps
|
||||||
|
@ -105,7 +115,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-prefix <PREFIX>] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]"
|
echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-src-dir <SUBSURFACE directory>] [-build-prefix <PREFIX>] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -147,7 +157,7 @@ fi
|
||||||
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 ${SRC_DIR}/build-mobile"
|
||||||
BUILDS=( "MobileExecutable" )
|
BUILDS=( "MobileExecutable" )
|
||||||
BUILDDIRS=( "${BUILD_PREFIX}build-mobile" )
|
BUILDDIRS=( "${BUILD_PREFIX}build-mobile" )
|
||||||
else
|
else
|
||||||
|
@ -156,7 +166,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$BUILD_DESKTOP" = "1" ] ; then
|
if [ "$BUILD_DESKTOP" = "1" ] ; then
|
||||||
echo "building Subsurface in subsurface/build"
|
echo "building Subsurface in ${SRC_DIR}/build"
|
||||||
BUILDS+=( "DesktopExecutable" )
|
BUILDS+=( "DesktopExecutable" )
|
||||||
BUILDDIRS+=( "${BUILD_PREFIX}build" )
|
BUILDDIRS+=( "${BUILD_PREFIX}build" )
|
||||||
if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then
|
if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then
|
||||||
|
@ -169,7 +179,7 @@ if [ "$BUILD_DESKTOP" = "1" ] ; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "subsurface" ]] ; then
|
if [[ ! -d "${SRC_DIR}" ]] ; then
|
||||||
echo "please start this script from the directory containing the Subsurface source directory"
|
echo "please start this script from the directory containing the Subsurface source directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -262,7 +272,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
# because that always requires the latest OS (how stupid is that - and they consider it a
|
# because that always requires the latest OS (how stupid is that - and they consider it a
|
||||||
# feature). So we painfully need to build the dependencies ourselves.
|
# feature). So we painfully need to build the dependencies ourselves.
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
./subsurface/scripts/get-dep-lib.sh single . libcurl
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . libcurl
|
||||||
pushd libcurl
|
pushd libcurl
|
||||||
bash ./buildconf
|
bash ./buildconf
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
@ -273,7 +283,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
make install
|
make install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
./subsurface/scripts/get-dep-lib.sh single . openssl
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . openssl
|
||||||
pushd openssl
|
pushd openssl
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
@ -284,7 +294,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
make -k install
|
make -k install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
./subsurface/scripts/get-dep-lib.sh single . libssh2
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . libssh2
|
||||||
pushd libssh2
|
pushd libssh2
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
@ -307,7 +317,7 @@ if [[ "$LIBGIT" -lt "26" ]] ; then
|
||||||
|
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
|
|
||||||
./subsurface/scripts/get-dep-lib.sh single . libgit2
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . libgit2
|
||||||
pushd libgit2
|
pushd libgit2
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
@ -331,7 +341,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
# because that always requires the latest OS (how stupid is that - and they consider it a
|
# because that always requires the latest OS (how stupid is that - and they consider it a
|
||||||
# feature). So we painfully need to build the dependencies ourselves.
|
# feature). So we painfully need to build the dependencies ourselves.
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
./subsurface/scripts/get-dep-lib.sh single . libzip
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . libzip
|
||||||
pushd libzip
|
pushd libzip
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
@ -342,7 +352,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
make install
|
make install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
./subsurface/scripts/get-dep-lib.sh single . hidapi
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . hidapi
|
||||||
pushd hidapi
|
pushd hidapi
|
||||||
# there is no good tag, so just build master
|
# there is no good tag, so just build master
|
||||||
bash ./bootstrap
|
bash ./bootstrap
|
||||||
|
@ -353,7 +363,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||||
make install
|
make install
|
||||||
popd
|
popd
|
||||||
|
|
||||||
./subsurface/scripts/get-dep-lib.sh single . libusb
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . libusb
|
||||||
pushd libusb
|
pushd libusb
|
||||||
bash ./bootstrap.sh
|
bash ./bootstrap.sh
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
@ -369,7 +379,7 @@ cd "$SRC"
|
||||||
|
|
||||||
# build libdivecomputer
|
# build libdivecomputer
|
||||||
|
|
||||||
cd subsurface
|
cd ${SRC_DIR}
|
||||||
|
|
||||||
if [ ! -d libdivecomputer/src ] ; then
|
if [ ! -d libdivecomputer/src ] ; then
|
||||||
git submodule init
|
git submodule init
|
||||||
|
@ -379,14 +389,14 @@ fi
|
||||||
mkdir -p "${BUILD_PREFIX}libdivecomputer/build"
|
mkdir -p "${BUILD_PREFIX}libdivecomputer/build"
|
||||||
cd "${BUILD_PREFIX}libdivecomputer/build"
|
cd "${BUILD_PREFIX}libdivecomputer/build"
|
||||||
|
|
||||||
if [ ! -f "$SRC"/subsurface/libdivecomputer/configure ] ; then
|
if [ ! -f "$SRC"/${SRC_DIR}/libdivecomputer/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 "$SRC"/subsurface/libdivecomputer
|
autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer
|
||||||
autoreconf --install "$SRC"/subsurface/libdivecomputer
|
autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer
|
||||||
fi
|
fi
|
||||||
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" "$SRC"/subsurface/libdivecomputer/configure --prefix="$INSTALL_ROOT" --disable-examples
|
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" "$SRC"/${SRC_DIR}/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
|
||||||
|
@ -446,7 +456,7 @@ fi
|
||||||
if [ "$BUILDGRANTLEE" = "1" ] ; then
|
if [ "$BUILDGRANTLEE" = "1" ] ; then
|
||||||
# build grantlee
|
# build grantlee
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
./subsurface/scripts/get-dep-lib.sh single . grantlee
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . grantlee
|
||||||
pushd grantlee
|
pushd grantlee
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
@ -463,7 +473,7 @@ if [ "$QUICK" != "1" ] ; then
|
||||||
# build the googlemaps map plugin
|
# build the googlemaps map plugin
|
||||||
|
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
./subsurface/scripts/get-dep-lib.sh single . googlemaps
|
./${SRC_DIR}/scripts/get-dep-lib.sh single . googlemaps
|
||||||
pushd googlemaps
|
pushd googlemaps
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
mkdir -p J10build
|
mkdir -p J10build
|
||||||
|
@ -490,7 +500,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
||||||
BUILDDIR=${BUILDDIRS[$i]}
|
BUILDDIR=${BUILDDIRS[$i]}
|
||||||
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
|
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
|
||||||
|
|
||||||
cd "$SRC"/subsurface
|
cd "$SRC"/${SRC_DIR}
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -511,7 +521,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
||||||
$LIBGIT2_FROM_PKGCONFIG \
|
$LIBGIT2_FROM_PKGCONFIG \
|
||||||
-DFORCE_LIBSSH=OFF \
|
-DFORCE_LIBSSH=OFF \
|
||||||
$PRINTING $EXTRA_OPTS \
|
$PRINTING $EXTRA_OPTS \
|
||||||
"$SRC"/subsurface
|
"$SRC"/${SRC_DIR}
|
||||||
|
|
||||||
if [ "$PLATFORM" = Darwin ] ; then
|
if [ "$PLATFORM" = Darwin ] ; then
|
||||||
rm -rf Subsurface.app
|
rm -rf Subsurface.app
|
||||||
|
@ -528,7 +538,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
||||||
mkdir -p appdir/usr/share/metainfo
|
mkdir -p appdir/usr/share/metainfo
|
||||||
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
|
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
|
||||||
cp -r ./install-root/* ./appdir/usr
|
cp -r ./install-root/* ./appdir/usr
|
||||||
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
|
cp ${SRC_DIR}/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
|
||||||
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
|
cp ${SRC_DIR}/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue