From 9875ff41803e89f2e97c9385abd8c7415b247260 Mon Sep 17 00:00:00 2001 From: AndyRusso <88431411+AndyRusso@users.noreply.github.com> Date: Thu, 5 Aug 2021 16:03:22 +0500 Subject: [PATCH] Add should_build method to sdl2 recipe Hello. When making a distribution, sdl2 always builds all over and it takes a lot of time. This pull request changes it, by adding a should_build method to the sdl2 recipe. --- pythonforandroid/recipes/sdl2/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pythonforandroid/recipes/sdl2/__init__.py b/pythonforandroid/recipes/sdl2/__init__.py index 830e9dde44..a519087182 100644 --- a/pythonforandroid/recipes/sdl2/__init__.py +++ b/pythonforandroid/recipes/sdl2/__init__.py @@ -1,3 +1,5 @@ +from os.path import exists, join + from pythonforandroid.recipe import BootstrapNDKRecipe from pythonforandroid.toolchain import current_directory, shprint import sh @@ -18,6 +20,15 @@ def get_recipe_env(self, arch=None, with_flags_in_cc=True, with_python=True): env['APP_ALLOW_MISSING_DEPS'] = 'true' return env + def should_build(self, arch): + libdir = join( + self.get_build_dir(arch.arch), + '../..', + 'libs', arch.arch + ) + libs = ['libhidapi.so', 'libmain.so', 'libSDL2.so', 'libSDL2_image.so', 'libSDL2_mixer.so', 'libSDL2_ttf.so'] + return not all(exists(join(libdir, x)) for x in libs) + def build_arch(self, arch): env = self.get_recipe_env(arch)