mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
iOS build: restructure build.sh to create fat libraries
This way QtCreator can successfully link and deploy the app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7ae4eed734
commit
ba8014eb5c
1 changed files with 267 additions and 266 deletions
|
@ -1,56 +1,64 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# show what you are doing and stop when things break
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# set up easy to use variables with the important paths
|
||||
TOP=$(pwd)
|
||||
|
||||
if [ "$1" = "device" ] ; then
|
||||
DEVICE=1
|
||||
INSTALL_ROOT=$TOP/install-root-device
|
||||
shift
|
||||
else
|
||||
DEVICE=0
|
||||
INSTALL_ROOT=$TOP/install-root-simulator
|
||||
fi
|
||||
|
||||
SUBSURFACE_SOURCE=${TOP}/../../../subsurface
|
||||
IOS_QT=${TOP}/Qt
|
||||
|
||||
# Build Subsurface-mobile by default
|
||||
SUBSURFACE_MOBILE=1
|
||||
# Which versions are we building against?
|
||||
SQLITE_VERSION=3090200
|
||||
LIBXML2_VERSION=2.9.2
|
||||
LIBXSLT_VERSION=1.1.28
|
||||
LIBZIP_VERSION=0.11.2
|
||||
LIBGIT2_VERSION=0.23.4
|
||||
LIBSSH2_VERSION=1.6.0
|
||||
OPENSSL_VERSION=1.0.1p
|
||||
|
||||
# set up the versions by hand
|
||||
# not on iOS so far, but kept here for completeness
|
||||
LIBUSB_VERSION=1.0.19
|
||||
LIBFTDI_VERSION=1.2
|
||||
|
||||
# set up the Subsurface versions by hand
|
||||
GITVERSION=$(git describe --tags --abbrev=12)
|
||||
CANONICALVERSION=$(git describe --tags --abbrev=12 | sed -e 's/-g.*$// ; s/^v//' | sed -e 's/-/./')
|
||||
MOBILEVERSION=$(grep MOBILE ../../cmake/Modules/version.cmake | cut -d\" -f 2)
|
||||
|
||||
echo $GITVERSION
|
||||
echo $CANONICALVERSION
|
||||
echo $MOBILEVERSION
|
||||
echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > subsurface-ios/ssrf-version.h
|
||||
echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> subsurface-ios/ssrf-version.h
|
||||
echo "#define MOBILE_VERSION_STRING \"$MOBILEVERSION\"" >> subsurface-ios/ssrf-version.h
|
||||
|
||||
# Build Subsurface-mobile by default
|
||||
SUBSURFACE_MOBILE=1
|
||||
|
||||
|
||||
# now build all the dependencies for the three relevant architectures (x86_64 is for the simulator)
|
||||
|
||||
for ARCH in armv7 arm64 x86_64; do
|
||||
|
||||
echo next building for $ARCH
|
||||
|
||||
INSTALL_ROOT=$TOP/install-root-$ARCH
|
||||
mkdir -p $INSTALL_ROOT/lib $INSTALL_ROOT/bin $INSTALL_ROOT/include
|
||||
PKG_CONFIG_LIBDIR=$INSTALL_ROOT/lib/pkgconfig
|
||||
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR
|
||||
declare -x PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR
|
||||
declare -x PREFIX=$INSTALL_ROOT
|
||||
|
||||
# set up toolchain, architecture and SDK
|
||||
# Build architecture, [armv7|armv7s|arm64|i386|x86_64]
|
||||
if [ "$DEVICE" = "0" ] ; then
|
||||
if [ "$ARCH" = "x86_64" ] ; then
|
||||
declare -x SDK_NAME="iphonesimulator"
|
||||
declare -x TOOLCHAIN_FILE="${TOP}/iPhoneSimulatorCMakeToolchain"
|
||||
declare -x ARCH_NAME="x86_64"
|
||||
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 ARCH_NAME="armv7"
|
||||
declare -x IOS_PLATFORM=OS
|
||||
declare -x BUILDCHAIN=arm-apple-darwin
|
||||
fi
|
||||
declare -x ARCH=$ARCH_NAME
|
||||
declare -x ARCH_NAME=$ARCH
|
||||
declare -x SDK=$SDK_NAME
|
||||
declare -x SDK_DIR=`xcrun --sdk $SDK_NAME --show-sdk-path`
|
||||
declare -x PLATFORM_DIR=`xcrun --sdk $SDK_NAME --show-sdk-platform-path`
|
||||
|
@ -61,7 +69,6 @@ declare -x LD=`xcrun -sdk $SDK_NAME -find ld`
|
|||
declare -x CFLAGS="-arch $ARCH_NAME -isysroot $SDK_DIR -miphoneos-version-min=6.0 -I$SDK_DIR/usr/include"
|
||||
declare -x CXXFLAGS="$CFLAGS"
|
||||
declare -x LDFLAGS="$CFLAGS -lpthread -lc++ -L$SDK_DIR/usr/lib"
|
||||
export BUILDCHAIN=${ARCH_NAME}-apple-darwin
|
||||
|
||||
|
||||
# openssl build stuff.
|
||||
|
@ -77,18 +84,6 @@ export OSX_DEPLOYMENT_VERSION="10.8"
|
|||
export OSX_PLATFORM=$(xcrun --sdk macosx --show-sdk-platform-path)
|
||||
export OSX_SDK=$(xcrun --sdk macosx --show-sdk-path)
|
||||
|
||||
# Which versions are we building against?
|
||||
SQLITE_VERSION=3090200
|
||||
LIBXML2_VERSION=2.9.2
|
||||
LIBXSLT_VERSION=1.1.28
|
||||
LIBZIP_VERSION=1.0.1
|
||||
LIBZIP_VERSION=0.11.2
|
||||
LIBGIT2_VERSION=0.23.4
|
||||
LIBSSH2_VERSION=1.6.0
|
||||
LIBUSB_VERSION=1.0.19
|
||||
OPENSSL_VERSION=1.0.1p
|
||||
LIBFTDI_VERSION=1.2
|
||||
|
||||
target=$ARCH
|
||||
hosttarget=$ARCH
|
||||
|
||||
|
@ -353,5 +348,11 @@ if [ ! -e $PKG_CONFIG_LIBDIR/libdivecomputer.pc ] ; then
|
|||
make install
|
||||
popd
|
||||
fi
|
||||
done
|
||||
|
||||
# Should we build the mobile ui or the desktop ui?
|
||||
# now combine the arm libraries into fat libraries
|
||||
cp -a install-root-arm64 install-root
|
||||
cd install-root/lib
|
||||
for LIB in $(find . -type f -name \*.a); do
|
||||
lipo ../../install-root-armv7/lib/$LIB ../../install-root-arm64/lib/$LIB -create -output $LIB
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue