Skip to content

Instantly share code, notes, and snippets.

@akitaonrails
Created April 19, 2011 16:37
Show Gist options
  • Save akitaonrails/928733 to your computer and use it in GitHub Desktop.
Save akitaonrails/928733 to your computer and use it in GitHub Desktop.
Build Oniguruma as a fat binary for iOS and the simulator
#!/bin/bash
# This script will compile a oniguruma static lib for the device and simulator
cd onig
# Compile a version for the device...
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar ./configure --disable-shared --host=arm-apple-darwin --disable-cpp CFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk"
make
mv .libs/libonig.a /tmp/libonig_device.a
# Compile a version for the simulator...
CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar ./configure --disable-shared --disable-cpp CFLAGS="-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk"
make
mv .libs/libonig.a /tmp/libonig_simulator.a
# Combine the two libs into one lib
lipo -create /tmp/libonig_simulator.a /tmp/libonig_device.a -output .libs/libonig.a
cp .libs/libonig.a YOU_PROJECT_DIR
cp onig.h YOU_PROJECT_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment