mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
build-system: change the logic when to build what
Specifically, don't conflate needing libgit2 with the Mac -builddep argument, and when determining if we need to build libgit2 on Linux, make sure to also check for a version that we may have built in a previous run of the build.sh script. This commit is much easier to understand with git show -w as it contains quite a bit of simple indentation change. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
14d18276e4
commit
d417d717b9
1 changed files with 85 additions and 78 deletions
|
@ -181,18 +181,48 @@ if [ $PLATFORM = Darwin ] ; then
|
|||
else
|
||||
SH_LIB_EXT=so
|
||||
|
||||
# check if we need to build libgit2 (and do so if necessary)
|
||||
|
||||
LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON "
|
||||
# check if we need to build libgit2 (and do so if necessary)
|
||||
# first check pkgconfig (that will capture our own local build if
|
||||
# this script has been run before)
|
||||
if pkg-config --exists libgit2 ; then
|
||||
LIBGIT=$(pkg-config --modversion libgit2 | cut -d. -f2)
|
||||
fi
|
||||
if [[ "$LIBGIT" < "24" ]] ; then
|
||||
# maybe there's a system version that's new enough?
|
||||
LIBGIT=$(ldconfig -p | grep libgit2\\.so\\. | awk -F. '{ print $NF }')
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
|
||||
if [[ "$LIBGIT" < "24" ]] ; then
|
||||
LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
|
||||
|
||||
cd $SRC
|
||||
|
||||
./subsurface/scripts/get-dep-lib.sh single . libgit2
|
||||
pushd libgit2
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
|
||||
make -j4
|
||||
make install
|
||||
popd
|
||||
|
||||
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 | if grep / > /dev/null 2>&1 ; then
|
||||
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||
# when building distributable binaries on a Mac, we cannot rely on anything from Homebrew,
|
||||
# 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.
|
||||
|
||||
if [ "$BUILD_DEPS" == "1" ] ; then
|
||||
./subsurface/scripts/get-dep-lib.sh single . libzip
|
||||
pushd libzip
|
||||
mkdir -p build
|
||||
|
@ -254,35 +284,12 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then
|
|||
make -j4
|
||||
make install
|
||||
popd
|
||||
else
|
||||
else
|
||||
# we are getting libusb and hidapi from pkg-config and that goes wrong
|
||||
# or more specifically, the way libdivecomputer references
|
||||
# the include files goes wrong
|
||||
pkg-config --exists libusb-1.0 && LIBDC_CFLAGS=-I$(dirname $(pkg-config --cflags libusb-1.0 | sed -e 's/^-I//'))
|
||||
pkg-config --exists hidapi && LIBDC_CFLAGS="${LIBDC_CFLAGS} -I$(dirname $(pkg-config --cflags hidapi | sed -e 's/^-I//'))"
|
||||
fi
|
||||
|
||||
LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
|
||||
|
||||
cd $SRC
|
||||
|
||||
./subsurface/scripts/get-dep-lib.sh single . libgit2
|
||||
pushd libgit2
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
|
||||
make -j4
|
||||
make install
|
||||
popd
|
||||
|
||||
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 | if grep / > /dev/null 2>&1 ; then
|
||||
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue