2015-02-25 18:51:03 +01:00
|
|
|
from toolchain import CythonRecipe
|
|
|
|
from os.path import join
|
2015-02-09 11:58:44 +01:00
|
|
|
|
|
|
|
|
2015-02-25 18:51:03 +01:00
|
|
|
class KivyRecipe(CythonRecipe):
|
2016-01-14 09:52:49 +01:00
|
|
|
version = "1.9.1"
|
2015-02-09 11:58:44 +01:00
|
|
|
url = "https://github.com/kivy/kivy/archive/{version}.zip"
|
2015-02-09 23:34:02 +01:00
|
|
|
library = "libkivy.a"
|
2016-12-14 12:42:57 +01:00
|
|
|
depends = ["python", "sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",
|
|
|
|
"pyobjus"]
|
2015-02-23 11:34:36 +01:00
|
|
|
pbx_frameworks = ["OpenGLES", "Accelerate"]
|
2015-02-25 13:37:52 +01:00
|
|
|
pre_build_ext = True
|
2015-02-09 11:58:44 +01:00
|
|
|
|
2015-02-25 13:37:52 +01:00
|
|
|
def get_recipe_env(self, arch):
|
|
|
|
env = super(KivyRecipe, self).get_recipe_env(arch)
|
|
|
|
env["KIVY_SDL2_PATH"] = ":".join([
|
2015-02-13 18:39:34 +01:00
|
|
|
join(self.ctx.dist_dir, "include", "common", "sdl2"),
|
|
|
|
join(self.ctx.dist_dir, "include", "common", "sdl2_image"),
|
|
|
|
join(self.ctx.dist_dir, "include", "common", "sdl2_ttf"),
|
|
|
|
join(self.ctx.dist_dir, "include", "common", "sdl2_mixer")])
|
2015-02-25 13:37:52 +01:00
|
|
|
return env
|
2015-02-09 23:34:02 +01:00
|
|
|
|
|
|
|
def build_arch(self, arch):
|
|
|
|
self._patch_setup()
|
2015-02-25 13:37:52 +01:00
|
|
|
super(KivyRecipe, self).build_arch(arch)
|
2015-02-09 23:34:02 +01:00
|
|
|
|
|
|
|
def _patch_setup(self):
|
|
|
|
# patch setup to remove some functionnalities
|
|
|
|
pyconfig = join(self.build_dir, "setup.py")
|
|
|
|
def _remove_line(lines, pattern):
|
|
|
|
for line in lines[:]:
|
|
|
|
if pattern in line:
|
|
|
|
lines.remove(line)
|
|
|
|
with open(pyconfig) as fd:
|
|
|
|
lines = fd.readlines()
|
|
|
|
_remove_line(lines, "flags['libraries'] = ['GLESv2']")
|
2015-02-12 00:53:22 +01:00
|
|
|
#_remove_line(lines, "c_options['use_sdl'] = True")
|
2017-04-29 17:51:42 +02:00
|
|
|
with open(pyconfig, "w") as fd:
|
2015-02-09 23:34:02 +01:00
|
|
|
fd.writelines(lines)
|
|
|
|
|
2015-02-09 11:58:44 +01:00
|
|
|
|
|
|
|
recipe = KivyRecipe()
|
|
|
|
|