diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 116 |
1 files changed, 77 insertions, 39 deletions
diff --git a/scripts/build.sh b/scripts/build.sh index 1316b4778..7701b9c60 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -19,6 +19,9 @@ # create a log file of the build exec 1> >(tee build.log) 2>&1 +SRC=$(pwd) +PLATFORM=$(uname) + # 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 if [ "$1" == "-build-deps" ] ; then @@ -26,8 +29,16 @@ if [ "$1" == "-build-deps" ] ; then BUILD_DEPS="1" fi -SRC=$(pwd) -PLATFORM=$(uname) +# 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) +if [ "$1" == "-build-with-webkit" ] ; then + shift + BUILD_WITH_WEBKIT="1" +fi +if [ $PLATFORM = Linux ] ; then + BUILD_WITH_WEBKIT="1" +fi # most of these will only be needed with -build-deps on a Mac CURRENT_LIBZIP="1.2.0" @@ -40,8 +51,18 @@ CURRENT_LIBGIT2="v0.26.0" # Verify that the Xcode Command Line Tools are installed if [ $PLATFORM = Darwin ] ; then - OLDER_MAC="-mmacosx-version-min=10.10 -isysroot/Developer/SDKs/MacOSX10.10.sdk" - OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.10.sdk/" + 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//") + OLDER_MAC="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" + OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" if [ ! -d /usr/include ] ; then echo "Error: Xcode Command Line Tools are not installed" echo "" @@ -66,15 +87,19 @@ elif [ "$1" = "-both" ] ; then echo "building both Subsurface and Subsurface-mobile in subsurface/build and subsurface/build-mobile, respectively" BUILDS=( "DesktopExecutable" "MobileExecutable" ) BUILDDIRS=( "build" "build-mobile" ) - BUILDGRANTLEE=1 - BUILDMARBLE=1 + if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then + BUILDGRANTLEE=1 + BUILDMARBLE=1 + fi shift else echo "building Subsurface in subsurface/build" BUILDS=( "DesktopExecutable" ) BUILDDIRS=( "build" ) - BUILDGRANTLEE=1 - BUILDMARBLE=1 + if [ "$BUILD_WITH_WEBKIT" = "1" ] ; then + BUILDGRANTLEE=1 + BUILDMARBLE=1 + fi fi if [[ ! -d "subsurface" ]] ; then @@ -201,6 +226,12 @@ if [[ $PLATFORM = Darwin || "$LIBGIT" < "24" ]] ; then cmake $OLDER_MAC_CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF .. make -j4 make install + 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 " @@ -266,15 +297,46 @@ if [ ! -f ../configure ] ; then autoreconf --install .. autoreconf --install .. fi -CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include" ../configure --prefix=$INSTALL_ROOT --disable-examples +CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" ../configure --prefix=$INSTALL_ROOT --disable-examples make -j4 make install +if [ $PLATFORM = Darwin ] ; then + if [ -z "$CMAKE_PREFIX_PATH" ] ; then + # qmake in PATH? + libdir=`qmake -query QT_INSTALL_LIBS` + 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 + cd $SRC # build libssrfmarblewidget if [ $BUILDMARBLE = 1 ]; then + MARBLE_OPTS="-DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \ + -DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \ + -DNO_MARBLE=OFF -DNO_USERMANUAL=OFF -DFBSUPPORT=ON" if [ ! -d marble-source ] ; then if [[ $1 = local ]] ; then git clone $SRC/../marble-source marble-source @@ -290,33 +352,6 @@ if [ $BUILDMARBLE = 1 ]; then fi mkdir -p build cd build - if [ $PLATFORM = Darwin ] ; then - if [ -z "$CMAKE_PREFIX_PATH" ] ; then - # qmake in PATH? - libdir=`qmake -query QT_INSTALL_LIBS` - 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 cmake $OLDER_MAC_CMAKE -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DQT5BUILD=ON \ -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT \ @@ -337,10 +372,13 @@ if [ $BUILDMARBLE = 1 ]; then install_name_tool -id "$INSTALL_ROOT/lib/$NAME" "$INSTALL_ROOT/lib/$NAME" fi fi +else + MARBLE_OPTS="-DNO_MARBLE=ON -DNO_USERMANUAL=ON -DFBSUPPORT=OFF" fi if [ "$BUILDGRANTLEE" = "1" ] ; then # build grantlee + PRINTING="-DNO_PRINTING=OFF" cd $SRC @@ -364,6 +402,8 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then $SRC/grantlee make -j4 make install +else + PRINTING="-DNO_PRINTING=ON" fi @@ -391,10 +431,8 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do ${LIBGIT_ARGS} \ -DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \ -DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \ - -DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \ - -DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \ -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \ - -DNO_PRINTING=OFF + $PRINTING $MARBLE_OPTS if [ $PLATFORM = Darwin ] ; then rm -rf Subsurface.app |