forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path__init__.py
More file actions
42 lines (30 loc) · 1.38 KB
/
__init__.py
File metadata and controls
42 lines (30 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from os.path import exists, join
from pythonforandroid.recipe import BootstrapNDKRecipe
from pythonforandroid.toolchain import current_directory, shprint
import sh
class LibSDL2Recipe(BootstrapNDKRecipe):
version = "2.30.11"
url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL2-{version}.tar.gz"
md5sum = 'bea190b480f6df249db29eb3bacfe41e'
conflicts = ['sdl3']
dir_name = 'SDL'
depends = ['sdl2_image', 'sdl2_mixer', 'sdl2_ttf']
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)
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 = ['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)
with current_directory(self.get_jni_dir()):
shprint(
sh.Command(join(self.ctx.ndk_dir, "ndk-build")),
"V=1",
"NDK_DEBUG=" + ("1" if self.ctx.build_as_debuggable else "0"),
_env=env
)
recipe = LibSDL2Recipe()