Skip to content

Commit a9e88fe

Browse files
author
Oliver Marks
committed
enable ctypes wip, hopefully fixes for kivy#301, kivy#333, kivy#319
1 parent 9797fe6 commit a9e88fe

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

distribute.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ function run_distribute() {
807807
try find . | grep -E '*\.(py|pyc|so\.o|so\.a|so\.libs)$' | xargs rm
808808

809809
# we are sure that all of theses will be never used on android (well...)
810-
try rm -rf ctypes
811810
try rm -rf lib2to3
812811
try rm -rf idlelib
813812
try rm -rf config/libpython*.a

recipes/python/patches/disable-modules.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# This global variable is used to hold the list of modules to be disabled.
77
-disabled_module_list = []
8-
+disabled_module_list = ['spwd', '_ctypes','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing']
8+
+disabled_module_list = ['spwd','bz2','ossaudiodev','_curses','_curses_panel','readline','_locale','_bsddb','gdbm','dbm','nis','linuxaudiodev','crypt','_multiprocessing']
99

1010
def add_dir_to_list(dirlist, dir):
1111
"""Add the directory 'dir' to the list 'dirlist' (at the front) if

recipes/python/recipe.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function prebuild_python() {
2020
fi
2121

2222
try patch -p1 < $RECIPE_python/patches/Python-$VERSION_python-xcompile.patch
23+
try patch -p1 < $RECIPE_python/patches/Python-$VERSION_python-ctypes-disable-wchar.patch
2324
try patch -p1 < $RECIPE_python/patches/disable-modules.patch
2425
try patch -p1 < $RECIPE_python/patches/fix-locale.patch
2526
try patch -p1 < $RECIPE_python/patches/fix-gethostbyaddr.patch
@@ -92,8 +93,13 @@ function build_python() {
9293
export LDFLAGS="$LDFLAGS -L$SRC_PATH/obj/local/$ARCH/"
9394
fi
9495

95-
try ./configure --host=arm-eabi OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
96-
echo ./configure --host=arm-eabi OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
96+
# CFLAGS for python ctypes library
97+
export CFLAGS="$CFLAGS -DNO_MALLINFO"
98+
export BUILDARCH=x86_64-linux-gnu
99+
export HOSTARCH=arm-eabi
100+
101+
try ./configure --host=$HOSTARCH --build=$BUILDARCH OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
102+
echo ./configure --host=$HOSTARCH --build=$BUILDARCH OPT=$OFLAG --prefix="$BUILD_PATH/python-install" --enable-shared --disable-toolbox-glue --disable-framework
97103
echo $MAKE HOSTPYTHON=$BUILD_python/hostpython HOSTPGEN=$BUILD_python/hostpgen CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
98104
cp HOSTPYTHON=$BUILD_python/hostpython python
99105

@@ -117,6 +123,7 @@ function build_python() {
117123
fi
118124
try cp $BUILD_hostpython/hostpython $HOSTPYTHON
119125
try cp libpython2.7.so $LIBS_PATH/
126+
try cp -a build/lib.linux-x86_64-2.7/_ctypes*.so $LIBS_PATH
120127

121128
# reduce python
122129
rm -rf "$BUILD_PATH/python-install/lib/python2.7/test"

src/src/org/renpy/android/PythonService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ public void run(){
8585
System.loadLibrary("python2.7");
8686
System.loadLibrary("application");
8787
System.loadLibrary("sdl_main");
88+
System.loadLibrary("ctypes");
8889

8990
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_io.so");
9091
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/unicodedata.so");
92+
System.load(getFilesDir() + "/lib/python2.7/lib-dynload/_ctypes.so");
9193

9294
try {
9395
System.loadLibrary("sqlite3");

0 commit comments

Comments
 (0)