Skip to content

Commit 66ba3e5

Browse files
authored
Update sdl2 deps to reflect the same targeted in kivy/kivy (kivy#2927)
* Update sdl2 deps to reflect the same targeted in kivy/kivy * Update md5 sum * Create new patch and set new include dir for sdl_image * Set pygame as broken recipe * sdl_image 2.8.0 has been released
1 parent d35c70a commit 66ba3e5

File tree

9 files changed

+49
-63
lines changed

9 files changed

+49
-63
lines changed

ci/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class TargetPython(Enum):
4141
'libtorrent',
4242
# pybind11 build fails on macos
4343
'pybind11',
44+
# pygame (likely need to be updated) is broken with newer SDL2 versions
45+
'pygame',
4446
])
4547

4648
BROKEN_RECIPES = {

pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
--- a/src/main/java/org/libsdl/app/SDLActivity.java
22
+++ b/src/main/java/org/libsdl/app/SDLActivity.java
3-
@@ -222,6 +222,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
3+
@@ -221,6 +221,8 @@
4+
45
// This is what SDL runs in. It invokes SDL_main(), eventually
56
protected static Thread mSDLThread;
6-
7-
+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
87
+
8+
+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
9+
910
protected static SDLGenericMotionListener_API12 getMotionListener() {
1011
if (mMotionListener == null) {
11-
if (Build.VERSION.SDK_INT >= 26) {
12-
@@ -324,6 +326,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
12+
@@ -323,6 +325,15 @@
13+
Log.v(TAG, "Model: " + Build.MODEL);
1314
Log.v(TAG, "onCreate()");
1415
super.onCreate(savedInstanceState);
15-
16+
+
1617
+ SDLActivity.initialize();
1718
+ // So we can call stuff from static callbacks
1819
+ mSingleton = this;
@@ -21,11 +22,10 @@
2122
+ // We don't do this in onCreate because we unpack and load the app data on a thread
2223
+ // and we can't run setup tasks until that thread completes.
2324
+ protected void finishLoad() {
24-
+
25+
2526
try {
2627
Thread.currentThread().setName("SDLActivity");
27-
} catch (Exception e) {
28-
@@ -835,7 +846,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
28+
@@ -837,7 +848,7 @@
2929
Handler commandHandler = new SDLCommandHandler();
3030

3131
// Send a message from the SDLMain thread
@@ -34,36 +34,38 @@
3434
Message msg = commandHandler.obtainMessage();
3535
msg.arg1 = command;
3636
msg.obj = data;
37-
@@ -1384,6 +1395,20 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
37+
@@ -1385,7 +1396,22 @@
38+
return null;
39+
}
3840
return SDLActivity.mSurface.getNativeSurface();
41+
+ }
42+
+
43+
+ /**
44+
+ * Calls turnActive() on singleton to keep loading screen active
45+
+ */
46+
+ public static void triggerAppConfirmedActive() {
47+
+ mSingleton.appConfirmedActive();
3948
}
40-
41-
+ /**
42-
+ * Calls turnActive() on singleton to keep loading screen active
43-
+ */
44-
+ public static void triggerAppConfirmedActive() {
45-
+ mSingleton.appConfirmedActive();
46-
+ }
49+
+
50+
+ /**
51+
+ * Trick needed for loading screen, overridden by PythonActivity
52+
+ * to keep loading screen active
53+
+ */
54+
+ public void appConfirmedActive() {
55+
+ }
4756
+
48-
+ /**
49-
+ * Trick needed for loading screen, overridden by PythonActivity
50-
+ * to keep loading screen active
51-
+ */
52-
+ public void appConfirmedActive() {
53-
+ }
54-
+
57+
5558
// Input
5659

57-
/**
58-
@@ -1878,6 +1903,7 @@ class SDLMain implements Runnable {
60+
@@ -1881,6 +1907,7 @@
5961

6062
Log.v("SDL", "Running main function " + function + " from library " + library);
6163

6264
+ SDLActivity.mSingleton.appConfirmedActive();
6365
SDLActivity.nativeRunMain(library, function, arguments);
6466

6567
Log.v("SDL", "Finished main function");
66-
@@ -1935,8 +1961,7 @@ class DummyEdit extends View implements View.OnKeyListener {
68+
@@ -1938,8 +1965,7 @@
6769
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
6870
ic = new SDLInputConnection(this, true);
6971

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ def get_recipe_env(self, arch):
6666
env['USE_SDL2'] = '1'
6767
env['KIVY_SPLIT_EXAMPLES'] = '1'
6868
sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
69+
sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
6970
env['KIVY_SDL2_PATH'] = ':'.join([
7071
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
71-
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
72+
*sdl2_image_recipe.get_include_dirs(arch),
7273
*sdl2_mixer_recipe.get_include_dirs(arch),
7374
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
7475
])

pythonforandroid/recipes/pygame/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ def prebuild_arch(self, arch):
4242
for include_dir in sdl2_mixer_recipe.get_include_dirs(arch):
4343
sdl_mixer_includes += f"-I{include_dir} "
4444

45+
sdl2_image_includes = ""
46+
sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
47+
for include_dir in sdl2_image_recipe.get_include_dirs(arch):
48+
sdl2_image_includes += f"-I{include_dir} "
49+
4550
setup_file = setup_template.format(
4651
sdl_includes=(
4752
" -I" + join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include') +
4853
" -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch)) +
4954
" -L" + png_lib_dir + " -L" + jpeg_lib_dir + " -L" + arch.ndk_lib_dir_versioned),
5055
sdl_ttf_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
51-
sdl_image_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
56+
sdl_image_includes=sdl2_image_includes,
5257
sdl_mixer_includes=sdl_mixer_includes,
5358
jpeg_includes="-I"+jpeg_inc_dir,
5459
png_includes="-I"+png_inc_dir,

pythonforandroid/recipes/sdl2/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66

77

88
class LibSDL2Recipe(BootstrapNDKRecipe):
9-
version = "2.26.1"
9+
version = "2.28.5"
1010
url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL2-{version}.tar.gz"
11-
md5sum = 'fba211fe2c67609df6fa3cf55d3c74dc'
11+
md5sum = 'a344eb827a03045c9b399e99af4af13d'
1212

1313
dir_name = 'SDL'
1414

1515
depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf']
1616

17-
patches = ['sdl-orientation-pr-6984.diff']
18-
1917
def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True):
2018
env = super().get_recipe_env(
2119
arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python)

pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff

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

pythonforandroid/recipes/sdl2_image/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66

77

88
class LibSDL2Image(BootstrapNDKRecipe):
9-
version = '2.6.2'
9+
version = '2.8.0'
1010
url = 'https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL2_image-{version}.tar.gz'
1111
dir_name = 'SDL2_image'
1212

1313
patches = ['enable-webp.patch']
1414

15+
def get_include_dirs(self, arch):
16+
return [
17+
os.path.join(self.ctx.bootstrap.build_dir, "jni", "SDL2_image", "include")
18+
]
19+
1520
def prebuild_arch(self, arch):
1621
# We do not have a folder for each arch on BootstrapNDKRecipe, so we
1722
# need to skip the external deps download if we already have done it.

pythonforandroid/recipes/sdl2_mixer/__init__.py

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

55

66
class LibSDL2Mixer(BootstrapNDKRecipe):
7-
version = '2.6.2'
7+
version = '2.6.3'
88
url = 'https://github.com/libsdl-org/SDL_mixer/releases/download/release-{version}/SDL2_mixer-{version}.tar.gz'
99
dir_name = 'SDL2_mixer'
1010

pythonforandroid/recipes/sdl2_ttf/__init__.py

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

33

44
class LibSDL2TTF(BootstrapNDKRecipe):
5-
version = '2.20.1'
5+
version = '2.20.2'
66
url = 'https://github.com/libsdl-org/SDL_ttf/releases/download/release-{version}/SDL2_ttf-{version}.tar.gz'
77
dir_name = 'SDL2_ttf'
88

0 commit comments

Comments
 (0)