Skip to content

Commit d5e2bcd

Browse files
committed
WIP
1 parent 3407d51 commit d5e2bcd

File tree

5 files changed

+49
-10
lines changed

5 files changed

+49
-10
lines changed

pythonforandroid/bootstraps/common/build/jni/application/src/start.c

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

2424
#ifdef BOOTSTRAP_NAME_SDL3
2525
#include "SDL3/SDL.h"
26-
#include "SDL3/SDL_opengles2.h"
26+
#include "SDL3/SDL_main.h"
2727
#endif
2828

2929
#include "android/log.h"

pythonforandroid/recipes/android/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def prebuild_arch(self, arch):
7474
self.config_env[key] = str(value)
7575

7676
if is_sdl:
77-
fh.write('JNIEnv *SDL_AndroidGetJNIEnv(void);\n')
77+
fh.write('JNIEnv *SDL_GetAndroidJNIEnv(void);\n')
7878
fh.write(
79-
'#define SDL_ANDROID_GetJNIEnv SDL_AndroidGetJNIEnv\n'
79+
'#define SDL_ANDROID_GetJNIEnv SDL_GetAndroidJNIEnv\n'
8080
)
8181
else:
8282
fh.write('JNIEnv *WebView_AndroidGetJNIEnv(void);\n')

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class KivyRecipe(CythonRecipe):
2929

3030
depends = ['sdl3', 'pyjnius', 'setuptools']
3131
python_depends = ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype']
32+
hostpython_prerequisites = []
3233

3334
# sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
3435
# See: https://github.com/kivy/kivy/pull/8025
@@ -54,7 +55,7 @@ def cythonize_build(self, env, build_dir='.'):
5455
def cythonize_file(self, env, build_dir, filename):
5556
# We can ignore a few files that aren't important to the
5657
# android build, and may not work on Android anyway
57-
do_not_cythonize = ['window_x11.pyx', ]
58+
do_not_cythonize = ['window_x11.pyx', 'camera_avfoundation.pyx', 'img_imageio.pyx', 'egl_angle_metal.pyx']
5859
if basename(filename) in do_not_cythonize:
5960
return
6061
super().cythonize_file(env, build_dir, filename)
@@ -77,13 +78,15 @@ def get_recipe_env(self, arch):
7778
if 'sdl3' in self.ctx.recipe_build_order:
7879
env['USE_SDL3'] = '1'
7980
env['KIVY_SPLIT_EXAMPLES'] = '1'
80-
sdl3_mixer_recipe = self.get_recipe('sdl3_mixer', self.ctx)
81-
sdl3_image_recipe = self.get_recipe('sdl3_image', self.ctx)
8281
env['KIVY_SDL3_PATH'] = ':'.join([
83-
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3', 'include'),
84-
*sdl3_image_recipe.get_include_dirs(arch),
85-
*sdl3_mixer_recipe.get_include_dirs(arch),
86-
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_ttf'),
82+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
83+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_image', 'include'),
84+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_mixer', 'include'),
85+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_ttf', 'include'),
86+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include', 'SDL3'),
87+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_image', 'include', 'SDL3_image'),
88+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_mixer', 'include', 'SDL3_mixer'),
89+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL3_ttf', 'include', 'SDL3_ttf'),
8790
])
8891

8992
return env
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff -Naur pyjnius.orig/jnius/env.py pyjnius/jnius/env.py
2+
--- pyjnius.orig/jnius/env.py 2022-05-28 11:16:02.000000000 +0200
3+
+++ pyjnius/jnius/env.py 2022-05-28 11:18:30.000000000 +0200
4+
@@ -268,7 +268,7 @@
5+
6+
class AndroidJavaLocation(UnixJavaLocation):
7+
def get_libraries(self):
8+
- return ['SDL2', 'log']
9+
+ return ['SDL3', 'log']
10+
11+
def get_include_dirs(self):
12+
# When cross-compiling for Android, we should not use the include dirs
13+
diff -Naur pyjnius.orig/jnius/jnius_jvm_android.pxi pyjnius/jnius/jnius_jvm_android.pxi
14+
--- pyjnius.orig/jnius/jnius_jvm_android.pxi 2022-05-28 11:16:02.000000000 +0200
15+
+++ pyjnius/jnius/jnius_jvm_android.pxi 2022-05-28 11:17:17.000000000 +0200
16+
@@ -1,6 +1,6 @@
17+
# on android, rely on SDL to get the JNI env
18+
-cdef extern JNIEnv *SDL_AndroidGetJNIEnv()
19+
+cdef extern JNIEnv *SDL_GetAndroidJNIEnv()
20+
21+
22+
cdef JNIEnv *get_platform_jnienv() except NULL:
23+
- return <JNIEnv*>SDL_AndroidGetJNIEnv()
24+
+ return <JNIEnv*>SDL_GetAndroidJNIEnv()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -Naur SDL3_mixer.orig/Android.mk SDL3_mixer/Android.mk
2+
--- SDL3_mixer.orig/Android.mk 2025-03-16 21:05:19
3+
+++ SDL3_mixer/Android.mk 2025-03-16 21:06:33
4+
@@ -31,7 +31,7 @@
5+
WAVPACK_LIBRARY_PATH := external/wavpack
6+
7+
# Enable this if you want to support loading music via libgme
8+
-SUPPORT_GME ?= true
9+
+SUPPORT_GME ?= false
10+
GME_LIBRARY_PATH := external/libgme
11+
12+
# Enable this if you want to support loading MOD music via XMP-lite

0 commit comments

Comments
 (0)