summaryrefslogtreecommitdiffstats
path: root/packaging/ios/build.sh
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2015-12-20 12:32:55 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-20 08:07:11 -0800
commit2316390c1f3d2d89798c599b42bf99873e4b7651 (patch)
tree64980ed7302910d75cf1c491736a1e99ac26459f /packaging/ios/build.sh
parent105d6987595b144fbd17093157a1a059fed6afaa (diff)
downloadsubsurface-2316390c1f3d2d89798c599b42bf99873e4b7651.tar.gz
Rework the env - variables to produce a working cross compile script
The cross compile script kind of works right now, it's missing something that I'm really not sure where or what it is. currently sqlite will not build because: error: gethostuuid is not defined in iOS This bug was already opened on sqlite bugtracker for about a year, the workaround is to pass -DDSQLITE_ENABLE_LOCKING_STYLE=0 to the compilation flags, which I did but did not work for some reason. Which is a good error - it shows us that we are actually trying to compile for iOS. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'packaging/ios/build.sh')
-rw-r--r--packaging/ios/build.sh49
1 files changed, 32 insertions, 17 deletions
diff --git a/packaging/ios/build.sh b/packaging/ios/build.sh
index c0bd52df3..1e18fef81 100644
--- a/packaging/ios/build.sh
+++ b/packaging/ios/build.sh
@@ -1,13 +1,36 @@
#!/bin/bash
set -e
-PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
-TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
-export IPHONEOS_DEPLOYMENT_TARGET="8.0"
-pwd=`pwd`
+# Build architecture, [armv7|armv7s|arm64|i386|x86_64]
+export ARCH=i386
+
+#arm-apple-darwin, arch64-apple-darwin, i386-apple-darwin*, x86_64-apple-darwin*
+export CHOST=i386-apple-darwin*
+
+#iphonesimulator or iphoneos
+export SDK=iphonesimulator
+
+export SDKVERSION=$(xcrun --sdk $SDK --show-sdk-version) # current version
+export SDKROOT=$(xcrun --sdk $SDK --show-sdk-path) # current version
+
+#make subsurface set this to a saner value
+export PREFIX=/usr
+
+# Binaries
+export CC=$(xcrun --sdk $SDK --find gcc)
+export CPP=$(xcrun --sdk $SDK --find gcc)" -E"
+export CXX=$(xcrun --sdk $SDK --find g++)
+export LD=$(xcrun --sdk $SDK --find ld)
+
+# Flags
+export CFLAGS="$CFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include -miphoneos-version-min=$SDKVERSION"
+export CPPFLAGS="$CPPFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include -miphoneos-version-min=$SDKVERSION"
+export CXXFLAGS="$CXXFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include"
+export LDFLAGS="$LDFLAGS -arch $ARCH -isysroot $SDKROOT -L$PREFIX/lib"
+export PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$SDKROOT/usr/lib/pkgconfig":"$PREFIX/lib/pkgconfig"
# Which versions are we building against?
-SQLITE_VERSION=3081002
+SQLITE_VERSION=3090200
LIBXML2_VERSION=2.9.3
LIBXSLT_VERSION=1.1.28
LIBZIP_VERSION=1.0.1
@@ -22,17 +45,6 @@ target=i386
hosttarget=i386
platform=iPhoneSimulator
-export CC="$(xcrun -sdk iphoneos -find clang)"
-export CPP="$CC -E"
-export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
-export AR=$(xcrun -sdk iphoneos -find ar)
-export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
-export CPPFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
-export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk"
-
-echo "BUILDCHAIN: ${BUILDCHAIN}"
-echo "ARCH: ${ARCH}"
-echo "PREFIX:${PREFIX}"
if [ ! -e sqlite-autoconf-${SQLITE_VERSION}.tar.gz ] ; then
curl -O http://www.sqlite.org/2015/sqlite-autoconf-${SQLITE_VERSION}.tar.gz
@@ -43,8 +55,11 @@ fi
if [ ! -e $PKG_CONFIG_LIBDIR/sqlite3.pc ] ; then
mkdir -p sqlite-build-$platform
pushd sqlite-build-$platform
+ CFLAGS="${CFLAGS} -DDSQLITE_ENABLE_LOCKING_STYLE=0"
+
../sqlite-autoconf-${SQLITE_VERSION}/configure \
- --host=$hosttarget-apple-darwin
+ --prefix="$PREFIX" \
+ --host="$CHOST" \
--enable-static \
--disable-shared
make