diff options
-rwxr-xr-x | packaging/ios/build.sh | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/packaging/ios/build.sh b/packaging/ios/build.sh index 658e117e6..55e5e8aac 100755 --- a/packaging/ios/build.sh +++ b/packaging/ios/build.sh @@ -39,10 +39,10 @@ while [[ $# -gt 0 ]] ; do done # set up easy to use variables with the important paths -TOP=$(pwd) -SUBSURFACE_SOURCE=${TOP}/../../../subsurface -pushd "$SUBSURFACE_SOURCE"/.. -PARENT_DIR=$(pwd) +pushd "$(dirname "$0")/../../" +export SUBSURFACE_SOURCE=$PWD +cd .. +export PARENT_DIR=$PWD popd # prepare build dir @@ -57,9 +57,9 @@ if [ -z $QT_VERSION ] ; then fi # set up the Subsurface versions by hand -GITVERSION=$(git describe --abbrev=12) -CANONICALVERSION=$(git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./') -MOBILEVERSION=$(grep MOBILE ../../cmake/Modules/version.cmake | cut -d\" -f 2) +GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --abbrev=12) +CANONICALVERSION=$(echo $GITVERSION | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./') +MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2) echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> ssrf-version.h echo "#define MOBILE_VERSION_STRING \"$MOBILEVERSION\"" >> ssrf-version.h @@ -69,9 +69,11 @@ if [ "${IOS_BUNDLE_PRODUCT_IDENTIFIER}" != "" ] ; then BUNDLE=${IOS_BUNDLE_PRODUCT_IDENTIFIER} fi +pushd "$SUBSURFACE_SOURCE"/packaging/ios # create Info.plist with the correct versions cat Info.plist.in | sed "s/@MOBILE_VERSION@/$MOBILEVERSION/;s/@CANONICAL_VERSION@/$CANONICALVERSION/;s/@PRODUCT_BUNDLE_IDENTIFIER@/$BUNDLE/" > Info.plist +popd if [ "$versionOnly" = "1" ] ; then exit 0 fi @@ -87,7 +89,7 @@ popd # now build all the dependencies for the three relevant architectures (x86_64 is for the simulator) # get all 3rd part libraries -../../scripts/get-dep-lib.sh ios "$PARENT_DIR" +"$SUBSURFACE_SOURCE"/scripts/get-dep-lib.sh ios "$PARENT_DIR" for ARCH in $ARCHS; do @@ -102,12 +104,12 @@ for ARCH in $ARCHS; do if [ "$ARCH" = "x86_64" ] ; then declare -x SDK_NAME="iphonesimulator" - declare -x TOOLCHAIN_FILE="${TOP}/iPhoneSimulatorCMakeToolchain" + declare -x TOOLCHAIN_FILE="$SUBSURFACE_SOURCE/packaging/ios/iPhoneSimulatorCMakeToolchain" declare -x IOS_PLATFORM=SIMULATOR64 declare -x BUILDCHAIN=x86_64-apple-darwin else declare -x SDK_NAME="iphoneos" - declare -x TOOLCHAIN_FILE="${TOP}/iPhoneDeviceCMakeToolchain" + declare -x TOOLCHAIN_FILE="$SUBSURFACE_SOURCE/packaging/ios/iPhoneDeviceCMakeToolchain" declare -x IOS_PLATFORM=OS declare -x BUILDCHAIN=arm-apple-darwin fi @@ -209,7 +211,7 @@ for ARCH in $ARCHS; do -DCURL=OFF \ -DUSE_SSH=OFF \ "$PARENT_DIR"/libgit2/ - sed -i.bak 's/C_FLAGS = /C_FLAGS = -Wno-nullability-completeness -Wno-expansion-to-defined /' CMakeFiles/git2.dir/flags.make + sed -i.bak 's/C_FLAGS = /C_FLAGS = -Wno-nullability-completeness -Wno-expansion-to-defined /' src/CMakeFiles/git2.dir/flags.make make make install # Patch away pkg-config dependency to zlib, its there, i promise @@ -218,14 +220,14 @@ for ARCH in $ARCHS; do fi # build libdivecomputer - if [ ! -d ../../libdivecomputer/src ] ; then - pushd ../.. + if [ ! -d "$SUBSURFACE_SOURCE"/libdivecomputer/src ] ; then + pushd "$SUBSURFACE_SOURCE" git submodule init git submodule update --recursive popd fi - if [ ! -f ../../libdivecomputer/configure ] ; then - pushd ../../libdivecomputer + if [ ! -f "$SUBSURFACE_SOURCE"/libdivecomputer/configure ] ; then + pushd "$SUBSURFACE_SOURCE"/libdivecomputer autoreconf --install autoreconf --install popd @@ -234,7 +236,7 @@ for ARCH in $ARCHS; do if [ ! -f "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA ] ; then echo "" > "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA fi - CURRENT_SHA=$(cd ../../libdivecomputer ; git describe) + CURRENT_SHA=$(cd "$SUBSURFACE_SOURCE"/libdivecomputer ; git describe) PREVIOUS_SHA=$(cat "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA) if [ ! "$CURRENT_SHA" = "$PREVIOUS_SHA" ] ; then echo $CURRENT_SHA > "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA @@ -296,7 +298,8 @@ for BUILD_NOW in $BUILD_LOOP; do BUILDX=build-Subsurface-mobile-Qt_$(echo "$QT_VERSION" | tr . _)_for_iOS-"$BUILD_NOW" mkdir -p "$BUILDX" pushd "$BUILDX" - "$IOS_QT"/"$QT_VERSION"/ios/bin/qmake ../Subsurface-mobile.pro \ + ln -s ../ssrf-version.h . + "$IOS_QT"/"$QT_VERSION"/ios/bin/qmake "$SUBSURFACE_SOURCE"/Subsurface-mobile.pro \ -spec macx-ios-clang CONFIG+=$TARGET CONFIG+=$TARGET2 CONFIG+=$DRCONFIG make |