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)
|
2014-07-07 19:43:23 +02:00
|
|
|
|
2012-04-17 21:49:42 +02:00
|
|
|
export SDKVER=`xcodebuild -showsdks | fgrep "iphoneos" | tail -n 1 | awk '{print $2}'`
|
2014-07-07 19:43:23 +02:00
|
|
|
# will return the latest iphoneos version, here e.g. "7.1"
|
2012-04-17 21:49:42 +02:00
|
|
|
export DEVROOT=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer
|
2014-07-07 19:43:23 +02:00
|
|
|
# path relative to root, by default "/Applications/Xcode.app/Contents/Developer", and appends the path to the DEVROOT as seen
|
2013-02-11 21:33:52 +01:00
|
|
|
export IOSSDKROOT=$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk
|
2014-07-07 19:43:23 +02:00
|
|
|
# path to the wanted iOS SDK folder.. here in Xcode 5.1.1 the only dir in $DEVROOT/SDKs/
|
2011-12-01 17:41:27 +01:00
|
|
|
|
2013-04-11 23:09:12 +02:00
|
|
|
# Xcode doesn't include /usr/local/bin
|
|
|
|
export PATH="$PATH":/usr/local/bin
|
|
|
|
|
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
|
2013-02-28 19:21:58 +01:00
|
|
|
export IOS_PYTHON_VERSION=2.7.1
|
2011-12-06 11:42:37 +01:00
|
|
|
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
|
2013-08-22 19:14:21 +02:00
|
|
|
export FFI_VERSION=3.0.13
|
2014-11-24 02:50:02 +01:00
|
|
|
export NUMPY_VERSION=1.9.1
|
2011-12-06 10:49:14 +01:00
|
|
|
|
2011-12-01 17:41:27 +01:00
|
|
|
# where the build will be located
|
2013-02-11 21:44:48 +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"
|
2015-02-11 12:54:58 +01:00
|
|
|
export DISTROOT="$KIVYIOSROOT/dist"
|
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)
|
2015-02-11 12:54:58 +01:00
|
|
|
export HOSTPYTHON="$DISTROOT/hostpython/bin/python"
|
2013-02-28 19:07:05 +01:00
|
|
|
for fn in cython-2.7 cython; do
|
|
|
|
export CYTHON=$(which $fn)
|
|
|
|
if [ "X$CYTHON" != "X" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "X$CYTHON" == "X" ]; then
|
2013-04-15 08:51:42 +02:00
|
|
|
echo
|
|
|
|
echo "Cython not found !"
|
|
|
|
echo "Ensure your PATH contain access to 'cython' or 'cython-2.7'"
|
|
|
|
echo
|
|
|
|
echo "Current PATH: $PATH"
|
|
|
|
echo
|
2013-02-28 19:07:05 +01:00
|
|
|
fi
|
|
|
|
|
2013-03-01 18:37:40 +01:00
|
|
|
# check basic tools
|
2013-03-01 18:40:51 +01:00
|
|
|
CONFIGURATION_OK=1
|
|
|
|
for tool in pkg-config autoconf automake libtool hg; do
|
|
|
|
if [ "X$(which $tool)" == "X" ]; then
|
|
|
|
echo "Missing requirement: $tool is not installed !"
|
|
|
|
CONFIGURATION_OK=0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $CONFIGURATION_OK -eq 0 ]; then
|
|
|
|
echo "Install thoses requirements first, then restart the script."
|
2013-03-01 18:37:40 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2013-02-28 19:07:05 +01:00
|
|
|
|
2011-12-06 10:49:14 +01:00
|
|
|
|
2013-02-12 00:39:38 +01:00
|
|
|
# flags for arm compilation
|
2013-10-08 11:02:05 +02:00
|
|
|
#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_CC=$(xcrun -find -sdk iphoneos clang)
|
|
|
|
export ARM_AR=$(xcrun -find -sdk iphoneos ar)
|
|
|
|
export ARM_LD=$(xcrun -find -sdk iphoneos ld)
|
|
|
|
|
|
|
|
export ARM_CFLAGS="-arch armv7"
|
2011-12-06 12:08:47 +01:00
|
|
|
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-10-08 11:02:05 +02:00
|
|
|
export ARM_LDFLAGS="-arch armv7 -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
|
|
|
|
2013-10-27 13:24:14 +01:00
|
|
|
# ensure byte-compiling is working
|
|
|
|
export PYTHONDONTWRITEBYTECODE=
|
|
|
|
|
2015-01-10 18:41:48 +01:00
|
|
|
# ensure that no current flags in the user env will be used
|
|
|
|
unset ARCHFLAGS
|
|
|
|
unset CFLAGS
|
|
|
|
unset LDFLAGS
|
|
|
|
|
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
|
2014-11-24 02:50:02 +01:00
|
|
|
for var in "$@"; do
|
|
|
|
echo " - extracting $var"
|
|
|
|
try ar x $var
|
|
|
|
done
|
|
|
|
echo " - create the archive"
|
2011-12-06 15:32:31 +01:00
|
|
|
try ar rc $fn *.o
|
2014-11-24 02:50:02 +01:00
|
|
|
echo " - finalize the archive"
|
2011-12-06 15:32:31 +01:00
|
|
|
try ranlib $fn
|
|
|
|
try mv -f $fn $1
|
|
|
|
try cd ..
|
|
|
|
try rm -rf ddp
|
2014-11-24 02:50:02 +01:00
|
|
|
echo " - done: $1 updated"
|
2011-12-06 15:32:31 +01:00
|
|
|
}
|