summaryrefslogtreecommitdiff
path: root/ios/build_libs.sh
blob: 8095571f649b500a1355a09c6f326fde25d71ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

# Call this script from a "Run Script" target in the Xcode project to
# cross compile MuPDF and third party libraries using the regular Makefile.
# Also see "iOS" section in Makerules.

echo Generating cmap and font files
make -C .. generate || exit 1

export OS=ios
export build=$(echo $CONFIGURATION | tr A-Z a-z)

case $ARCHS in
	armv6) ARCHFLAGS="-arch armv6 -mno-thumb" ;;
	armv7) ARCHFLAGS="-arch armv7 -mthumb" ;;
	i386) ARCHFLAGS="-arch i386" ;;
	*) echo "Unknown architecture!"; exit 1 ;;
esac

export CFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
export LDFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
export OUT=build/$build-$OS-$ARCHS

echo Building libraries for $ARCHS.
make -C .. libs || exit 1

echo Copying files into $BUILT_PRODUCTS_DIR.

mkdir -p "$BUILT_PRODUCTS_DIR"
cp ../$OUT/lib*.a $BUILT_PRODUCTS_DIR

echo Done.