aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-16 15:56:56 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-01-16 17:00:55 -0800
commit73641c4e73d8634eebe8fe00b96ba039da883b27 (patch)
treeac75ab4d3e4cef086514a0a8955020a9c079e82d /scripts
parentc749498bebd84e9454abb289f819cdfffc346055 (diff)
downloadsubsurface-73641c4e73d8634eebe8fe00b96ba039da883b27.tar.gz
build.sh: if new enough libgit2 is installed, use it
Right now this is only designed for Linux where current distros all should have a new enough libgit2 (and our instructions tell people to install this with system tools, so we should also use it). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh79
1 files changed, 43 insertions, 36 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index e78b0e051..f60d7045b 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -3,7 +3,6 @@
# this should be run from the src directory, the layout is supposed to
# look like this:
#.../src/subsurface
-# /libgit2
# /marble-source
# /libdivecomputer
#
@@ -73,37 +72,52 @@ export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
echo Building in $SRC, installing in $INSTALL_ROOT
-# build libgit2
+# set up the right file name extensions
+if [ $PLATFORM = Darwin ] ; then
+ SH_LIB_EXT=dylib
+else
+ SH_LIB_EXT=so
-cd $SRC
+ # check if we need to build libgit2 (and do so if necessary)
-if [ ! -d libgit2 ] ; then
- if [[ $1 = local ]] ; then
- git clone $SRC/../libgit2 libgit2
- else
- git clone git://github.com/libgit2/libgit2
- fi
+ LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON "
+ LIBGIT=$(ldconfig -p | grep libgit2\\.so\\. | awk -F. '{ print $NF }')
fi
-cd libgit2
-# let's build with a recent enough version of master for the latest features
-git fetch origin
-if ! git checkout v0.24.5 ; then
- echo "Can't find the right tag in libgit2 - giving up"
- exit 1
-fi
-mkdir -p build
-cd build
-cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
-make -j4
-make install
-if [ $PLATFORM = Darwin ] ; then
- # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
- cd $INSTALL_ROOT/lib
- NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\ | tr -d '\t')
- echo $NAME | grep / > /dev/null 2>&1
- if [ $? -eq 1 ] ; then
- install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
+if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
+
+ LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
+
+ cd $SRC
+
+ if [ ! -d libgit2 ] ; then
+ if [[ $1 = local ]] ; then
+ git clone $SRC/../libgit2 libgit2
+ else
+ git clone git://github.com/libgit2/libgit2
+ fi
+ fi
+ cd libgit2
+ # let's build with a recent enough version of master for the latest features
+ git fetch origin
+ if ! git checkout v0.24.5 ; then
+ echo "Can't find the right tag in libgit2 - giving up"
+ exit 1
+ fi
+ mkdir -p build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
+ make -j4
+ make install
+
+ if [ $PLATFORM = Darwin ] ; then
+ # in order for macdeployqt to do its job correctly, we need the full path in the dylib ID
+ cd $INSTALL_ROOT/lib
+ NAME=$(otool -L libgit2.dylib | grep -v : | head -1 | cut -f1 -d\ | tr -d '\t')
+ echo $NAME | grep / > /dev/null 2>&1
+ if [ $? -eq 1 ] ; then
+ install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
+ fi
fi
fi
@@ -227,12 +241,6 @@ fi
# finally, build Subsurface
-if [ $PLATFORM = Darwin ] ; then
- SH_LIB_EXT=dylib
-else
- SH_LIB_EXT=so
-fi
-
cd $SRC/subsurface
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
@@ -250,8 +258,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
cmake -DCMAKE_BUILD_TYPE=Debug .. \
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
- -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \
- -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT \
+ ${LIBGIT_ARGS} \
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
-DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \