Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sdl2 deps to reflect the same targeted in kivy/kivy #2927

Merged
merged 5 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand All @@ -34,36 +34,38 @@
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);

+ SDLActivity.mSingleton.appConfirmedActive();
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);

Expand Down
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/kivy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
])
Expand Down
7 changes: 6 additions & 1 deletion pythonforandroid/recipes/pygame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions pythonforandroid/recipes/sdl2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 0 additions & 27 deletions pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff

This file was deleted.

7 changes: 6 additions & 1 deletion pythonforandroid/recipes/sdl2_image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/sdl2_mixer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/sdl2_ttf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down