create makefile and build in target specific subdir
This commit is contained in:
parent
d6919ca667
commit
d0f2810c6d
7 changed files with 131 additions and 54 deletions
20
Makefile
Normal file
20
Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
all: iphoneos iphonesimulator
|
||||
echo "Building fat lib";
|
||||
|
||||
iphoneos:
|
||||
mkdir -p build/armv7; \
|
||||
cp -r tools build/armv7/tools; \
|
||||
cp -r src build/armv7/src; \
|
||||
export TARGET_SDK=iphoneos; \
|
||||
TARGET_SDK=iphoneos build/armv7/tools/build-all.sh;
|
||||
|
||||
iphonesimulator:
|
||||
mkdir -p build/i386; \
|
||||
cp -r tools build/i386/tools; \
|
||||
cp -r src build/i386/src; \
|
||||
export TARGET_SDK=iphonesimulator; \
|
||||
TARGET_SDK=iphonesimulator build/i386/tools/build-all.sh;
|
||||
|
||||
clean:
|
||||
rm -rf ./build
|
34
src/python_files/Python-2.7.1-ctypes_duplicate.armv7.patch
Normal file
34
src/python_files/Python-2.7.1-ctypes_duplicate.armv7.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
--- Python2.7-old/Modules/_ctypes/cfield.c 2010-05-09 16:46:46.000000000 +0200
|
||||
+++ Python2.7-new/Modules/_ctypes/cfield.c 2013-08-27 00:21:15.000000000 +0200
|
||||
@@ -1747,24 +1747,6 @@
|
||||
} ffi_type;
|
||||
*/
|
||||
|
||||
-/* align and size are bogus for void, but they must not be zero */
|
||||
-ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID };
|
||||
-
|
||||
-ffi_type ffi_type_uint8 = { 1, 1, FFI_TYPE_UINT8 };
|
||||
-ffi_type ffi_type_sint8 = { 1, 1, FFI_TYPE_SINT8 };
|
||||
-
|
||||
-ffi_type ffi_type_uint16 = { 2, 2, FFI_TYPE_UINT16 };
|
||||
-ffi_type ffi_type_sint16 = { 2, 2, FFI_TYPE_SINT16 };
|
||||
-
|
||||
-ffi_type ffi_type_uint32 = { 4, 4, FFI_TYPE_UINT32 };
|
||||
-ffi_type ffi_type_sint32 = { 4, 4, FFI_TYPE_SINT32 };
|
||||
-
|
||||
-ffi_type ffi_type_uint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_UINT64 };
|
||||
-ffi_type ffi_type_sint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_SINT64 };
|
||||
-
|
||||
-ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT };
|
||||
-ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE };
|
||||
-
|
||||
#ifdef ffi_type_longdouble
|
||||
#undef ffi_type_longdouble
|
||||
#endif
|
||||
@@ -1772,6 +1754,4 @@
|
||||
ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN,
|
||||
FFI_TYPE_LONGDOUBLE };
|
||||
|
||||
-ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER };
|
||||
-
|
||||
/*---------------- EOF ----------------*/
|
|
@ -7,13 +7,13 @@ echo "Building libffi ============================="
|
|||
if [ ! -f $CACHEROOT/libffi-$FFI_VERSION.tar.gz ]; then
|
||||
try curl -L ftp://sourceware.org/pub/libffi/libffi-$FFI_VERSION.tar.gz > $CACHEROOT/libffi-$FFI_VERSION.tar.gz
|
||||
fi
|
||||
if [ ! -d $TMPROOT/libffi-$FFI_VERSION ]; then
|
||||
try rm -rf $TMPROOT/libffi-$FFI_VERSION
|
||||
try tar xvf $CACHEROOT/libffi-$FFI_VERSION.tar.gz
|
||||
try mv libffi-$FFI_VERSION $TMPROOT
|
||||
fi
|
||||
|
||||
if [ -f $TMPROOT/libffi-$FFI_VERSION/build/Release-iphoneos/libffi.a ]; then
|
||||
#get rid of old build
|
||||
rm -rf $TMPROOT/libffi-$FFI_VERSION
|
||||
try tar xvf $CACHEROOT/libffi-$FFI_VERSION.tar.gz
|
||||
try mv libffi-$FFI_VERSION $TMPROOT
|
||||
|
||||
if [ -f $TMPROOT/libffi-$FFI_VERSION/build/Release-${TARGET_SDK}/libffi.a ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
|
@ -21,6 +21,8 @@ fi
|
|||
pushd $TMPROOT/libffi-$FFI_VERSION
|
||||
try patch -p1 < $KIVYIOSROOT/src/ffi_files/ffi-$FFI_VERSION-sysv.S.patch
|
||||
|
||||
|
||||
|
||||
try xcodebuild $XCODEBUILD_FLAGS OTHER_CFLAGS="-no-integrated-as" -project libffi.xcodeproj -target "libffi iOS"
|
||||
try cp build/Release-${TARGET_SDK}/libffi.a $BUILDROOT/lib/libffi.a
|
||||
try cp -a build/Release-${TARGET_SDK}/usr/local/include $BUILDROOT/include/ffi
|
||||
|
|
|
@ -66,7 +66,7 @@ try ./configure CC="$ARM_CC" LD="$ARM_LD" \
|
|||
|
||||
# with undefined lookup, checks in configure just failed :(
|
||||
try patch -p1 < $KIVYIOSROOT/src/python_files/Python-$IOS_PYTHON_VERSION-pyconfig.patch
|
||||
try patch -p1 < $KIVYIOSROOT/src/python_files/Python-$IOS_PYTHON_VERSION-ctypes_duplicate.patch
|
||||
try patch -p1 < $KIVYIOSROOT/src/python_files/Python-$IOS_PYTHON_VERSION-ctypes_duplicate.${CPU_ARCHITECHTURE}.patch
|
||||
|
||||
try make -j4 HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
|
||||
CROSS_COMPILE_TARGET=yes
|
||||
|
|
|
@ -8,28 +8,6 @@ try () {
|
|||
"$@" || exit -1
|
||||
}
|
||||
|
||||
#KIVY_IOS_SDK=iphoneos
|
||||
export TARGET_SDK="iphonesimulator"
|
||||
export CPU_ARCHITECHTURE="i386"
|
||||
export XCODEBUILD_FLAGS="ONLY_ACTIVE_ARCH=NO ARCHS=$CPU_ARCHITECHTURE -configuration Release -sdk ${TARGET_SDK} --arch=$CPU_ARCHITECHTURE"
|
||||
|
||||
|
||||
|
||||
# iOS SDK Environmnent (don't use name "SDKROOT"!!! it will break the compilation)
|
||||
#export SDKVER=`xcodebuild -showsdks | fgrep "$KIVY_IOS_SDK" | tail -n 1 | awk '{print $2}'`
|
||||
#export DEVROOT=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer
|
||||
export SDKVER=`xcrun --sdk $TARGET_SDK --show-sdk-version`
|
||||
export IOSSDKROOT=`xcrun --sdk $TARGET_SDK --show-sdk-path`
|
||||
|
||||
# Xcode doesn't include /usr/local/bin
|
||||
export PATH="$PATH":/usr/local/bin
|
||||
|
||||
if [ ! -d $IOSSDKROOT ]; then
|
||||
echo "Unable to found the target $TARGET_SDK SDK "
|
||||
echo
|
||||
echo "The path is automatically set from 'xcrun --sdk $TARGET_SDK --show-sdk-path'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# version of packages
|
||||
export IOS_PYTHON_VERSION=2.7.1
|
||||
|
@ -40,16 +18,74 @@ export XSLT_VERSION=1.1.26
|
|||
export LXML_VERSION=2.3.1
|
||||
export FFI_VERSION=3.0.13
|
||||
|
||||
# where the build will be located
|
||||
# Xcode doesn't include /usr/local/bin
|
||||
export PATH="$PATH":/usr/local/bin
|
||||
|
||||
# ensure byte-compiling is working
|
||||
export PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
|
||||
|
||||
|
||||
# set TARGET_SDK to iphonos by default if not specified
|
||||
if [ "X$TARGET_SDK" == "X" ]; then
|
||||
export TARGET_SDK="iphoneos"
|
||||
fi
|
||||
|
||||
#set architechuture based on which target we compiling for
|
||||
export CPU_ARCHITECHTURE="armv7"
|
||||
if [ "X$TARGET_SDK" == "Xiphonesimulator" ]; then
|
||||
export CPU_ARCHITECHTURE="i386"
|
||||
fi
|
||||
|
||||
# where our built is located
|
||||
export KIVYIOSROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
|
||||
export BUILDROOT="$KIVYIOSROOT/build"
|
||||
export TMPROOT="$KIVYIOSROOT/tmp"
|
||||
export DESTROOT="$KIVYIOSROOT/tmp/root"
|
||||
export CACHEROOT="$KIVYIOSROOT/.cache"
|
||||
|
||||
# pkg-config for SDL and futures
|
||||
try mkdir -p $BUILDROOT/pkgconfig
|
||||
export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
|
||||
# iOS SDK Environmnent (don't use name "SDKROOT"!!! it will break the compilation)
|
||||
export SDKVER=`xcrun --sdk $TARGET_SDK --show-sdk-version`
|
||||
export IOSSDKROOT=`xcrun --sdk $TARGET_SDK --show-sdk-path`
|
||||
|
||||
|
||||
|
||||
#find the right compiler and linker
|
||||
export ARM_CC=$(xcrun -find -sdk $TARGET_SDK clang)
|
||||
export ARM_AR=$(xcrun -find -sdk $TARGET_SDK ar)
|
||||
export ARM_LD=$(xcrun -find -sdk $TARGET_SDK ld)
|
||||
|
||||
# flags for arm compilation
|
||||
# (not really arm if building for simlator...but it's all the stuff we're cross comiling for iOS)
|
||||
export ARM_CFLAGS="-arch $CPU_ARCHITECHTURE"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -pipe -no-cpp-precomp"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -isysroot $IOSSDKROOT"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -miphoneos-version-min=$SDKVER"
|
||||
|
||||
|
||||
# flags for linker
|
||||
export ARM_LDFLAGS="-arch $CPU_ARCHITECHTURE -isysroot $IOSSDKROOT"
|
||||
export ARM_LDFLAGS="$ARM_LDFLAGS -miphoneos-version-min=$SDKVER"
|
||||
|
||||
# uncomment this line if you want debugging stuff
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -O3"
|
||||
#export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
|
||||
|
||||
#general xcode build settings
|
||||
export XCODEBUILD_FLAGS="ONLY_ACTIVE_ARCH=NO ARCHS=$CPU_ARCHITECHTURE -configuration Release -sdk ${TARGET_SDK} --arch=$CPU_ARCHITECHTURE"
|
||||
|
||||
|
||||
|
||||
|
||||
##CHECK sanity of configuration
|
||||
if [ ! -d $IOSSDKROOT ]; then
|
||||
echo "Unable to found the target $TARGET_SDK SDK "
|
||||
echo
|
||||
echo "The path is automatically set from 'xcrun --sdk $TARGET_SDK --show-sdk-path'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# some tools
|
||||
export CCACHE=$(which ccache)
|
||||
|
@ -83,29 +119,12 @@ if [ $CONFIGURATION_OK -eq 0 ]; then
|
|||
fi
|
||||
|
||||
|
||||
#now do some setup...
|
||||
|
||||
# pkg-config for SDL and futures
|
||||
try mkdir -p $BUILDROOT/pkgconfig
|
||||
export PKG_CONFIG_PATH="$BUILDROOT/pkgconfig:$PKG_CONFIG_PATH"
|
||||
|
||||
# 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_CC=$(xcrun -find -sdk $TARGET_SDK clang)
|
||||
export ARM_AR=$(xcrun -find -sdk $TARGET_SDK ar)
|
||||
export ARM_LD=$(xcrun -find -sdk $TARGET_SDK ld)
|
||||
|
||||
export ARM_CFLAGS="-arch $CPU_ARCHITECHTURE"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -pipe -no-cpp-precomp"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -isysroot $IOSSDKROOT"
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -miphoneos-version-min=$SDKVER"
|
||||
export ARM_LDFLAGS="-arch $CPU_ARCHITECHTURE -isysroot $IOSSDKROOT"
|
||||
export ARM_LDFLAGS="$ARM_LDFLAGS -miphoneos-version-min=$SDKVER"
|
||||
|
||||
# uncomment this line if you want debugging stuff
|
||||
export ARM_CFLAGS="$ARM_CFLAGS -O3"
|
||||
#export ARM_CFLAGS="$ARM_CFLAGS -O0 -g"
|
||||
|
||||
# ensure byte-compiling is working
|
||||
export PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
# create build directory if not found
|
||||
try mkdir -p $BUILDROOT
|
||||
|
|
|
@ -6,6 +6,8 @@ try () {
|
|||
|
||||
. $(dirname $0)/environment.sh
|
||||
|
||||
export PYTHONDONTWRITEBYTECODE=
|
||||
|
||||
APPNAME=$1
|
||||
APPID=$(echo $APPNAME | tr '[A-Z]' '[a-z]')
|
||||
APPDIR=$KIVYIOSROOT/app-$APPID
|
||||
|
|
Loading…
Reference in a new issue