mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
1f0bf92a34
Some install name magic on two of the libraries we build was necessary for things to work out correctly. And I added an install step to the default build that puts Subsurface in the install_root on other OSs and creates the Subsurface.app under subsurface/build/Subsurface.app on the Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
119 lines
3.1 KiB
Bash
Executable file
119 lines
3.1 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# this should be run from the src directory, the layout is supposed to
|
|
# look like this:
|
|
#.../src/subsurface
|
|
# /libgit2
|
|
# /marble-source
|
|
# /libdivecomputer
|
|
#
|
|
# the script will build these three libraries from source, even if
|
|
# they are installed as part of the host OS since we have seen
|
|
# numerous cases where building with random versions (especially older,
|
|
# but sometimes also newer versions than recommended here) will lead
|
|
# to all kinds of unnecessary pain
|
|
#
|
|
# it installs the libraries and subsurface in the install-root subdirectory
|
|
# of the current directory (except on Mac where the Subsurface.app ends up
|
|
# in subsurface/build
|
|
|
|
SRC=$(pwd)
|
|
PLATFORM=$(uname)
|
|
|
|
if [[ ! -d "subsurface" ]] ; then
|
|
echo "please start this script from the directory containing the Subsurface source directory"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p install-root
|
|
INSTALL_ROOT=$SRC/install-root
|
|
|
|
echo Building in $SRC, installing in $INSTALL_ROOT
|
|
|
|
# build libgit2
|
|
|
|
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
|
|
git checkout v0.22.0
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
|
|
cmake --build . --target 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
|
|
|
|
cd $SRC
|
|
|
|
# build libdivecomputer
|
|
|
|
if [ ! -d libdivecomputer ] ; then
|
|
if [[ $1 = local ]] ; then
|
|
git clone $SRC/../libdivecomputer libdivecomputer
|
|
else
|
|
git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer
|
|
fi
|
|
fi
|
|
cd libdivecomputer
|
|
git checkout Subsurface-4.4
|
|
if [ ! -f configure ] ; then
|
|
autoreconf --install
|
|
./configure --prefix=$INSTALL_ROOT
|
|
fi
|
|
make -j4
|
|
make install
|
|
|
|
cd $SRC
|
|
|
|
# build libssrfmarblewidget
|
|
|
|
if [ ! -d marble-source ] ; then
|
|
if [[ $1 = local ]] ; then
|
|
git clone $SRC/../marble-source marble-source
|
|
else
|
|
git clone -b Subsurface-4.4 git://subsurface-divelog.org/marble marble-source
|
|
fi
|
|
fi
|
|
cd marble-source
|
|
git checkout Subsurface-4.4
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DQT5BUILD=ON \
|
|
-DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
|
|
-DBUILD_MARBLE_TESTS=NO \
|
|
-DWITH_DESIGNER_PLUGIN=NO \
|
|
-DBUILD_MARBLE_APPS=NO \
|
|
$SRC/marble-source
|
|
cd src/lib/marble
|
|
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 libssrfmarblewidget.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
|
|
|
|
cd $SRC/subsurface
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT ..
|
|
make -j4
|
|
make install
|