forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
59 lines (46 loc) · 1.71 KB
/
__init__.py
File metadata and controls
59 lines (46 loc) · 1.71 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from os.path import exists, join
from pythonforandroid.recipe import BootstrapNDKRecipe
from pythonforandroid.toolchain import current_directory, shprint
import sh
class LibSDL3Recipe(BootstrapNDKRecipe):
version = "3.4.2"
url = "https://github.com/libsdl-org/SDL/releases/download/release-{version}/SDL3-{version}.tar.gz"
md5sum = "b488ea1ede947c06855588314effe905"
conflicts = ["sdl2"]
dir_name = "SDL"
depends = ["sdl3_image", "sdl3_mixer", "sdl3_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 get_include_dirs(self, arch):
return [
join(self.ctx.bootstrap.build_dir, "jni", "SDL", "include"),
join(self.ctx.bootstrap.build_dir, "jni", "SDL", "include", "SDL3"),
]
def should_build(self, arch):
libdir = join(self.get_build_dir(arch.arch), "../..", "libs", arch.arch)
libs = [
"libmain.so",
"libSDL3.so",
"libSDL3_image.so",
"libSDL3_mixer.so",
"libSDL3_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 = LibSDL3Recipe()