summaryrefslogtreecommitdiff
path: root/ios/build_ios_gslib.sh
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2016-08-25 09:28:59 +0100
committerChris Liddell <chris.liddell@artifex.com>2018-01-26 08:29:13 +0000
commitb82848bc26f47b5b5727d24f03d08eb3679c7243 (patch)
treea4d45eb9b02f7c33e56162adacf0d96fb5f6922e /ios/build_ios_gslib.sh
parent83f78ff2c85413866f0d4e549fc6a39aa72417e6 (diff)
downloadghostpdl-b82848bc26f47b5b5727d24f03d08eb3679c7243.tar.gz
Add script and arch*.h headers for ios build
This results in a "fat" libgs.a library which can be linked used either for the simulator or a "real" ios build. Really, this script just automates/simplifies the process of using our existing cross-compile support. The only slightly out of the ordinary part is combining the Intel and arm libraries into the single fat library.
Diffstat (limited to 'ios/build_ios_gslib.sh')
-rwxr-xr-xios/build_ios_gslib.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/ios/build_ios_gslib.sh b/ios/build_ios_gslib.sh
new file mode 100755
index 000000000..9afa15651
--- /dev/null
+++ b/ios/build_ios_gslib.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+
+if [ $# -gt 1 ]; then
+ echo "Usage: build_ios_gslib.sh [debug]"
+ exit
+fi
+
+if [ $# -eq 1 ]; then
+ if test x"$1" = x"debug"; then
+ DEBUGSTR=debug
+ fi
+fi
+
+startdir="$PWD"
+
+cd ..
+
+if [ ! -x ./configure ] ; then
+ ./autogen.sh --help
+fi
+
+export CC="$(xcrun --sdk iphonesimulator --find cc)"
+export CPP="$(xcrun --sdk iphonesimulator --find cpp)"
+export RANLIB="$(xcrun --sdk iphonesimulator --find ranlib)"
+export CFLAGS=" -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -Wno-implicit-function-declaration -arch x86_64 -arch i386"
+
+export BIGENDIAN=0
+export CCAUX=/usr/bin/gcc
+export CFLAGSAUX=" "
+
+./configure --without-x --with-arch_h=./ios/ios_arch-x86.h --host=x86_64-apple-darwin7 --build=x86_64-linux-gnu 2>&1 | tee conflog_x86.txt || exit 1
+
+make -j4 BUILDDIRPREFIX=ios_x86- GS=libgs_x86 libgs$DEBUGSTR 2>&1 | tee buildlog_x86.txt || exit 1
+
+mv Makefile Makefile.x86
+
+export CC="$(xcrun --sdk iphoneos --find cc)"
+export CPP="$(xcrun --sdk iphoneos --find cpp)"
+export CFLAGS=" -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -Wno-implicit-function-declaration -arch armv7 -arch armv7s -arch arm64"
+export RANLIB="$(xcrun --sdk iphoneos --find ranlib)"
+
+./configure --without-x --with-arch_h=./ios/ios_arch-arm.h --host=armv7-apple-darwin7 --build=x86_64-linux-gnu 2>&1 | tee conflog_arm.txt || exit 1
+
+make -j4 BUILDDIRPREFIX=ios_arm- GS=libgs_arm libgs$DEBUGSTR 2>&1 | tee buildlog_arm.txt || exit 1
+
+mv Makefile Makefile.arm
+
+cd $startdir
+
+export LIPO="$(xcrun --sdk iphoneos --find lipo)"
+
+xcrun lipo -output libgs.a -create ../ios_x86-"$DEBUGSTR"bin/libgs_x86.a ../ios_arm-"$DEBUGSTR"bin/libgs_arm.a 2>&1 | tee buildlog_uni.txt || exit 1
+