Created
June 25, 2014 02:29
-
-
Save wtlangford/32b47d5eb823dee2e15f to your computer and use it in GitHub Desktop.
libjq ios-compile.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# old values | |
OLD_CFLAGS=$CFLAGS | |
OLD_LDFLAGS=$LDFLAGS | |
# might fail. This is okay. | |
make distclean | |
rm -rf `pwd`/build/ios | |
autoreconf -i | |
CC=`xcrun -f clang` | |
for arch in i386 x86_64 armv7 armv7s arm64; do | |
if [[ "$arch" = "i386" || "$arch" = "x86_64" ]] | |
then | |
SYSROOT=`xcrun -f --sdk iphonesimulator --show-sdk-path` | |
else | |
SYSROOT=`xcrun -f --sdk iphoneos --show-sdk-path` | |
fi | |
if [[ "$arch" = "arm64" ]] | |
then | |
HOST="aarch64-apple-darwin" | |
else | |
HOST="$arch-apple-darwin" | |
fi | |
CFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_CFLAGS" | |
LDFLAGS="-arch $arch -miphoneos-version-min=6.0 -isysroot $SYSROOT $OLD_LDFLAGS" | |
make clean | |
CC=$CC CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS ./configure --disable-shared --enable-static -host=$HOST --prefix=`pwd`/build/ios/$arch | |
STATUS=$? | |
if [ $STATUS -ne 0 ] | |
then | |
echo "Failed to configure for architecture $arch" | |
exit $STATUS | |
fi | |
make install | |
STATUS=$? | |
if [ $STATUS -ne 0 ] | |
then | |
echo "Failed to make for architecture $arch" | |
exit $STATUS | |
fi | |
done | |
lipo -create -output `pwd`/build/ios/libjq.a `pwd`/build/ios/{i386,x86_64,armv7,armv7s,arm64}/lib/libjq.a | |
mkdir -p `pwd`/ios/ | |
cp `pwd`/build/ios/libjq.a `pwd`/build/ios/i386/include/*.h `pwd`/build/ios/ | |
rm -rf `pwd`/build/ios/{i386,x86_64,armv7,armv7s,arm64} | |
echo "Products are in `pwd`/build/ios" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment