From 3012da052281558a25985a43115a8b4f60ceb8e4 Mon Sep 17 00:00:00 2001 From: AnGlonchas <128877120+AnGlonchas@users.noreply.github.com> Date: Sun, 26 Nov 2023 14:10:27 -0700 Subject: [PATCH 1/4] Create init.py --- pythonforandroid/recipes/pygame-ce/init.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 pythonforandroid/recipes/pygame-ce/init.py diff --git a/pythonforandroid/recipes/pygame-ce/init.py b/pythonforandroid/recipes/pygame-ce/init.py new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/pythonforandroid/recipes/pygame-ce/init.py @@ -0,0 +1 @@ + From fc45927e409c1e8c2a55f076e480ca05e8dbd950 Mon Sep 17 00:00:00 2001 From: AnGlonchas <128877120+AnGlonchas@users.noreply.github.com> Date: Sun, 26 Nov 2023 14:10:50 -0700 Subject: [PATCH 2/4] Add files via upload --- .../recipes/pygame-ce/__init__.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 pythonforandroid/recipes/pygame-ce/__init__.py diff --git a/pythonforandroid/recipes/pygame-ce/__init__.py b/pythonforandroid/recipes/pygame-ce/__init__.py new file mode 100644 index 0000000000..876951a6ab --- /dev/null +++ b/pythonforandroid/recipes/pygame-ce/__init__.py @@ -0,0 +1,67 @@ +from os.path import join + +from pythonforandroid.recipe import CompiledComponentsPythonRecipe +from pythonforandroid.toolchain import current_directory + + +class Pygame2Recipe(CompiledComponentsPythonRecipe): + """ + Recipe to build apps based on SDL2-based pygame. + + .. warning:: Some pygame functionality is still untested, and some + dependencies like freetype, postmidi and libjpeg are currently + not part of the build. It's usable, but not complete. + """ + + version = '2.3.2' + url = 'https://github.com/pygame-community/pygame-ce/archive/{version}.tar.gz' + + site_packages_name = 'pygame-ce' + name = 'pygame-ce' + + depends = ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'setuptools', 'jpeg', 'png'] + call_hostpython_via_targetpython = False # Due to setuptools + install_in_hostpython = False + + def prebuild_arch(self, arch): + super().prebuild_arch(arch) + with current_directory(self.get_build_dir(arch.arch)): + setup_template = open(join("buildconfig", "Setup.Android.SDL2.in")).read() + env = self.get_recipe_env(arch) + env['ANDROID_ROOT'] = join(self.ctx.ndk.sysroot, 'usr') + + png = self.get_recipe('png', self.ctx) + png_lib_dir = join(png.get_build_dir(arch.arch), '.libs') + png_inc_dir = png.get_build_dir(arch) + + jpeg = self.get_recipe('jpeg', self.ctx) + jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch) + + sdl_mixer_includes = "" + sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx) + for include_dir in sdl2_mixer_recipe.get_include_dirs(arch): + sdl_mixer_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_mixer_includes=sdl_mixer_includes, + jpeg_includes="-I"+jpeg_inc_dir, + png_includes="-I"+png_inc_dir, + freetype_includes="" + ) + open("Setup", "w").write(setup_file) + + def get_recipe_env(self, arch): + env = super().get_recipe_env(arch) + env['USE_SDL2'] = '1' + env["PYGAME_CROSS_COMPILE"] = "TRUE" + env["PYGAME_ANDROID"] = "TRUE" + return env + + +recipe = Pygame2Recipe() From 43f3599423cac85c8a6732a457f73bbf3c3b4c0c Mon Sep 17 00:00:00 2001 From: AnGlonchas <128877120+AnGlonchas@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:15:52 -0600 Subject: [PATCH 3/4] Delete pythonforandroid/recipes/pygame-ce/init.py --- pythonforandroid/recipes/pygame-ce/init.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 pythonforandroid/recipes/pygame-ce/init.py diff --git a/pythonforandroid/recipes/pygame-ce/init.py b/pythonforandroid/recipes/pygame-ce/init.py deleted file mode 100644 index 8b13789179..0000000000 --- a/pythonforandroid/recipes/pygame-ce/init.py +++ /dev/null @@ -1 +0,0 @@ - From a54e9af8dcb5616f361c74cd2fbc5cb4c7ae952b Mon Sep 17 00:00:00 2001 From: AnGlonchas <128877120+AnGlonchas@users.noreply.github.com> Date: Sun, 11 Feb 2024 10:36:56 -0600 Subject: [PATCH 4/4] Update __init__.py --- pythonforandroid/recipes/pygame-ce/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonforandroid/recipes/pygame-ce/__init__.py b/pythonforandroid/recipes/pygame-ce/__init__.py index 876951a6ab..59ebff561c 100644 --- a/pythonforandroid/recipes/pygame-ce/__init__.py +++ b/pythonforandroid/recipes/pygame-ce/__init__.py @@ -13,7 +13,7 @@ class Pygame2Recipe(CompiledComponentsPythonRecipe): not part of the build. It's usable, but not complete. """ - version = '2.3.2' + version = '2.4.0' url = 'https://github.com/pygame-community/pygame-ce/archive/{version}.tar.gz' site_packages_name = 'pygame-ce'