The tools in this section are based on iOS4, the SDK being the iPhoneOS4.2 SDK. We use OSX, potentially running under a Virtual Machine.
The cross-compile script used to create bundles for iOS is the following:
#!/bin/sh export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer export SDKROOT=$DEVROOT/SDKs/iPhoneOS4.2.sdk export CC=$DEVROOT/usr/bin/gcc export LD=$DEVROOT/usr/bin/ld export CPP=$DEVROOT/usr/bin/cpp export CXX=$DEVROOT/usr/bin/g++ export AR=$DEVROOT/usr/bin/ar export AS=$DEVROOT/usr/bin/as export NM=$DEVROOT/usr/bin/nm export CXXCPP=$DEVROOT/usr/bin/cpp export RANLIB=$DEVROOT/usr/bin/ranlib export LDFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -L$SDKROOT/usr/lib -L/Users/cross/Development/iOS/usr/lib" export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -isysroot $SDKROOT -I$SDKROOT/usr/include -I/Users/cross/Development/iOS/include" export CXXFLAGS="-arch armv6 -pipe -no-cpp-precomp -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -isysroot $SDKROOT -I$SDKROOT/usr/include -I/Users/cross/Development/iOS/include/" export PKG_CONFIG_PATH=/Users/cross/Development/iOS/usr/lib/:$PKG_CONFIG_PATH export PATH=$DEVROOT/usr/bin:/Users/cross/Development/iOS/usr/bin:$PATH
where cross
is the OSX user and the path to the development directory is /Users/cross/Development/iOS
.
Using automake
and autoconf
build systems, we always cross-compile to the ARM platform by using the –host=arm-apple-darwin9
. As an example, for compiling APC (as we did on apc) we use the following additions to the compile script above:
./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --host=arm-apple-darwin9 \ --with-php-config=/Users/frank/Development/iOS/usr/bin/php-config \ --with-libdir=/Users/frank/Development/iOS/usr/lib \ --disable-apc-pthreadmutex \ --disable-apc-pthreadrwlocks \ --enable-apc-spinlocks