Skip to content

Commit a10cd13

Browse files
author
Robert Pfeiffer
committed
include more dependencies
1 parent 1538c89 commit a10cd13

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed
Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,58 @@
11
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
22
from os.path import join
3-
from shutil import copyfile
43
from pythonforandroid.toolchain import current_directory
5-
import glob
4+
65

76
class Pygame2Recipe(CompiledComponentsPythonRecipe):
87

9-
version = '2.0.0-dev5'
8+
version = '2.0.0-dev7'
109
url = 'https://github.com/pygame/pygame/archive/android.zip'
1110

1211
site_packages_name = 'pygame'
1312
name = 'pygame2'
1413

15-
depends = ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'setuptools']
14+
depends = ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'setuptools', 'jpeg', 'png']
1615
call_hostpython_via_targetpython = False # Due to setuptools
1716
install_in_hostpython = False
1817

19-
def cythonize_file(self, env, build_dir, filename):
20-
# We can ignore a few files that aren't important to the
21-
# android build, and may not work on Android anyway
22-
do_not_cythonize = []
23-
if basename(filename) in do_not_cythonize:
24-
return
25-
super(Pygame2Recipe, self).cythonize_file(env, build_dir, filename)
26-
2718
def prebuild_arch(self, arch):
2819
super(Pygame2Recipe, self).prebuild_arch(arch)
2920
with current_directory(self.get_build_dir(arch.arch)):
30-
setup_template=open(join("buildconfig", "Setup.Android.SDL2.in")).read()
31-
env=self.get_recipe_env(arch)
32-
setup_file=setup_template.format(
21+
setup_template = open(join("buildconfig", "Setup.Android.SDL2.in")).read()
22+
env = self.get_recipe_env(arch)
23+
env['ANDROID_ROOT'] = join(self.ctx.ndk_platform, 'usr')
24+
25+
ndk_lib_dir = join(self.ctx.ndk_platform, 'usr', 'lib')
26+
ndk_include_dir = join(self.ctx.ndk_dir, 'sysroot', 'usr', 'include')
27+
28+
png = self.get_recipe('png', self.ctx)
29+
png_lib_dir = join(png.get_build_dir(arch.arch), '.libs')
30+
png_inc_dir = png.get_build_dir(arch)
31+
32+
jpeg = self.get_recipe('jpeg', self.ctx)
33+
jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch)
34+
35+
setup_file = setup_template.format(
3336
sdl_includes=(
3437
" -I" + join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include') +
35-
" -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch))),
36-
sdl_ttf_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
38+
" -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch)) +
39+
" -L" + png_lib_dir+ " -L" + jpeg_lib_dir+ " -L" + ndk_lib_dir ),
40+
sdl_ttf_includes=" -I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
3741
sdl_image_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
38-
sdl_mixer_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'))
42+
sdl_mixer_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'),
43+
jpeg_includes="-I"+jpeg_inc_dir,
44+
png_includes="-I"+png_inc_dir,
45+
freetype_includes=""
46+
)
3947
open("Setup", "w").write(setup_file)
4048

4149
def get_recipe_env(self, arch):
4250
env = super(Pygame2Recipe, self).get_recipe_env(arch)
4351
if 'sdl2' in self.ctx.recipe_build_order:
4452
env['USE_SDL2'] = '1'
45-
46-
env["PYGAME_CROSS_COMPILE"]="TRUE"
47-
env["PYGAME_ANDROID"]="TRUE"
53+
env["PYGAME_CROSS_COMPILE"] = "TRUE"
54+
env["PYGAME_ANDROID"] = "TRUE"
4855
return env
49-
56+
57+
5058
recipe = Pygame2Recipe()

0 commit comments

Comments
 (0)