kivy-ios/tools/build-kivy.sh

61 lines
1.7 KiB
Bash
Raw Normal View History

#!/bin/bash
. $(dirname $0)/environment.sh
2014-02-03 17:16:47 +01:00
if [ "X$KIVY_BRANCH" == "X" ]; then
KIVY_BRANCH=stable
fi
if [ "X$KIVY_REPO" == "X" ]; then
KIVY_REPO=https://github.com/kivy/kivy
fi
if [ ! -d $TMPROOT/kivy ] ; then
try pushd $TMPROOT
try git clone -b $KIVY_BRANCH $KIVY_REPO
try cd kivy
try popd
fi
2011-12-06 16:02:21 +01:00
if [ "X$1" = "X-f" ] ; then
try pushd $TMPROOT/kivy
try git clean -dxf
2014-02-03 17:16:47 +01:00
try git pull origin $KIVY_BRANCH
try popd
fi
pushd $TMPROOT/kivy
OLD_CFLAGS="$CFLAGS"
OLD_LDSHARED="$LDSHARED"
export LDSHARED="$KIVYIOSROOT/tools/liblink"
export CFLAGS="$ARM_CFLAGS"
ln -s $KIVYIOSROOT/Python-$IOS_PYTHON_VERSION/python
ln -s $KIVYIOSROOT/Python-$IOS_PYTHON_VERSION/python.exe
rm -rdf iosbuild/
try mkdir iosbuild
echo "First build ========================================"
HOSTPYTHON=$TMPROOT/Python-$IOS_PYTHON_VERSION/hostpython
$HOSTPYTHON setup.py build_ext -g
echo "cythoning =========================================="
find . -name *.pyx -exec $KIVYIOSROOT/tools/cythonize.py {} \;
echo "Second build ======================================="
try $HOSTPYTHON setup.py build_ext -g
try $HOSTPYTHON setup.py install -O2 --root iosbuild
# Strip away the large stuff
find iosbuild/ | grep -E '.*\.(py|pyc|so\.o|so\.a|so\.libs)$$' | xargs rm
rm -rdf "$BUILDROOT/python/lib/python2.7/site-packages/kivy"
# Copy to python for iOS installation
try cp -R "iosbuild/usr/local/lib/python2.7/site-packages/kivy" "$BUILDROOT/python/lib/python2.7/site-packages"
export LDSHARED="$OLD_LDSHARED"
export CFLAGS="$OLD_CFLAGS"
popd
2011-12-05 10:09:35 +01:00
# FIXME this part is build/cpu dependent :/
bd=$TMPROOT/kivy/build/lib.macosx-*/kivy
try $KIVYIOSROOT/tools/biglink $BUILDROOT/lib/libkivy.a $bd $bd/graphics $bd/core/window $bd/core/text $bd/core/image $bd/core/audio
deduplicate $BUILDROOT/lib/libkivy.a