Merge pull request #37 from fictorial/master

This is a request for help for building a version of Kivy for the iOS Simulator.
This commit is contained in:
Mathieu Virbel 2013-02-11 12:42:27 -08:00
commit 3875dd12e2
2 changed files with 84 additions and 22 deletions

View file

@ -26,15 +26,15 @@ try patch -p1 < $KIVYIOSROOT/src/python_files/Python-$PYTHON_VERSION-static-_sql
try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local
try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py
# echo "Building for native machine ============================================"
echo "Building for native machine ============================================" if [ -e hostpython ]; then
try ./configure CC="$CCACHE clang -Qunused-arguments -fcolor-diagnostics" LDFLAGS="-lsqlite3"
try ./configure CC="$CCACHE clang -Qunused-arguments -fcolor-diagnostics" LDFLAGS="-lsqlite3" try make python.exe Parser/pgen
try make python.exe Parser/pgen try mv python.exe hostpython
try mv python.exe hostpython try mv Parser/pgen Parser/hostpgen
try mv Parser/pgen Parser/hostpgen try make distclean
try make distclean fi
echo "Building for iOS =======================================================" echo "Building for iOS ======================================================="
@ -54,7 +54,8 @@ ln -s "$IOSSDKROOT/usr/lib/libgcc_s.1.dylib" extralibs/libgcc_s.10.4.dylib || ec
try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local try cp $KIVYIOSROOT/src/python_files/ModulesSetup Modules/Setup.local
try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py try cp $KIVYIOSROOT/src/python_files/_scproxy.py Lib/_scproxy.py
try ./configure CC="$ARM_CC" LD="$ARM_LD" \ if [ ! -e $BUILDROOT/lib/libpython2.7-armv7.a ]; then
try ./configure CC="$ARM_CC" LD="$ARM_LD" \
CFLAGS="$ARM_CFLAGS" \ CFLAGS="$ARM_CFLAGS" \
LDFLAGS="$ARM_LDFLAGS -Lextralibs/ -lsqlite3" \ LDFLAGS="$ARM_LDFLAGS -Lextralibs/ -lsqlite3" \
--disable-toolbox-glue \ --disable-toolbox-glue \
@ -62,11 +63,46 @@ try ./configure CC="$ARM_CC" LD="$ARM_LD" \
--prefix=/python \ --prefix=/python \
--without-doc-strings --without-doc-strings
try make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \ try make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
CROSS_COMPILE_TARGET=yes CROSS_COMPILE_TARGET=yes
try make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="$BUILDROOT/python" try make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes prefix="$BUILDROOT/python"
try mv -f $BUILDROOT/python/lib/libpython2.7.a $BUILDROOT/lib/ try mv -f $BUILDROOT/python/lib/libpython2.7.a \
$BUILDROOT/lib/libpython2.7-armv7.a
deduplicate $BUILDROOT/lib/libpython2.7-armv7.a
fi
# build for i386 (simulator)
if [ ! -e $BUILDROOT/lib/libpython2.7-i386.a ]; then
export CPPFLAGS="-I$SIMULATOR_SDKROOT/usr/include/"
echo "*************************"
echo CPPFLAGS=$CPPFLAGS
echo "*************************"
try ./configure CC="$i386_CC" LD="$i386_LD" \
CFLAGS="$i386_CFLAGS" \
LDFLAGS="$i386_LDFLAGS -Lextralibs/ -lsqlite3" \
--disable-toolbox-glue \
--prefix=/python \
--without-doc-strings
try make -j4 install prefix="$BUILDROOT/python"
try mv -f $BUILDROOT/python/lib/libpython2.7.a \
$BUILDROOT/lib/libpython2.7-i386.a
deduplicate $BUILDROOT/lib/libpython2.7-i386.a
fi
# combine the libs into a Universal lib
if [ -e $BUILDROOT/lib/libpython2.7-i386.a ] && [ -e $BUILDROOT/lib/libpython2.7-armv7.a ]; then
try lipo -create -output $BUILDROOT/lib/libpython2.7.a \
$BUILDROOT/lib/libpython2.7-i386.a \
$BUILDROOT/lib/libpython2.7-armv7.a
fi
deduplicate $BUILDROOT/lib/libpython2.7.a

View file

@ -23,6 +23,21 @@ if [ ! -d $DEVROOT ]; then
exit 1 exit 1
fi fi
# iOS SDK Environmnent for the simulator
export SIMULATOR_SDKVER=`xcodebuild -showsdks | fgrep "iphonesimulator" | tail -n 1 | awk '{print $2}'`
export SIMULATOR_DEVROOT=`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer
export SIMULATOR_SDKROOT=$SIMULATOR_DEVROOT/SDKs/iPhoneSimulator$SDKVER.sdk
if [ ! -d $SIMULATOR_DEVROOT ]; then
echo "Unable to found the Xcode iPhoneSimulator.platform"
echo
echo "The path is automatically set from 'xcode-select -print-path'"
echo " + /Platforms/iPhoneSimulator.platform/Developer"
echo
echo "Ensure 'xcode-select -print-path' is set."
exit 1
fi
# version of packages # version of packages
export PYTHON_VERSION=2.7.1 export PYTHON_VERSION=2.7.1
export SDLTTF_VERSION=2.0.10 export SDLTTF_VERSION=2.0.10
@ -32,7 +47,7 @@ export XSLT_VERSION=1.1.26
export LXML_VERSION=2.3.1 export LXML_VERSION=2.3.1
# where the build will be located # where the build will be located
export KIVYIOSROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" export KIVYIOSROOT=$PWD
export BUILDROOT="$KIVYIOSROOT/build" export BUILDROOT="$KIVYIOSROOT/build"
export TMPROOT="$KIVYIOSROOT/tmp" export TMPROOT="$KIVYIOSROOT/tmp"
export DESTROOT="$KIVYIOSROOT/tmp/root" export DESTROOT="$KIVYIOSROOT/tmp/root"
@ -45,7 +60,7 @@ export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
# some tools # some tools
export CCACHE=$(which ccache) export CCACHE=$(which ccache)
# flags for arm compilation # flags for arm (device) compilation
export ARM_CC="$CCACHE $DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2" export ARM_CC="$CCACHE $DEVROOT/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
export ARM_AR="$DEVROOT/usr/bin/ar" export ARM_AR="$DEVROOT/usr/bin/ar"
export ARM_LD="$DEVROOT/usr/bin/ld" export ARM_LD="$DEVROOT/usr/bin/ld"
@ -60,6 +75,17 @@ export ARM_LDFLAGS="$ARM_LDFLAGS -miphoneos-version-min=$SDKVER"
export ARM_CFLAGS="$ARM_CFLAGS -O3" export ARM_CFLAGS="$ARM_CFLAGS -O3"
#export ARM_CFLAGS="$ARM_CFLAGS -O0 -g" #export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
# flags for i386 (simulator) compilation
export i386_CC="$CCACHE $SIMULATOR_DEVROOT/usr/bin/i686-apple-darwin11-llvm-gcc-4.2"
export i386_AR="$SIMULATOR_DEVROOT/usr/bin/ar"
export i386_LD="$SIMULATOR_DEVROOT/usr/bin/ld"
export i386_CFLAGS="-isysroot $SIMULATOR_SDKROOT"
export i386_LDFLAGS="-isysroot $SIMULATOR_SDKROOT"
# uncomment this line if you want debugging stuff
export i386_CFLAGS="$i386_CFLAGS -O3"
#export i386_CFLAGS="$i386_CFLAGS -O0 -g"
# create build directory if not found # create build directory if not found
try mkdir -p $BUILDROOT try mkdir -p $BUILDROOT
try mkdir -p $BUILDROOT/include try mkdir -p $BUILDROOT/include