diff --git a/ci/constants.py b/ci/constants.py index 52a996c90f..cc1d9ea70a 100644 --- a/ci/constants.py +++ b/ci/constants.py @@ -41,6 +41,8 @@ class TargetPython(Enum): 'libtorrent', # pybind11 build fails on macos 'pybind11', + # pygame (likely need to be updated) is broken with newer SDL2 versions + 'pygame', ]) BROKEN_RECIPES = { diff --git a/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch b/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch index 71d2537e7c..434be4e8ba 100644 --- a/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch +++ b/pythonforandroid/bootstraps/sdl2/build/src/patches/SDLActivity.java.patch @@ -1,18 +1,19 @@ --- a/src/main/java/org/libsdl/app/SDLActivity.java +++ b/src/main/java/org/libsdl/app/SDLActivity.java -@@ -222,6 +222,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -221,6 +221,8 @@ + // This is what SDL runs in. It invokes SDL_main(), eventually protected static Thread mSDLThread; - -+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + ++ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + protected static SDLGenericMotionListener_API12 getMotionListener() { if (mMotionListener == null) { - if (Build.VERSION.SDK_INT >= 26) { -@@ -324,6 +326,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -323,6 +325,15 @@ + Log.v(TAG, "Model: " + Build.MODEL); Log.v(TAG, "onCreate()"); super.onCreate(savedInstanceState); - ++ + SDLActivity.initialize(); + // So we can call stuff from static callbacks + mSingleton = this; @@ -21,11 +22,10 @@ + // We don't do this in onCreate because we unpack and load the app data on a thread + // and we can't run setup tasks until that thread completes. + protected void finishLoad() { -+ + try { Thread.currentThread().setName("SDLActivity"); - } catch (Exception e) { -@@ -835,7 +846,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -837,7 +848,7 @@ Handler commandHandler = new SDLCommandHandler(); // Send a message from the SDLMain thread @@ -34,28 +34,30 @@ Message msg = commandHandler.obtainMessage(); msg.arg1 = command; msg.obj = data; -@@ -1384,6 +1395,20 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh +@@ -1385,7 +1396,22 @@ + return null; + } return SDLActivity.mSurface.getNativeSurface(); ++ } ++ ++ /** ++ * Calls turnActive() on singleton to keep loading screen active ++ */ ++ public static void triggerAppConfirmedActive() { ++ mSingleton.appConfirmedActive(); } - -+ /** -+ * Calls turnActive() on singleton to keep loading screen active -+ */ -+ public static void triggerAppConfirmedActive() { -+ mSingleton.appConfirmedActive(); -+ } ++ ++ /** ++ * Trick needed for loading screen, overridden by PythonActivity ++ * to keep loading screen active ++ */ ++ public void appConfirmedActive() { ++ } + -+ /** -+ * Trick needed for loading screen, overridden by PythonActivity -+ * to keep loading screen active -+ */ -+ public void appConfirmedActive() { -+ } -+ + // Input - /** -@@ -1878,6 +1903,7 @@ class SDLMain implements Runnable { +@@ -1881,6 +1907,7 @@ Log.v("SDL", "Running main function " + function + " from library " + library); @@ -63,7 +65,7 @@ SDLActivity.nativeRunMain(library, function, arguments); Log.v("SDL", "Finished main function"); -@@ -1935,8 +1961,7 @@ class DummyEdit extends View implements View.OnKeyListener { +@@ -1938,8 +1965,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); diff --git a/pythonforandroid/recipes/kivy/__init__.py b/pythonforandroid/recipes/kivy/__init__.py index ebf7b29e82..a2dc8798ae 100644 --- a/pythonforandroid/recipes/kivy/__init__.py +++ b/pythonforandroid/recipes/kivy/__init__.py @@ -66,9 +66,10 @@ def get_recipe_env(self, arch): env['USE_SDL2'] = '1' env['KIVY_SPLIT_EXAMPLES'] = '1' sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx) + sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx) env['KIVY_SDL2_PATH'] = ':'.join([ join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'), - join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), + *sdl2_image_recipe.get_include_dirs(arch), *sdl2_mixer_recipe.get_include_dirs(arch), join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), ]) diff --git a/pythonforandroid/recipes/pygame/__init__.py b/pythonforandroid/recipes/pygame/__init__.py index 99124deff7..b77240e1b9 100644 --- a/pythonforandroid/recipes/pygame/__init__.py +++ b/pythonforandroid/recipes/pygame/__init__.py @@ -42,13 +42,18 @@ def prebuild_arch(self, arch): for include_dir in sdl2_mixer_recipe.get_include_dirs(arch): sdl_mixer_includes += f"-I{include_dir} " + sdl2_image_includes = "" + sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx) + for include_dir in sdl2_image_recipe.get_include_dirs(arch): + sdl2_image_includes += f"-I{include_dir} " + setup_file = setup_template.format( sdl_includes=( " -I" + join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include') + " -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch)) + " -L" + png_lib_dir + " -L" + jpeg_lib_dir + " -L" + arch.ndk_lib_dir_versioned), sdl_ttf_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), - sdl_image_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'), + sdl_image_includes=sdl2_image_includes, sdl_mixer_includes=sdl_mixer_includes, jpeg_includes="-I"+jpeg_inc_dir, png_includes="-I"+png_inc_dir, diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py index e04458a793..8d5fbc2dc2 100644 --- a/pythonforandroid/recipes/sdl2/__init__.py +++ b/pythonforandroid/recipes/sdl2/__init__.py @@ -6,16 +6,14 @@ class LibSDL2Recipe(BootstrapNDKRecipe): - version = "2.26.1" + version = "2.28.5" url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL2-{version}.tar.gz" - md5sum = 'fba211fe2c67609df6fa3cf55d3c74dc' + md5sum = 'a344eb827a03045c9b399e99af4af13d' dir_name = 'SDL' depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf'] - patches = ['sdl-orientation-pr-6984.diff'] - def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True): env = super().get_recipe_env( arch=arch, with_flags_in_cc=with_flags_in_cc, with_python=with_python) diff --git a/pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff b/pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff deleted file mode 100644 index bbe2ca2243..0000000000 --- a/pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java -index 2d7d69b76a25..edb42fb55461 100644 ---- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java -+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java -@@ -971,15 +971,18 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint) - /* If set, hint "explicitly controls which UI orientations are allowed". */ - if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { - orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; -- } else if (hint.contains("LandscapeRight")) { -- orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - } else if (hint.contains("LandscapeLeft")) { -+ orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; -+ } else if (hint.contains("LandscapeRight")) { - orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - } - -- if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) { -+ /* exact match to 'Portrait' to distinguish with PortraitUpsideDown */ -+ boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait"); -+ -+ if (contains_Portrait && hint.contains("PortraitUpsideDown")) { - orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; -- } else if (hint.contains("Portrait")) { -+ } else if (contains_Portrait) { - orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - } else if (hint.contains("PortraitUpsideDown")) { - orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; diff --git a/pythonforandroid/recipes/sdl2_image/__init__.py b/pythonforandroid/recipes/sdl2_image/__init__.py index a91c6f1bc2..b3ac504fbf 100644 --- a/pythonforandroid/recipes/sdl2_image/__init__.py +++ b/pythonforandroid/recipes/sdl2_image/__init__.py @@ -6,12 +6,17 @@ class LibSDL2Image(BootstrapNDKRecipe): - version = '2.6.2' + version = '2.8.0' url = 'https://github.com/libsdl-org/SDL_image/releases/download/release-{version}/SDL2_image-{version}.tar.gz' dir_name = 'SDL2_image' patches = ['enable-webp.patch'] + def get_include_dirs(self, arch): + return [ + os.path.join(self.ctx.bootstrap.build_dir, "jni", "SDL2_image", "include") + ] + def prebuild_arch(self, arch): # We do not have a folder for each arch on BootstrapNDKRecipe, so we # need to skip the external deps download if we already have done it. diff --git a/pythonforandroid/recipes/sdl2_mixer/__init__.py b/pythonforandroid/recipes/sdl2_mixer/__init__.py index 0f02c4c3a4..a00c267d49 100644 --- a/pythonforandroid/recipes/sdl2_mixer/__init__.py +++ b/pythonforandroid/recipes/sdl2_mixer/__init__.py @@ -4,7 +4,7 @@ class LibSDL2Mixer(BootstrapNDKRecipe): - version = '2.6.2' + version = '2.6.3' url = 'https://github.com/libsdl-org/SDL_mixer/releases/download/release-{version}/SDL2_mixer-{version}.tar.gz' dir_name = 'SDL2_mixer' diff --git a/pythonforandroid/recipes/sdl2_ttf/__init__.py b/pythonforandroid/recipes/sdl2_ttf/__init__.py index 4934bd4a67..9f97ae441c 100644 --- a/pythonforandroid/recipes/sdl2_ttf/__init__.py +++ b/pythonforandroid/recipes/sdl2_ttf/__init__.py @@ -2,7 +2,7 @@ class LibSDL2TTF(BootstrapNDKRecipe): - version = '2.20.1' + version = '2.20.2' url = 'https://github.com/libsdl-org/SDL_ttf/releases/download/release-{version}/SDL2_ttf-{version}.tar.gz' dir_name = 'SDL2_ttf'