2016-09-25 19:54:39 +00:00
|
|
|
#!/bin/bash
|
2015-02-17 21:10:45 +00:00
|
|
|
#
|
2017-12-03 19:48:51 +00:00
|
|
|
# this should be run from the src directory which contains the subsurface
|
|
|
|
# directory; the layout should look like this:
|
2015-02-17 21:10:45 +00:00
|
|
|
#.../src/subsurface
|
|
|
|
#
|
2017-12-03 19:48:51 +00:00
|
|
|
# the script will build Subsurface and libdivecomputer (plus some other
|
|
|
|
# dependencies if requestsed) from source.
|
2015-04-15 18:33:14 +00:00
|
|
|
#
|
|
|
|
# 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
|
2015-02-17 21:10:45 +00:00
|
|
|
|
2015-06-02 17:22:10 +00:00
|
|
|
# create a log file of the build
|
|
|
|
exec 1> >(tee build.log) 2>&1
|
|
|
|
|
2017-07-16 04:39:54 +00:00
|
|
|
SRC=$(pwd)
|
|
|
|
PLATFORM=$(uname)
|
|
|
|
|
2017-10-16 01:49:50 +00:00
|
|
|
BTSUPPORT="ON"
|
2018-07-09 16:53:43 +00:00
|
|
|
DEBUGRELEASE="Debug"
|
2017-10-16 01:49:50 +00:00
|
|
|
|
2017-07-28 14:44:09 +00:00
|
|
|
# deal with all the command line arguments
|
|
|
|
while [[ $# -gt 0 ]] ; do
|
|
|
|
arg="$1"
|
|
|
|
case $arg in
|
2017-10-16 01:49:50 +00:00
|
|
|
-no-bt)
|
|
|
|
# force Bluetooth support off
|
|
|
|
BTSUPPORT="OFF"
|
2017-10-16 02:17:58 +00:00
|
|
|
;;
|
2019-09-05 15:22:50 +00:00
|
|
|
-quick)
|
|
|
|
# only build libdivecomputer and Subsurface - this assumes that all other dependencies don't need rebuilding
|
|
|
|
QUICK="1"
|
|
|
|
;;
|
2017-07-28 14:44:09 +00:00
|
|
|
-build-deps)
|
|
|
|
# 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
|
|
|
|
BUILD_DEPS="1"
|
|
|
|
;;
|
|
|
|
-build-with-webkit)
|
|
|
|
# unless you build Qt from source (or at least webkit from source, you won't have webkit installed
|
|
|
|
# -build-with-webkit tells the script that in fact we can assume that webkit is present (it usually
|
|
|
|
# is still available on Linux distros)
|
|
|
|
BUILD_WITH_WEBKIT="1"
|
|
|
|
;;
|
|
|
|
-mobile)
|
|
|
|
# we are building Subsurface-mobile
|
2018-05-08 09:28:33 +00:00
|
|
|
# Note that this will run natively on the host OS.
|
|
|
|
# To cross build for Android or iOS (including simulator)
|
|
|
|
# use the scripts in packaging/xxx
|
2017-07-28 14:44:09 +00:00
|
|
|
BUILD_MOBILE="1"
|
|
|
|
;;
|
|
|
|
-desktop)
|
|
|
|
# we are building Subsurface
|
|
|
|
BUILD_DESKTOP="1"
|
|
|
|
;;
|
|
|
|
-both)
|
|
|
|
# we are building Subsurface and Subsurface-mobile
|
|
|
|
BUILD_MOBILE="1"
|
|
|
|
BUILD_DESKTOP="1"
|
|
|
|
;;
|
2017-11-05 19:55:52 +00:00
|
|
|
-create-appdir)
|
|
|
|
# we are building an AppImage as by product
|
|
|
|
CREATE_APPDIR="1"
|
|
|
|
;;
|
2018-07-09 16:53:43 +00:00
|
|
|
-release)
|
|
|
|
# don't build Debug binaries
|
|
|
|
DEBUGRELEASE="Release"
|
|
|
|
;;
|
2017-07-28 14:44:09 +00:00
|
|
|
*)
|
|
|
|
echo "Unknown command line argument $arg"
|
2019-09-05 15:22:50 +00:00
|
|
|
echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]"
|
2018-07-09 17:33:04 +00:00
|
|
|
exit 1
|
2017-07-28 14:44:09 +00:00
|
|
|
;;
|
|
|
|
esac
|
2017-07-03 16:45:05 +00:00
|
|
|
shift
|
2017-07-28 14:44:09 +00:00
|
|
|
done
|
2017-07-03 16:45:05 +00:00
|
|
|
|
2019-09-05 15:22:50 +00:00
|
|
|
if [ "$BUILD_DEPS" = "1" ] && [ "$QUICK" = "1" ] ; then
|
|
|
|
echo "Conflicting options; cannot request combine -build-deps and -quick"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2016-03-16 08:02:03 +00:00
|
|
|
# Verify that the Xcode Command Line Tools are installed
|
|
|
|
if [ $PLATFORM = Darwin ] ; then
|
2017-07-15 17:37:50 +00:00
|
|
|
if [ -d /Developer/SDKs ] ; then
|
|
|
|
SDKROOT=/Developer/SDKs
|
|
|
|
elif [ -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs ] ; then
|
|
|
|
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
|
|
|
|
else
|
|
|
|
echo "Cannot find SDK sysroot (usually /Developer/SDKs or"
|
|
|
|
echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
BASESDK=$(ls $SDKROOT | grep "MacOSX10\.1.\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//")
|
2018-09-13 04:33:21 +00:00
|
|
|
OLDER_MAC="-mmacosx-version-min=10.11 -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
|
2017-07-15 17:37:50 +00:00
|
|
|
OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/"
|
2018-10-03 16:54:44 +00:00
|
|
|
if [[ ! -d /usr/include && ! -d "${SDKROOT}/MacOSX.sdk/usr/include" ]] ; then
|
2016-03-16 08:02:03 +00:00
|
|
|
echo "Error: Xcode Command Line Tools are not installed"
|
|
|
|
echo ""
|
|
|
|
echo "Please run:"
|
|
|
|
echo " xcode-select --install"
|
|
|
|
echo "to install them (you'll have to agree to Apple's licensing terms etc), then run build.sh again"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-01-17 18:44:00 +00:00
|
|
|
# normally this script builds the desktop version in subsurface/build
|
|
|
|
# if the first argument is "-mobile" then build Subsurface-mobile in subsurface/build-mobile
|
|
|
|
# if the first argument is "-both" then build both in subsurface/build and subsurface/build-mobile
|
2016-01-22 18:15:51 +00:00
|
|
|
BUILDGRANTLEE=0
|
2017-07-28 14:44:09 +00:00
|
|
|
|
|
|
|
if [ "$BUILD_MOBILE" = "1" ] ; then
|
2016-01-17 18:44:00 +00:00
|
|
|
echo "building Subsurface-mobile in subsurface/build-mobile"
|
|
|
|
BUILDS=( "MobileExecutable" )
|
|
|
|
BUILDDIRS=( "build-mobile" )
|
|
|
|
else
|
2017-07-28 14:44:09 +00:00
|
|
|
# if no options are given, build Subsurface
|
|
|
|
BUILD_DESKTOP="1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BUILD_DESKTOP" = "1" ] ; then
|
2016-01-17 18:44:00 +00:00
|
|
|
echo "building Subsurface in subsurface/build"
|
2017-07-28 14:44:09 +00:00
|
|
|
BUILDS+=( "DesktopExecutable" )
|
|
|
|
BUILDDIRS+=( "build" )
|
2017-07-16 04:39:54 +00:00
|
|
|
if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then
|
2019-09-05 15:22:50 +00:00
|
|
|
PRINTING="-DNO_PRINTING=OFF"
|
|
|
|
if [ "$QUICK" != "1" ] ; then
|
|
|
|
BUILDGRANTLEE=1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
PRINTING="-DNO_PRINTING=ON"
|
2017-07-16 04:39:54 +00:00
|
|
|
fi
|
2016-01-17 18:44:00 +00:00
|
|
|
fi
|
2016-01-07 14:59:33 +00:00
|
|
|
|
2015-02-17 21:10:45 +00:00
|
|
|
if [[ ! -d "subsurface" ]] ; then
|
|
|
|
echo "please start this script from the directory containing the Subsurface source directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-02-18 06:03:15 +00:00
|
|
|
|
2015-04-09 22:00:52 +00:00
|
|
|
mkdir -p install-root
|
|
|
|
INSTALL_ROOT=$SRC/install-root
|
2017-08-03 23:50:23 +00:00
|
|
|
export INSTALL_ROOT
|
2015-02-17 21:10:45 +00:00
|
|
|
|
2015-06-04 20:52:13 +00:00
|
|
|
# make sure we find our own packages first (e.g., libgit2 only uses pkg_config to find libssh2)
|
|
|
|
export PKG_CONFIG_PATH=$INSTALL_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
|
|
|
2015-04-15 18:33:14 +00:00
|
|
|
echo Building in $SRC, installing in $INSTALL_ROOT
|
|
|
|
|
2017-08-26 16:36:27 +00:00
|
|
|
# find qmake
|
|
|
|
if [ ! -z $CMAKE_PREFIX_PATH ] ; then
|
|
|
|
QMAKE=$CMAKE_PREFIX_PATH/../../bin/qmake
|
|
|
|
else
|
2018-09-06 00:12:44 +00:00
|
|
|
hash qmake > /dev/null 2> /dev/null && QMAKE=qmake
|
|
|
|
[ -z $QMAKE ] && hash qmake-qt5 > /dev/null 2> /dev/null && QMAKE=qmake-qt5
|
|
|
|
[ -z $QMAKE ] && echo "cannot find qmake or qmake-qt5" && exit 1
|
2017-08-26 16:36:27 +00:00
|
|
|
fi
|
|
|
|
|
2017-08-26 18:51:03 +00:00
|
|
|
# on Debian and Ubuntu based systems, the private QtLocation and
|
|
|
|
# QtPositioning headers aren't bundled. Download them if necessary.
|
|
|
|
if [ $PLATFORM = Linux ] ; then
|
|
|
|
QT_HEADERS_PATH=`$QMAKE -query QT_INSTALL_HEADERS`
|
2018-05-12 16:35:43 +00:00
|
|
|
QT_VERSION=`$QMAKE -query QT_VERSION`
|
2017-08-26 18:51:03 +00:00
|
|
|
|
2017-09-16 08:49:35 +00:00
|
|
|
if [ ! -d "$QT_HEADERS_PATH/QtLocation/$QT_VERSION/QtLocation/private" ] &&
|
2017-08-26 18:51:03 +00:00
|
|
|
[ ! -d $INSTALL_ROOT/include/QtLocation/private ] ; then
|
2017-09-16 08:49:35 +00:00
|
|
|
echo "Missing private Qt headers for $QT_VERSION; downloading them..."
|
2017-08-26 18:51:03 +00:00
|
|
|
|
|
|
|
QTLOC_GIT=./qtlocation_git
|
|
|
|
QTLOC_PRIVATE=$INSTALL_ROOT/include/QtLocation/private
|
|
|
|
QTPOS_PRIVATE=$INSTALL_ROOT/include/QtPositioning/private
|
|
|
|
|
|
|
|
rm -rf $QTLOC_GIT > /dev/null 2>&1
|
|
|
|
rm -rf $INSTALL_ROOT/include/QtLocation > /dev/null 2>&1
|
|
|
|
rm -rf $INSTALL_ROOT/include/QtPositioning > /dev/null 2>&1
|
|
|
|
|
|
|
|
git clone --branch v$QT_VERSION git://code.qt.io/qt/qtlocation.git --depth=1 $QTLOC_GIT
|
|
|
|
|
|
|
|
mkdir -p $QTLOC_PRIVATE
|
|
|
|
cd $QTLOC_GIT/src/location
|
|
|
|
find -name '*_p.h' | xargs cp -t $QTLOC_PRIVATE
|
|
|
|
cd $SRC
|
|
|
|
|
|
|
|
mkdir -p $QTPOS_PRIVATE
|
|
|
|
cd $QTLOC_GIT/src/positioning
|
|
|
|
find -name '*_p.h' | xargs cp -t $QTPOS_PRIVATE
|
|
|
|
cd $SRC
|
|
|
|
|
|
|
|
echo "* cleanup..."
|
|
|
|
rm -rf $QTLOC_GIT > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-01-16 23:56:56 +00:00
|
|
|
# set up the right file name extensions
|
|
|
|
if [ $PLATFORM = Darwin ] ; then
|
|
|
|
SH_LIB_EXT=dylib
|
2018-07-07 17:26:31 +00:00
|
|
|
if [ ! "$BUILD_DEPS" == "1" ] ; then
|
|
|
|
pkg-config --exists libgit2 && LIBGIT=$(pkg-config --modversion libgit2 | cut -d. -f2)
|
|
|
|
if [[ "$LIBGIT" > "23" ]] ; then
|
|
|
|
LIBGIT2_FROM_PKGCONFIG="-DLIBGIT2_FROM_PKGCONFIG=ON"
|
|
|
|
fi
|
|
|
|
fi
|
2017-01-16 23:56:56 +00:00
|
|
|
else
|
|
|
|
SH_LIB_EXT=so
|
2015-02-17 21:10:45 +00:00
|
|
|
|
2017-01-16 23:56:56 +00:00
|
|
|
LIBGIT_ARGS=" -DLIBGIT2_DYNAMIC=ON "
|
2018-05-20 00:14:15 +00:00
|
|
|
# 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)
|
2018-07-07 17:26:31 +00:00
|
|
|
LIBGIT2_FROM_PKGCONFIG="-DLIBGIT2_FROM_PKGCONFIG=ON"
|
2018-05-20 00:14:15 +00:00
|
|
|
fi
|
2019-01-08 09:15:44 +00:00
|
|
|
if [[ "$LIBGIT" < "26" ]] ; then
|
2018-05-20 00:14:15 +00:00
|
|
|
# maybe there's a system version that's new enough?
|
|
|
|
LIBGIT=$(ldconfig -p | grep libgit2\\.so\\. | awk -F. '{ print $NF }')
|
2017-07-03 16:45:05 +00:00
|
|
|
fi
|
2018-05-20 00:14:15 +00:00
|
|
|
fi
|
2017-01-16 23:56:56 +00:00
|
|
|
|
2018-05-20 08:53:02 +00:00
|
|
|
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.
|
|
|
|
cd $SRC
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . libcurl
|
|
|
|
pushd libcurl
|
|
|
|
bash ./buildconf
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT --with-darwinssl \
|
|
|
|
--disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp
|
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . libssh2
|
|
|
|
pushd libssh2
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2018-07-09 16:53:43 +00:00
|
|
|
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=$DEBUGRELEASE -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ..
|
2018-05-20 08:53:02 +00:00
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
2018-07-07 18:31:44 +00:00
|
|
|
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 libssh2.dylib | grep -v : | head -1 | cut -f1 -d\ | tr -d '\t')
|
|
|
|
echo $NAME | if grep -v / > /dev/null 2>&1 ; then
|
|
|
|
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
|
|
|
fi
|
|
|
|
fi
|
2018-05-20 08:53:02 +00:00
|
|
|
fi
|
|
|
|
|
2019-01-08 09:15:44 +00:00
|
|
|
if [[ "$LIBGIT" < "26" ]] ; then
|
2017-01-16 23:56:56 +00:00
|
|
|
LIBGIT_ARGS=" -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT "
|
|
|
|
|
|
|
|
cd $SRC
|
|
|
|
|
2018-05-16 10:46:41 +00:00
|
|
|
./subsurface/scripts/get-dep-lib.sh single . libgit2
|
|
|
|
pushd libgit2
|
2017-01-16 23:56:56 +00:00
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2018-07-09 16:53:43 +00:00
|
|
|
cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=$DEBUGRELEASE -DBUILD_CLAR=OFF ..
|
2017-01-16 23:56:56 +00:00
|
|
|
make -j4
|
|
|
|
make install
|
2018-05-16 10:46:41 +00:00
|
|
|
popd
|
2017-01-16 23:56:56 +00:00
|
|
|
|
|
|
|
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')
|
2018-07-07 17:59:22 +00:00
|
|
|
echo $NAME | if grep -v / > /dev/null 2>&1 ; then
|
2017-01-16 23:56:56 +00:00
|
|
|
install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME"
|
|
|
|
fi
|
2015-04-15 18:33:14 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-05-20 00:14:15 +00:00
|
|
|
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.
|
2018-05-20 07:52:26 +00:00
|
|
|
cd $SRC
|
2018-05-20 00:14:15 +00:00
|
|
|
./subsurface/scripts/get-dep-lib.sh single . libzip
|
|
|
|
pushd libzip
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2018-08-04 19:20:47 +00:00
|
|
|
cmake $OLDER_MAC_CMAKE -DCMAKE_BUILD_TYPE=$DEBUGRELEASE \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
|
|
|
|
..
|
2018-05-20 00:14:15 +00:00
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . hidapi
|
|
|
|
pushd hidapi
|
|
|
|
# there is no good tag, so just build master
|
|
|
|
bash ./bootstrap
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT
|
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . libusb
|
|
|
|
pushd libusb
|
|
|
|
bash ./bootstrap.sh
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
CFLAGS="$OLDER_MAC" ../configure --prefix=$INSTALL_ROOT --disable-examples
|
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . openssl
|
|
|
|
pushd openssl
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
../Configure --prefix=$INSTALL_ROOT --openssldir=$INSTALL_ROOT $OLDER_MAC darwin64-x86_64-cc
|
|
|
|
make depend
|
|
|
|
# all the tests fail because the assume that openssl is already installed. Odd? Still thinks work
|
|
|
|
make -j4 -k
|
|
|
|
make -k install
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2017-11-12 02:48:27 +00:00
|
|
|
|
2015-02-17 21:10:45 +00:00
|
|
|
cd $SRC
|
|
|
|
|
|
|
|
# build libdivecomputer
|
|
|
|
|
2017-12-03 19:48:51 +00:00
|
|
|
cd subsurface
|
|
|
|
|
2017-12-04 01:23:34 +00:00
|
|
|
if [ ! -d libdivecomputer/src ] ; then
|
2017-12-13 19:36:26 +00:00
|
|
|
git submodule init
|
2017-12-03 19:48:51 +00:00
|
|
|
git submodule update --recursive
|
2015-02-17 21:10:45 +00:00
|
|
|
fi
|
2017-12-03 19:48:51 +00:00
|
|
|
|
2015-02-17 21:10:45 +00:00
|
|
|
cd libdivecomputer
|
2016-02-02 09:17:51 +00:00
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
if [ ! -f ../configure ] ; then
|
2017-01-16 18:12:17 +00:00
|
|
|
# this is not a typo
|
|
|
|
# in some scenarios it appears that autoreconf doesn't copy the
|
|
|
|
# ltmain.sh file; running it twice, however, fixes that problem
|
|
|
|
autoreconf --install ..
|
2016-02-02 09:17:51 +00:00
|
|
|
autoreconf --install ..
|
2015-02-17 21:10:45 +00:00
|
|
|
fi
|
2017-07-15 21:18:33 +00:00
|
|
|
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples
|
2018-05-12 04:07:58 +00:00
|
|
|
if [ $PLATFORM = Darwin ] ; then
|
2018-10-03 13:56:27 +00:00
|
|
|
# remove some copmpiler options that aren't supported on Mac
|
|
|
|
# otherwise the log gets very noisy
|
2018-05-12 04:07:58 +00:00
|
|
|
for i in $(find . -name Makefile)
|
|
|
|
do
|
|
|
|
sed -i .bak 's/-Wrestrict//;s/-Wno-unused-but-set-variable//' $i
|
|
|
|
done
|
2018-10-03 13:56:27 +00:00
|
|
|
# it seems that on my Mac some of the configure tests for libdivecomputer
|
|
|
|
# pass even though the feature tested for is actually missing
|
|
|
|
# let's hack around that
|
|
|
|
# touch config.status, recreate config.h and then disable HAVE_CLOCK_GETTIME
|
|
|
|
# this seems to work so that the Makefile doesn't re-run the
|
|
|
|
# configure process and overwrite all the changes we just made
|
|
|
|
touch config.status
|
|
|
|
make config.h
|
|
|
|
grep CLOCK_GETTIME config.h
|
|
|
|
sed -i .bak 's/^#define HAVE_CLOCK_GETTIME 1/#undef HAVE_CLOCK_GETTIME /' config.h
|
2018-05-12 04:07:58 +00:00
|
|
|
fi
|
2015-02-17 21:10:45 +00:00
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
|
2017-07-16 04:41:47 +00:00
|
|
|
if [ $PLATFORM = Darwin ] ; then
|
|
|
|
if [ -z "$CMAKE_PREFIX_PATH" ] ; then
|
2017-08-26 16:36:27 +00:00
|
|
|
libdir=`$QMAKE -query QT_INSTALL_LIBS`
|
2017-07-16 04:41:47 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
export CMAKE_PREFIX_PATH=$libdir/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.9.1" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.9.1/clang_64/lib/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.9" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.9/clang_64/lib/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.8" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.8/clang_64/lib/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.7" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.7/clang_64/lib/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.6" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.6/clang_64/lib/cmake
|
|
|
|
elif [ -d "$HOME/Qt/5.5" ] ; then
|
|
|
|
export CMAKE_PREFIX_PATH=~/Qt/5.5/clang_64/lib/cmake
|
|
|
|
elif [ -d /usr/local/opt/qt5/lib ] ; then
|
|
|
|
# Homebrew location for qt5 package
|
|
|
|
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
|
|
|
|
else
|
|
|
|
echo "cannot find Qt 5.5 or newer in ~/Qt"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-02-17 21:10:45 +00:00
|
|
|
cd $SRC
|
|
|
|
|
2017-07-28 14:44:09 +00:00
|
|
|
if [ "$BUILD_WITH_WEBKIT" = "1" ]; then
|
2019-02-01 02:11:25 +00:00
|
|
|
EXTRA_OPTS="-DNO_USERMANUAL=OFF"
|
2017-07-28 14:44:09 +00:00
|
|
|
else
|
2019-02-01 02:11:25 +00:00
|
|
|
EXTRA_OPTS="-DNO_USERMANUAL=ON"
|
2017-07-28 14:44:09 +00:00
|
|
|
fi
|
|
|
|
|
2016-01-22 18:15:51 +00:00
|
|
|
if [ "$BUILDGRANTLEE" = "1" ] ; then
|
2016-01-08 05:30:51 +00:00
|
|
|
# build grantlee
|
|
|
|
cd $SRC
|
2018-10-06 07:42:58 +00:00
|
|
|
./subsurface/scripts/get-dep-lib.sh single . grantlee
|
|
|
|
pushd grantlee
|
2016-01-08 05:30:51 +00:00
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2018-07-09 16:53:43 +00:00
|
|
|
cmake $OLDER_MAC_CMAKE -DCMAKE_BUILD_TYPE=$DEBUGRELEASE \
|
2016-01-08 05:30:51 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \
|
2017-11-05 23:50:11 +00:00
|
|
|
-DBUILD_TESTS=NO \
|
2016-01-08 05:30:51 +00:00
|
|
|
$SRC/grantlee
|
|
|
|
make -j4
|
|
|
|
make install
|
2018-10-06 07:42:58 +00:00
|
|
|
popd
|
2015-06-04 18:53:31 +00:00
|
|
|
fi
|
|
|
|
|
2019-09-05 15:22:50 +00:00
|
|
|
if [ "$QUICK" != "1" ] ; then
|
|
|
|
# build the googlemaps map plugin
|
2016-06-22 16:17:25 +00:00
|
|
|
|
2019-09-05 15:22:50 +00:00
|
|
|
cd $SRC
|
|
|
|
./subsurface/scripts/get-dep-lib.sh single . googlemaps
|
|
|
|
pushd googlemaps
|
|
|
|
mkdir -p build
|
|
|
|
mkdir -p J10build
|
|
|
|
cd build
|
|
|
|
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro
|
|
|
|
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag;
|
|
|
|
# since things compile fine with c++11, let's just hack that away
|
|
|
|
# similarly, don't use -Wdata-time
|
|
|
|
if [ "$TRAVIS" = "true" ] ; then
|
|
|
|
mv Makefile Makefile.bak
|
|
|
|
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
|
|
|
|
fi
|
|
|
|
make -j4
|
|
|
|
make install
|
|
|
|
popd
|
2017-08-02 19:59:02 +00:00
|
|
|
fi
|
2016-06-22 16:17:25 +00:00
|
|
|
|
2015-06-04 18:53:31 +00:00
|
|
|
# finally, build Subsurface
|
|
|
|
|
2017-11-12 02:48:27 +00:00
|
|
|
set -x
|
|
|
|
|
2015-02-17 21:10:45 +00:00
|
|
|
cd $SRC/subsurface
|
2016-01-17 18:44:00 +00:00
|
|
|
for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
|
|
|
|
SUBSURFACE_EXECUTABLE=${BUILDS[$i]}
|
|
|
|
BUILDDIR=${BUILDDIRS[$i]}
|
|
|
|
echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR"
|
|
|
|
|
2016-01-18 19:20:05 +00:00
|
|
|
# pull the plasma-mobile components from upstream if building Subsurface-mobile
|
|
|
|
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
|
|
|
|
cd $SRC/subsurface
|
|
|
|
bash ./scripts/mobilecomponents.sh
|
|
|
|
fi
|
|
|
|
|
2016-01-17 18:44:00 +00:00
|
|
|
mkdir -p $SRC/subsurface/$BUILDDIR
|
|
|
|
cd $SRC/subsurface/$BUILDDIR
|
2016-03-16 08:00:37 +00:00
|
|
|
export CMAKE_PREFIX_PATH="$INSTALL_ROOT/lib/cmake;${CMAKE_PREFIX_PATH}"
|
2018-07-09 16:53:43 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=$DEBUGRELEASE .. \
|
2016-01-17 18:44:00 +00:00
|
|
|
-DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \
|
2017-01-16 23:56:56 +00:00
|
|
|
${LIBGIT_ARGS} \
|
2016-01-17 18:44:00 +00:00
|
|
|
-DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \
|
|
|
|
-DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \
|
2016-03-16 08:00:37 +00:00
|
|
|
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
|
2017-10-16 01:49:50 +00:00
|
|
|
-DBTSUPPORT=${BTSUPPORT} \
|
2017-11-05 15:05:08 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX=${INSTALL_ROOT} \
|
2018-07-07 17:26:31 +00:00
|
|
|
$LIBGIT2_FROM_PKGCONFIG \
|
2017-11-12 02:48:27 +00:00
|
|
|
-DFORCE_LIBSSH=OFF \
|
2017-07-28 14:44:09 +00:00
|
|
|
$PRINTING $EXTRA_OPTS
|
2016-01-17 18:44:00 +00:00
|
|
|
|
|
|
|
if [ $PLATFORM = Darwin ] ; then
|
|
|
|
rm -rf Subsurface.app
|
|
|
|
rm -rf Subsurface-mobile.app
|
|
|
|
fi
|
2015-06-02 17:43:13 +00:00
|
|
|
|
2016-01-17 18:44:00 +00:00
|
|
|
LIBRARY_PATH=$INSTALL_ROOT/lib make -j4
|
2017-11-05 15:05:08 +00:00
|
|
|
LIBRARY_PATH=$INSTALL_ROOT/lib make install
|
2017-11-05 19:55:52 +00:00
|
|
|
|
|
|
|
if [ "$CREATE_APPDIR" = "1" ] ; then
|
|
|
|
# if we create an AppImage this makes gives us a sane starting point
|
|
|
|
cd $SRC
|
|
|
|
mkdir -p ./appdir
|
|
|
|
mkdir -p appdir/usr/share/metainfo
|
|
|
|
mkdir -p appdir/usr/share/icons/hicolor/256x256/apps
|
|
|
|
cp -r ./install-root/* ./appdir/usr
|
|
|
|
cp subsurface/appdata/subsurface.appdata.xml appdir/usr/share/metainfo/
|
|
|
|
cp subsurface/icons/subsurface-icon.png appdir/usr/share/icons/hicolor/256x256/apps/
|
|
|
|
fi
|
2016-01-17 18:44:00 +00:00
|
|
|
done
|