2011-12-01 17:41:27 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-10-13 18:01:33 +02:00
|
|
|
if [ "X$VERBOSE" == "X1" ]; then
|
2012-10-13 17:59:34 +02:00
|
|
|
set -x
|
|
|
|
fi
|
2012-02-22 18:21:47 +01:00
|
|
|
|
2011-12-01 17:41:27 +01:00
|
|
|
try () {
|
|
|
|
"$@" || exit -1
|
|
|
|
}
|
|
|
|
|
2013-02-11 21:33:52 +01:00
|
|
|
# iOS SDK Environmnent (don't use name "SDKROOT"!!! it will break the compilation)
|
2012-04-17 21:49:42 +02:00
|
|
|
export SDKVER=`xcodebuild -showsdks | fgrep "iphoneos" | tail -n 1 | awk '{print $2}'`
|
|
|
|
export DEVROOT=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer
|
2013-02-11 21:33:52 +01:00
|
|
|
export IOSSDKROOT=$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk
|
2011-12-01 17:41:27 +01:00
|
|
|
|
2012-05-04 01:09:41 +02:00
|
|
|
if [ ! -d $DEVROOT ]; then
|
|
|
|
echo "Unable to found the Xcode iPhoneOS.platform"
|
|
|
|
echo
|
|
|
|
echo "The path is automatically set from 'xcode-select -print-path'"
|
|
|
|
echo " + /Platforms/iPhoneOS.platform/Developer"
|
|
|
|
echo
|
|
|
|
echo "Ensure 'xcode-select -print-path' is set."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-12-06 10:49:14 +01:00
|
|
|
# version of packages
|
2011-12-06 11:42:37 +01:00
|
|
|
export PYTHON_VERSION=2.7.1
|
|
|
|
export SDLTTF_VERSION=2.0.10
|
|
|
|
export FT_VERSION=2.4.8
|
2012-03-11 17:23:15 +01:00
|
|
|
export XML2_VERSION=2.7.8
|
|
|
|
export XSLT_VERSION=1.1.26
|
|
|
|
export LXML_VERSION=2.3.1
|
2011-12-06 10:49:14 +01:00
|
|
|
|
2011-12-01 17:41:27 +01:00
|
|
|
# where the build will be located
|
2012-03-08 18:05:47 +01:00
|
|
|
export KIVYIOSROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
|
2011-12-06 11:42:37 +01:00
|
|
|
export BUILDROOT="$KIVYIOSROOT/build"
|
2012-03-08 20:45:55 +01:00
|
|
|
export TMPROOT="$KIVYIOSROOT/tmp"
|
2012-11-21 00:12:42 +01:00
|
|
|
export DESTROOT="$KIVYIOSROOT/tmp/root"
|
2011-12-06 11:42:37 +01:00
|
|
|
export CACHEROOT="$KIVYIOSROOT/.cache"
|
2011-12-01 17:41:27 +01:00
|
|
|
|
2012-07-21 16:54:24 +02:00
|
|
|
# pkg-config for SDL and futures
|
|
|
|
try mkdir -p $BUILDROOT/pkgconfig
|
|
|
|
export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
|
2011-12-06 10:49:14 +01:00
|
|
|
# some tools
|
2011-12-06 11:42:37 +01:00
|
|
|
export CCACHE=$(which ccache)
|
2011-12-06 10:49:14 +01:00
|
|
|
|
2011-12-06 12:08:47 +01:00
|
|
|
# flags for arm compilation
|
|
|
|
export ARM_CC="$CCACHE $DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
|
|
|
|
export ARM_AR="$DEVROOT/usr/bin/ar"
|
|
|
|
export ARM_LD="$DEVROOT/usr/bin/ld"
|
|
|
|
export ARM_CFLAGS="-march=armv7 -mcpu=arm176jzf -mcpu=cortex-a8"
|
|
|
|
export ARM_CFLAGS="$ARM_CFLAGS -pipe -no-cpp-precomp"
|
2013-02-11 21:33:52 +01:00
|
|
|
export ARM_CFLAGS="$ARM_CFLAGS -isysroot $IOSSDKROOT"
|
2011-12-06 12:08:47 +01:00
|
|
|
export ARM_CFLAGS="$ARM_CFLAGS -miphoneos-version-min=$SDKVER"
|
2013-02-11 21:33:52 +01:00
|
|
|
export ARM_LDFLAGS="-isysroot $IOSSDKROOT"
|
2011-12-06 12:08:47 +01:00
|
|
|
export ARM_LDFLAGS="$ARM_LDFLAGS -miphoneos-version-min=$SDKVER"
|
|
|
|
|
2012-02-25 15:51:34 +01:00
|
|
|
# uncomment this line if you want debugging stuff
|
|
|
|
export ARM_CFLAGS="$ARM_CFLAGS -O3"
|
|
|
|
#export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
|
2011-12-06 12:08:47 +01:00
|
|
|
|
2011-12-01 17:41:27 +01:00
|
|
|
# create build directory if not found
|
2011-12-06 12:08:47 +01:00
|
|
|
try mkdir -p $BUILDROOT
|
|
|
|
try mkdir -p $BUILDROOT/include
|
|
|
|
try mkdir -p $BUILDROOT/lib
|
|
|
|
try mkdir -p $CACHEROOT
|
2012-03-08 20:45:55 +01:00
|
|
|
try mkdir -p $TMPROOT
|
2012-11-21 00:12:42 +01:00
|
|
|
try mkdir -p $DESTROOT
|
2011-12-06 15:32:31 +01:00
|
|
|
|
|
|
|
# one method to deduplicate some symbol in libraries
|
|
|
|
function deduplicate() {
|
|
|
|
fn=$(basename $1)
|
|
|
|
echo "== Trying to remove duplicate symbol in $1"
|
|
|
|
try mkdir ddp
|
|
|
|
try cd ddp
|
|
|
|
try ar x $1
|
|
|
|
try ar rc $fn *.o
|
|
|
|
try ranlib $fn
|
|
|
|
try mv -f $fn $1
|
|
|
|
try cd ..
|
|
|
|
try rm -rf ddp
|
|
|
|
}
|