8000 add android module, fix abort(), but _io.so still don't want to be lo… · felixjimenez/python-for-android@5758973 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5758973

Browse files
committed
add android module, fix abort(), but _io.so still don't want to be loaded... fuck.
1 parent d412cdd commit 5758973

File tree

15 files changed

+8559
-14
lines changed

15 files changed

+8559
-14
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,5 @@ TODO
127127
- Make Android API configurable (defined in src/default.properties => shoudl be generated)
128128
- jni/Android.mk must not include ttf/image/mixer if not asked by the user
129129
- application should be automatically generated (Android.mk etc...)
130+
- Python try always to import name.so, namemodule.so, name.py, name.pyo ?
131+
- restore libpymodules.so loading to reduce the number of dlopen.

distribute.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ROOT_PATH="$(dirname $(readlink -f $0))"
1414
RECIPES_PATH="$ROOT_PATH/recipes"
1515
BUILD_PATH="$ROOT_PATH/build"
1616
LIBS_PATH="$ROOT_PATH/build/libs"
17-
PACKAGES_PATH="$BUILD_PATH/packages"
17+
PACKAGES_PATH="$ROOT_PATH/.packages"
1818
SRC_PATH="$ROOT_PATH/src"
1919
JNI_PATH="$SRC_PATH/jni"
2020
DIST_PATH="$ROOT_PATH/dist"
@@ -173,10 +173,10 @@ function run_prepare() {
173173
done
174174

175175
# create build directory if not found
176+
test -d $PACKAGES_PATH || mkdir -p $PACKAGES_PATH
176177
if [ ! -d $BUILD_PATH ]; then
177178
mkdir -p $BUILD_PATH
178179
mkdir -p $LIBS_PATH
179-
mkdir -p $PACKAGES_PATH
180180
fi
181181

182182
# create initial files
@@ -185,7 +185,7 @@ function run_prepare() {
185185
}
186186

187187
function run_source_modules() {
188-
needed=(hostpython python $MODULES)
188+
needed=(hostpython python android $MODULES)
189189
declare -A processed
190190

191191
while [ ${#needed[*]} -ne 0 ]; do
@@ -231,7 +231,7 @@ function run_order_modules() {
231231
rm $filename
232232
fi
233233

234-
for module in hostpython python $MODULES; do
234+
for module in hostpython python android $MODULES; do
235235
# get priority
236236
priority="PRIORITY_$module"
237237
priority=${!priority}
@@ -401,19 +401,22 @@ function run_distribute() {
401401
try cp -a $BUILD_PATH/libs/* libs/$ARCH/
402402

403403
debug "Fill private directory"
404-
try cp -a python-install/lib/python* private/lib
405-
try mv private/lib/lib-dynload/*.so private/
404+
try cp -a python-install/lib private/
405+
try mkdir -p private/include/python2.7
406+
try cp python-install/include/python2.7/pyconfig.h private/include/python2.7/
406407

407408
debug "Reduce private directory from unwanted files"
408-
cd $DIST_PATH/private/lib
409+
try rm -f $DIST_PATH/private/lib/libpython2.7.so
410+
try rm -rf $DIST_PATH/private/lib/pkgconfig
411+
try cd $DIST_PATH/private/lib/python2.7
409412
try find . | grep -E '*\.(py|pyc|so\.o|so\.a|so\.libs)$' | xargs rm
410413
try rm -rf test
411414
try rm -rf ctypes
412415
try rm -rf lib2to3
413416
try rm -rf lib-tk
414417
try rm -rf idlelib
415418
try rm -rf unittest/test
416-
try rm -rf lib-dynload
419+
#try rm -rf lib-dynload
417420
try rm -rf json/tests
418421
try rm -rf distutils/tests
419422
try rm -rf email/test

recipes/android/recipe.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
PRIORITY_android=30
4+
VERSION_android=
5+
URL_android=
6+
DEPS_android=(pygame)
7+
MD5_android=
8+
BUILD_android=$BUILD_PATH/android/android
9+
RECIPE_android=$RECIPES_PATH/android
10+
11+
function prebuild_android() {
12+
cd $BUILD_PATH/android
13+
14+
if [ ! -d android ]; then
15+
try cp -a $RECIPE_android/src $BUILD_android
16+
fi
17+
}
18+
19+
function build_android() {
20+
cd $BUILD_android
21+
22+
# if the last step have been done, avoid all
23+
if [ -f .done ]; then
24+
return
25+
fi
26+
27+
push_arm
28+
29+
export LDFLAGS="$LDFLAGS -L$LIBS_PATH"
30+
31+
# cythonize
32+
try cython android.pyx
33+
try cython android_sound.pyx
34+
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -i
35+
36+
# copy files
37+
try cp android.so android_sound.so android_mixer.py \
38+
$BUILD_PATH/python-install/lib/python2.7/
39+
40+
touch .done
41+
pop_arm
42+
}
43+
44+
function postbuild_android() {
45+
true
46+
}

0 commit comments

Comments
 (0)
0