From d02810840098f0009075f685fbc5e27a3cd6dd6c Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Thu, 13 Dec 2012 20:32:41 +0100 Subject: [PATCH 1/6] Adding kivy_stable for builds of kivy using stable code. --- recipes/kivy_stable/recipe.sh | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 recipes/kivy_stable/recipe.sh diff --git a/recipes/kivy_stable/recipe.sh b/recipes/kivy_stable/recipe.sh new file mode 100644 index 0000000000..95da6a1e9f --- /dev/null +++ b/recipes/kivy_stable/recipe.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +VERSION_kivy_stable=1.5.0 +URL_kivy_stable=https://github.com/kivy/kivy/archive/$VERSION_kivy_stable.zip +DEPS_kivy_stable=(pygame pyjnius android) +MD5_kivy_stable= +BUILD_kivy_stable=$BUILD_PATH/kivy_stable/$VERSION_kivy_stable +RECIPE_kivy_stable=$RECIPES_PATH/kivy_stable + +function prebuild_kivy_stable() { + true +} + +function build_kivy_stable() { + if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/kivy" ]; then + #return + true + fi + + cd $BUILD_kivy_stable + + push_arm + + export LDFLAGS="$LDFLAGS -L$LIBS_PATH" + export LDSHARED="$LIBLINK" + + # fake try to be able to cythonize generated files + $BUILD_PATH/python-install/bin/python.host setup.py build_ext + try find . -iname '*.pyx' -exec cython {} \; + try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v + try find build/lib.* -name "*.o" -exec $STRIP {} \; + try $BUILD_PATH/python-install/bin/python.host setup.py install -O2 + + try rm -rf $BUILD_PATH/python-install/lib/python*/site-packages/kivy/tools + + unset LDSHARED + pop_arm +} + +function postbuild_kivy_stable() { + true +} + From 411ad2b880e38dfb4db9fede171ba0aa6056d25e Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Tue, 1 Jan 2013 19:59:50 +0100 Subject: [PATCH 2/6] started working on the cythonizer --- cythonizer.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 cythonizer.py diff --git a/cythonizer.py b/cythonizer.py new file mode 100644 index 0000000000..0a8edac39f --- /dev/null +++ b/cythonizer.py @@ -0,0 +1,54 @@ +import os, sys + +class cythonizer(): + def __init__(self, + android_ndk = os.environ["ANDROIDNDK"], + android_api = os.environ["ANDROIDAPI"], + python_for_android = os.path.join(os.path.split(os.path.realpath(__file__))[0]) + ): + self.android_ndk = android_ndk + self.android_api = android_api + self.py_for_a = python_for_android + + for path in [self.android_ndk, self.py_for_a]: + if not os.path.isdir(path): + print "!! Haven't found path:", repr(path) + sys.exit() + + self.gcc = "%s/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc" %(self.android_ndk) + self.sysroot = "%s/platforms/android-%s/arch-arm" %(self.android_ndk, self.android_api) + self.a_incl = "-I%s/platforms/android-%s/arch-arm/usr/include" %(self.android_ndk, self.android_api) + self.p_incl = "-I%s/build/python-install/include/python2.7" %(self.py_for_a) + self.libs = "-L%s/build/libs" %(self.py_for_a) + self.p_libs = "-L%s/build/python-install/lib" %(self.py_for_a) + self.a_libs = "-L%s/platforms/android-%s/arch-arm/usr/lib" %(self.android_ndk, self.android_api) + + def make_o(self, c_file, o_file): + command = """%s -mandroid -fomit-frame-pointer -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC --sysroot %s %s %s -c database.c -o database.o""" %(self.gcc, + self.sysroot, + self.a_incl, + self.p_incl) + print command + + def make_so(self, o_file, so_file= None): + if so_file == None: + so_file = os.path.splitext(os.path.realpath(o_file))[0]+".so" + command = """%s -shared -O3 -mandroid -fomit-frame-pointer --sysroot %s -lm -lGLESv2 -lpython2.7 %s %s %s %s -o %s """ %(self.gcc, + self.sysroot, + self.libs, + self.p_libs, + self.a_libs, + o_file, + so_file) + print command + def make(self, py_pyx): + for root, dirs, files in os.walk(directory): + for file in files: + if file.endswith('.py') or file.endswith('.pyx'): + print file + self.make_o(py_pyx) + self.make_so(py_pyx) + +if __name__ == "__main__": + c = cythonizer() + c.make("test.py") \ No newline at end of file From f14ba3f486ced76941eb94f2a19cd892816d4de1 Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Thu, 3 Jan 2013 19:12:59 +0100 Subject: [PATCH 3/6] added ECLIPSE + PYDEV to .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 7550eafec9..69bd723977 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ src/default.properties dist *.pyc testsuite + +#ECLIPSE + PYDEV +.project +.pydevproject From b9ad5b945620708424ee6d4d799cbacbb8d27b41 Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Thu, 3 Jan 2013 19:22:10 +0100 Subject: [PATCH 4/6] Corrected MySQL/Connector to upstream link + updated version --- recipes/mysql_connector/recipe.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/mysql_connector/recipe.sh b/recipes/mysql_connector/recipe.sh index 1e57d96045..2bc9c60f76 100644 --- a/recipes/mysql_connector/recipe.sh +++ b/recipes/mysql_connector/recipe.sh @@ -1,7 +1,7 @@ #!/bin/bash -VERSION_mysql_connector=1.0.7 -URL_mysql_connector=https://launchpad.net/debian/+archive/primary/+files/mysql-connector-python_$VERSION_mysql_connector.orig.tar.gz +VERSION_mysql_connector=1.0.8 +URL_mysql_connector=http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-$VERSION_mysql_connector.tar.gz DEPS_mysql_connector=() MD5_mysql_connector=44c6b2c314c7ab7b7060484970b5ff23 BUILD_mysql_connector=$BUILD_PATH/mysql_connector/$(get_directory $URL_mysql_connector) From a4af77fe32448260c0149441a1a2f336213d6f91 Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Thu, 3 Jan 2013 19:48:16 +0100 Subject: [PATCH 5/6] updated MD5 in MySQL/Connector + updated kivy_stable --- recipes/kivy_stable/recipe.sh | 2 +- recipes/mysql_connector/recipe.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/kivy_stable/recipe.sh b/recipes/kivy_stable/recipe.sh index 95da6a1e9f..8483c7a59c 100644 --- a/recipes/kivy_stable/recipe.sh +++ b/recipes/kivy_stable/recipe.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION_kivy_stable=1.5.0 +VERSION_kivy_stable=1.5.1 URL_kivy_stable=https://github.com/kivy/kivy/archive/$VERSION_kivy_stable.zip DEPS_kivy_stable=(pygame pyjnius android) MD5_kivy_stable= diff --git a/recipes/mysql_connector/recipe.sh b/recipes/mysql_connector/recipe.sh index 2bc9c60f76..95513934ac 100644 --- a/recipes/mysql_connector/recipe.sh +++ b/recipes/mysql_connector/recipe.sh @@ -3,7 +3,7 @@ VERSION_mysql_connector=1.0.8 URL_mysql_connector=http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-$VERSION_mysql_connector.tar.gz DEPS_mysql_connector=() -MD5_mysql_connector=44c6b2c314c7ab7b7060484970b5ff23 +MD5_mysql_connector=1f2dd335c72684d51ee5d34f127d7ca9 BUILD_mysql_connector=$BUILD_PATH/mysql_connector/$(get_directory $URL_mysql_connector) RECIPE_mysql_connector=$RECIPES_PATH/mysql_connector From 3c36f1b9d8bf6a3dd47f86548b9d6fa5a3fdb6ae Mon Sep 17 00:00:00 2001 From: Thomas-Karl Pietrowski Date: Thu, 3 Jan 2013 21:21:10 +0100 Subject: [PATCH 6/6] Added more information to README.rst --- README.rst | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 6ff48bc125..96ae4eb661 100644 --- a/README.rst +++ b/README.rst @@ -14,14 +14,26 @@ Global overview --------------- #. Download Android NDK, SDK -#. Launch "android", and download latest Android platform + + * NDK: http://dl.google.com/android/ndk/android-ndk-r8c-linux-x86.tar.bz2 + + * More details at: http://developer.android.com/tools/sdk/ndk/index.html + + * SDK: http://dl.google.com/android/android-sdk_r21.0.1-linux.tgz + + * More details at:http://developer.android.com/sdk/index.html + +#. Launch "android", and download latest Android platform, here API 14, which would be Android 4.0 + #. Export some environment variables:: export ANDROIDSDK="/path/to/android/android-sdk-linux_86" - export ANDROIDNDK="/path/to/android/android-ndk-r7" - export ANDROIDNDKVER=r7 + export ANDROIDNDK="/path/to/android/android-ndk-r8c" + export ANDROIDNDKVER=r8c export ANDROIDAPI=14 + (Of course correct the paths mentioned in ANDROIDSDK and ANDROIDNDK) + #. Clone python-for-android:: git clone git://github.com/kivy/python-for-android