Skip to content

Commit ec40afd

Browse files
committed
Updated Kivy recipe to work with Kivy master
1 parent ef6a2c5 commit ec40afd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,41 @@ class KivyRecipe(CythonRecipe):
1515

1616
# patches = ['setargv.patch']
1717

18+
def cythonize_build(self, env, build_dir='.'):
19+
super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir)
20+
21+
if not exists(join(build_dir, 'kivy', 'include')):
22+
return
23+
24+
# If kivy is new enough to use the include dir, copy it
25+
# manually to the right location as we bypass this stage of
26+
# the build
27+
with current_directory(build_dir):
28+
build_libs_dirs = glob.glob(join('build', 'lib.*'))
29+
30+
for dirn in build_libs_dirs:
31+
shprint(sh.cp, '-r', join('kivy', 'include'),
32+
join(dirn, 'kivy'))
33+
1834
def get_recipe_env(self, arch):
1935
env = super(KivyRecipe, self).get_recipe_env(arch)
2036
if 'sdl2' in self.ctx.recipe_build_order:
37+
env['CUR_ARCH'] = arch.arch
2138
env['USE_SDL2'] = '1'
2239
env['KIVY_SDL2_PATH'] = ':'.join([
2340
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
2441
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
2542
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'),
2643
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
2744
])
45+
46+
# Set include dir for pxi files - Kivy normally handles this
47+
# in the setup.py invocation, but we skip this
48+
build_dir = self.get_build_dir(arch.arch)
49+
self.cython_args = ['-I{}'.format(join(build_dir, 'kivy', 'include'))]
50+
51+
env['CFLAGS'] += ' -I{}'.format(join(build_dir, 'kivy', 'include'))
52+
2853
return env
2954

3055
recipe = KivyRecipe()

0 commit comments

Comments
 (0)