8000 Merge branch 'master' of github.com:kivy/python-for-android · adesst/python-for-android@da7045e · GitHub
[go: up one dir, main page]

Skip to content

Commit da7045e

Browse files
committed
Merge branch 'master' of github.com:kivy/python-for-android
2 parents 63f4269 + 1654b8f commit da7045e

File tree

12 files changed

+182
-39
lines changed

12 files changed

+182
-39
lines changed

distribute.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function push_arm() {
9999

100100
# this must be something depending of the API level of Android
101101
export PATH="$ANDROIDNDK/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/:$ANDROIDNDK:$ANDROIDSDK/tools:$PATH"
102-
if [ "X$ANDROIDNDKVER" == "Xr7" ]; then
102+
if [ "X${ANDROIDNDKVER:0:2}" == "Xr7" ]; then
103103
export TOOLCHAIN_PREFIX=arm-linux-androideabi
104104
export TOOLCHAIN_VERSION=4.4.3
105105
elif [ "X$ANDROIDNDKVER" == "Xr5b" ]; then

docs/source/faq.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FAQ
2+
===
3+
4+
arm-linux-androideabi-gcc: Internal error: Killed (program cc1)
5+
---------------------------------------------------------------
6+
7+
This could happen if you are not using a validated SDK/NDK with Python for
8+
Android. Go to :doc:`prerequisites.rst` to see which one are working.

recipes/android/recipe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RECIPE_android=$RECIPES_PATH/android
1010
function prebuild_android() {
1111
cd $BUILD_PATH/android
1212

13+
rm -rf android
1314
if [ ! -d android ]; then
1415
try cp -a $RECIPE_android/src $BUILD_android
1516
fi

recipes/android/src/android.pyx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,22 @@ def check_stop():
227227

228228
def ack_stop():
229229
android_ackstop()
230+
231+
# -------------------------------------------------------------------
232+
# URL Opening.
233+
cdef extern void android_open_url(char *url)
234+
def open_url(url):
235+
android_open_url(url)
236+
237+
# Web browser support.
238+
class AndroidBrowser(object):
239+
def open(self, url, new=0, autoraise=True):
240+
open_url(url)
241+
def open_new(self, url):
242+
open_url(url)
243+
def open_new_tab(self, url):
244+
open_url(url)
245+
246+
import webbrowser
247+
webbrowser.register('android', AndroidBrowser, None, -1)
248+

recipes/android/src/android_jni.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,28 @@ void android_action_send(char *mimeType, char *filename, char *subject, char *te
286286
j_mimeType, j_filename, j_subject, j_text,
287287
j_chooser_title);
288288
}
289+
290+
void android_open_url(char *url) {
291+
static JNIEnv *env = NULL;
292+
static jclass *cls = NULL;
293+
static jmethodID mid = NULL;
294+
295+
if (env == NULL) {
296+
env = SDL_ANDROID_GetJNIEnv();
297+
aassert(env);
298+
cls = (*env)->FindClass(env, "org/renpy/android/SDLSurfaceView");
299+
aassert(cls);
300+
mid = (*env)->GetStaticMethodID(env, cls, "openUrl", "(Ljava/lang/String;)V");
301+
aassert(mid);
302+
}
303+
304+
PUSH_FRAME;
305+
306+
(*env)->CallStaticVoidMethod(
307+
env, cls, mid,
308+
(*env)->NewStringUTF(env, url)
309+
);
310+
311+
POP_FRAME;
312+
}
313+

recipes/audiostream/recipe.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# Recent change made audiostream not compatible with python-for-android yet.
3+
# Only h264+aac build are working.
4+
5+
VERSION_audiostream=
6+
URL_audiostream=https://github.com/kivy/audiostream/zipball/master/audiostream.zip
7+
DEPS_audiostream=(python sdl)
8+
MD5_audiostream=
9+
BUILD_audiostream=$BUILD_PATH/audiostream/audiostream
10+
RECIPE_audiostream=$RECIPES_PATH/audiostream
11+
12+
function prebuild_audiostream() {
13+
cd $BUILD_audiostream
14+
}
15+
16+
function build_audiostream() {
17+
cd $BUILD_audiostream
18+
19+
if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/audiostream" ]; then
20+
return
21+
fi
22+
23+
push_arm
24+
25+
# build python extension
26+
export JNI_PATH=$JNI_PATH
27+
export CFLAGS="$CFLAGS -I$JNI_PATH/sdl/include -I$JNI_PATH/sdl_mixer/"
28+
export LDFLAGS="$LDFLAGS -lm -L$LIBS_PATH"
29+
export AUDIOSTREAM_ROOT="$BUILD_audiostream/build/audiostream/armeabi-v7a"
30+
try cd $BUILD_audiostream
31+
try find . -iname '*.pyx' -exec cython {} \;
32+
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
33+
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
34+
35+
pop_arm
36+
}
37+
38+
function postbuild_audiostream() {
39+
true
40+
}

recipes/chipmunk/recipe.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

recipes/cymunk/recipe.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
VERSION_cymunk=
4+
URL_cymunk=http://github.com/tito/cymunk/zipball/master/cymunk.zip
5+
DEPS_cymunk=(python)
6+
MD5_cymunk=
7+
BUILD_cymunk=$BUILD_PATH/cymunk/$(get_directory $URL_cymunk)
8+
RECIPE_cymunk=$RECIPES_PATH/cymunk
9+
10+
function prebuild_cymunk() {
11+
true
12+
}
13+
14+
function build_cymunk() {
15+
cd $BUILD_cymunk
16+
17+
push_arm
18+
19+
export LDSHARED="$LIBLINK"
20+
21+
try find . -iname '*.pyx' -exec cython {} \;
22+
try $BUILD_PATH/python-install/bin/python.host setup.py build_ext -v
23+
try find build/lib.* -name "*.o" -exec $STRIP {} \;
24+
25+
export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
26+
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
27+
28+
unset LDSHARED
29+
pop_arm
30+
}
31+
32+
function postbuild_cymunk() {
33+
true
34+
}

recipes/kivy/recipe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function prebuild_kivy() {
1313

1414
function build_kivy() {
1515
if [ -d "$BUILD_PATH/python-install/lib/python2.7/site-packages/kivy" ]; then
16-
return
16+
#return
1717
true
1818
fi
1919

recipes/pylibpd/recipe.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
4+
# version of your package
5+
VERSION_pylibpd=1.3
6+
7+
# dependencies of this recipe
8+
DEPS_pylibpd=()
9+
10+
# url of the
11+
URL_pylibpd=http://ticklestep.com/pylibpd.tar.gz
12+
13+
# md5 of the package
14+
MD5_pylibpd=647f813726c21445c42bc2fc77a4b146
15+
16+
# default build path
17+
BUILD_pylibpd=$BUILD_PATH/pylibpd/$(get_directory $URL_pylibpd)
18+
19+
# default recipe path
20+
RECIPE_pylibpd=$RECIPES_PATH/pylibpd
21+
22+
# function called for preparing source code if needed
23+
# (you can apply patch etc here.)
24+
function prebuild_pylibpd() {
25+
true
26+
}
27+
28+
# function called to build the source code
29+
function build_pylibpd() {
30+
cd $BUILD_pylibpd/python
31+
push_arm
32+
$BUILD_PATH/python-install/bin/python.host setup.py install -O2
33+
pop_arm
34+
}
35+
36+
# function called after all the compile have been done
37+
function postbuild_pylibpd() {
38+
true
39+
}

0 commit comments

Comments
 (0)
0