summaryrefslogtreecommitdiff
path: root/ios/build_libs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ios/build_libs.sh')
-rw-r--r--ios/build_libs.sh47
1 files changed, 37 insertions, 10 deletions
diff --git a/ios/build_libs.sh b/ios/build_libs.sh
index 0a7f74f0..ded12ec7 100644
--- a/ios/build_libs.sh
+++ b/ios/build_libs.sh
@@ -1,17 +1,44 @@
-#!/bin/sh
+#!/bin/bash
# Call this script from a "Run Script" target in the Xcode project to
-# set up the environment and use the regular makefile to cross compile
-# MuPDF and third party libraries.
+# cross compile MuPDF and third party libraries using the regular Makefile.
+# Also see "iOS" section in Makerules.
-# Ensure we have all the generated cmap and font files from a
-# regular build.
-make -C .. generate
+echo Generating cmap and font files
+make -C .. generate || exit 1
+
+export OS=ios
+export build=$(echo $BUILD_STYLE | tr A-Z a-z)
+
+for ARCH in $ARCHS
+do
+ case $ARCH in
+ armv6) ARCHFLAGS="-arch armv6 -mno-thumb" ;;
+ armv7) ARCHFLAGS="-arch armv7 -mthumb" ;;
+ *) ARCHFLAGS="-arch $ARCH" ;;
+ esac
+
+ export CFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
+ export LDFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
+ export OUT=build/$build-$OS-$ARCH
+
+ echo Building libraries for $ARCH.
+ make -C .. libs || exit 1
+done
+
+echo Performing liposuction
-OS=$(basename $PLATFORM_DIR | sed s/\.platform// | tr A-Z a-z)
-build=$(echo $BUILD_STYLE | tr A-Z a-z)
-make -C .. CROSSCOMPILE=yes libs || exit 1
mkdir -p "$BUILT_PRODUCTS_DIR"
-cp ../build/$build-$OS/lib*.a "$BUILT_PRODUCTS_DIR"
+
+for LIB in ../$OUT/lib*.a
+do
+ LIB=$(basename $LIB)
+ IN=""
+ for ARCH in $ARCHS
+ do
+ IN="$IN ../build/$build-$OS-$ARCH/$LIB"
+ done
+ lipo $IN -output $BUILT_PRODUCTS_DIR/$LIB -create
+done
echo Done.