mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c749498beb
commit
73641c4e73
3 changed files with 53 additions and 40 deletions
|
@ -22,6 +22,7 @@ option(LIBMARBLE_FROM_PKGCONFIG "use pkg-config to retrieve marble" OFF)
|
||||||
|
|
||||||
#Library Handling
|
#Library Handling
|
||||||
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
||||||
|
option(LIBGIT2_DYNAMIC "search for libgit2.so before libgit2.a" OFF)
|
||||||
|
|
||||||
#Options regarding disabling parts of subsurface.
|
#Options regarding disabling parts of subsurface.
|
||||||
option(NO_MARBLE "disable the marble widget" OFF)
|
option(NO_MARBLE "disable the marble widget" OFF)
|
||||||
|
|
|
@ -22,8 +22,13 @@ HINTS
|
||||||
/usr/include
|
/usr/include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF ( LIBGIT2_DYNAMIC )
|
||||||
|
SET( LIBGIT2_SO libgit2.so )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
FIND_LIBRARY( LIBGIT2_LIBRARIES
|
FIND_LIBRARY( LIBGIT2_LIBRARIES
|
||||||
NAMES
|
NAMES
|
||||||
|
${LIBGIT2_SO}
|
||||||
libgit2.a
|
libgit2.a
|
||||||
git2
|
git2
|
||||||
HINTS
|
HINTS
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
# this should be run from the src directory, the layout is supposed to
|
# this should be run from the src directory, the layout is supposed to
|
||||||
# look like this:
|
# look like this:
|
||||||
#.../src/subsurface
|
#.../src/subsurface
|
||||||
# /libgit2
|
|
||||||
# /marble-source
|
# /marble-source
|
||||||
# /libdivecomputer
|
# /libdivecomputer
|
||||||
#
|
#
|
||||||
|
@ -73,7 +72,21 @@ export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
|
|
||||||
echo Building in $SRC, installing in $INSTALL_ROOT
|
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
|
||||||
|
|
||||||
|
# check if we need to build libgit2 (and do so if necessary)
|
||||||
|
|
||||||
|
LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON "
|
||||||
|
LIBGIT=$(ldconfig -p | grep libgit2\\.so\\. | awk -F. '{ print $NF }')
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
cd $SRC
|
||||||
|
|
||||||
|
@ -106,6 +119,7 @@ if [ $PLATFORM = Darwin ] ; then
|
||||||
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
cd $SRC
|
cd $SRC
|
||||||
|
|
||||||
|
@ -227,12 +241,6 @@ fi
|
||||||
|
|
||||||
# finally, build Subsurface
|
# finally, build Subsurface
|
||||||
|
|
||||||
if [ $PLATFORM = Darwin ] ; then
|
|
||||||
SH_LIB_EXT=dylib
|
|
||||||
else
|
|
||||||
SH_LIB_EXT=so
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $SRC/subsurface
|
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]}
|
||||||
|
@ -250,8 +258,7 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
||||||
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=Debug .. \
|
cmake -DCMAKE_BUILD_TYPE=Debug .. \
|
||||||
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
|
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
|
||||||
-DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \
|
${LIBGIT_ARGS} \
|
||||||
-DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT \
|
|
||||||
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
|
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
|
||||||
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
|
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
|
||||||
-DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \
|
-DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue