|
| 1 | +from pythonforandroid.toolchain import NDKRecipe, current_directory, shprint, info |
| 2 | +from os.path import exists, join |
| 3 | +import sh |
| 4 | +import glob |
| 5 | + |
| 6 | +class PygameJNIComponentsRecipe(NDKRecipe): |
| 7 | + version = 'master' |
| 8 | + url = 'https://github.com/inclement/p4a-pygame_sdl2_bootstrap_components/archive/{version}.zip' |
| 9 | + dir_name = 'pygame_sdl2_bootstrap_components' |
| 10 | + |
| 11 | + def prebuild_arch(self, arch): |
| 12 | + super(PygameJNIComponentsRecipe, self).postbuild_arch(arch) |
| 13 | + |
| 14 | + info('Unpacking pygame_sdl2 bootstrap JNI dir components') |
| 15 | + with current_directory(self.get_build_container_dir(arch)): |
| 16 | + if exists('sdl2_gfx'): |
| 17 | + info('sdl2_gfx dir exists, so it looks like the JNI components' + |
| 18 | + 'are already unpacked. Skipping.') |
| 19 | + return |
| 20 | + for dirn in glob.glob(join(self.get_build_dir(arch), |
| 21 | + 'pygame_sdl2_bootstrap_jni', '*')): |
| 22 | + shprint(sh.mv, dirn, './') |
| 23 | + info('Unpacking was successful, deleting original container dir') |
| 24 | + shprint(sh.rm, '-rf', self.get_build_dir(arch)) |
| 25 | + |
| 26 | + # def build_arch(self, arch): |
| 27 | + # env = self.get_recipe_env(arch) |
| 28 | + |
| 29 | + # with current_directory(self.get_jni_dir()): |
| 30 | + # shprint(sh.ndk_build, "V=1", _env=env) |
| 31 | + |
| 32 | + |
| 33 | +recipe = PygameJNIComponentsRecipe() |
0 commit comments