build-system/iOS: no longer build in packaging/ios

That always was such a weird choice.
This also adjusts to a minor change in the layout of libgit2 sources.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-11-18 19:19:08 -08:00
parent e73a82cd70
commit 648402506f

View file

@ -39,10 +39,10 @@ while [[ $# -gt 0 ]] ; do
done done
# set up easy to use variables with the important paths # set up easy to use variables with the important paths
TOP=$(pwd) pushd "$(dirname "$0")/../../"
SUBSURFACE_SOURCE=${TOP}/../../../subsurface export SUBSURFACE_SOURCE=$PWD
pushd "$SUBSURFACE_SOURCE"/.. cd ..
PARENT_DIR=$(pwd) export PARENT_DIR=$PWD
popd popd
# prepare build dir # prepare build dir
@ -57,9 +57,9 @@ if [ -z $QT_VERSION ] ; then
fi fi
# set up the Subsurface versions by hand # set up the Subsurface versions by hand
GITVERSION=$(git describe --abbrev=12) GITVERSION=$(cd "$SUBSURFACE_SOURCE" ; git describe --abbrev=12)
CANONICALVERSION=$(git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./') CANONICALVERSION=$(echo $GITVERSION | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./')
MOBILEVERSION=$(grep MOBILE ../../cmake/Modules/version.cmake | cut -d\" -f 2) MOBILEVERSION=$(grep MOBILE "$SUBSURFACE_SOURCE"/cmake/Modules/version.cmake | cut -d\" -f 2)
echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > ssrf-version.h
echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> ssrf-version.h echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> ssrf-version.h
echo "#define MOBILE_VERSION_STRING \"$MOBILEVERSION\"" >> 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} BUNDLE=${IOS_BUNDLE_PRODUCT_IDENTIFIER}
fi fi
pushd "$SUBSURFACE_SOURCE"/packaging/ios
# create Info.plist with the correct versions # 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 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 if [ "$versionOnly" = "1" ] ; then
exit 0 exit 0
fi fi
@ -87,7 +89,7 @@ popd
# now build all the dependencies for the three relevant architectures (x86_64 is for the simulator) # now build all the dependencies for the three relevant architectures (x86_64 is for the simulator)
# get all 3rd part libraries # 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 for ARCH in $ARCHS; do
@ -102,12 +104,12 @@ for ARCH in $ARCHS; do
if [ "$ARCH" = "x86_64" ] ; then if [ "$ARCH" = "x86_64" ] ; then
declare -x SDK_NAME="iphonesimulator" 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 IOS_PLATFORM=SIMULATOR64
declare -x BUILDCHAIN=x86_64-apple-darwin declare -x BUILDCHAIN=x86_64-apple-darwin
else else
declare -x SDK_NAME="iphoneos" 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 IOS_PLATFORM=OS
declare -x BUILDCHAIN=arm-apple-darwin declare -x BUILDCHAIN=arm-apple-darwin
fi fi
@ -209,7 +211,7 @@ for ARCH in $ARCHS; do
-DCURL=OFF \ -DCURL=OFF \
-DUSE_SSH=OFF \ -DUSE_SSH=OFF \
"$PARENT_DIR"/libgit2/ "$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
make install make install
# Patch away pkg-config dependency to zlib, its there, i promise # Patch away pkg-config dependency to zlib, its there, i promise
@ -218,14 +220,14 @@ for ARCH in $ARCHS; do
fi fi
# build libdivecomputer # build libdivecomputer
if [ ! -d ../../libdivecomputer/src ] ; then if [ ! -d "$SUBSURFACE_SOURCE"/libdivecomputer/src ] ; then
pushd ../.. pushd "$SUBSURFACE_SOURCE"
git submodule init git submodule init
git submodule update --recursive git submodule update --recursive
popd popd
fi fi
if [ ! -f ../../libdivecomputer/configure ] ; then if [ ! -f "$SUBSURFACE_SOURCE"/libdivecomputer/configure ] ; then
pushd ../../libdivecomputer pushd "$SUBSURFACE_SOURCE"/libdivecomputer
autoreconf --install autoreconf --install
autoreconf --install autoreconf --install
popd popd
@ -234,7 +236,7 @@ for ARCH in $ARCHS; do
if [ ! -f "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA ] ; then if [ ! -f "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA ] ; then
echo "" > "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA echo "" > "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA
fi 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) PREVIOUS_SHA=$(cat "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA)
if [ ! "$CURRENT_SHA" = "$PREVIOUS_SHA" ] ; then if [ ! "$CURRENT_SHA" = "$PREVIOUS_SHA" ] ; then
echo $CURRENT_SHA > "$PARENT_DIR"/libdivecomputer-build-$ARCH/git.SHA 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" BUILDX=build-Subsurface-mobile-Qt_$(echo "$QT_VERSION" | tr . _)_for_iOS-"$BUILD_NOW"
mkdir -p "$BUILDX" mkdir -p "$BUILDX"
pushd "$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 -spec macx-ios-clang CONFIG+=$TARGET CONFIG+=$TARGET2 CONFIG+=$DRCONFIG
make make