2020-05-03 16:23:08 +02:00
|
|
|
from kivy_ios.toolchain import CythonRecipe
|
2015-02-25 18:51:03 +01:00
|
|
|
from os.path import join
|
2019-09-22 23:25:18 +02:00
|
|
|
import logging
|
2019-09-28 18:04:36 +02:00
|
|
|
import shutil
|
2019-09-22 23:25:18 +02:00
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
2015-02-09 11:58:44 +01:00
|
|
|
|
|
|
|
|
2015-02-25 18:51:03 +01:00
|
|
|
class KivyRecipe(CythonRecipe):
|
2020-04-25 20:12:59 +02:00
|
|
|
"""
|
|
|
|
post kivy 2.0.0rc1
|
|
|
|
Includes these iOS specific fixes:
|
|
|
|
- Statusbar / Fullscreen fix (PR #4589)
|
|
|
|
- Extend usage of certifi on iOS (PR #4648)
|
|
|
|
"""
|
|
|
|
version = "067064c23a275187e67f1c9d7de7cc06f384af4d"
|
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"
|
2018-11-02 11:44:25 +01:00
|
|
|
depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",
|
2020-04-29 23:43:07 +02:00
|
|
|
"pyobjus", "python", "host_setuptools3"]
|
2019-09-22 19:56:58 +02:00
|
|
|
pbx_frameworks = ["OpenGLES", "Accelerate", "CoreMedia", "CoreVideo"]
|
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")
|
2020-04-27 07:29:11 +02:00
|
|
|
|
2015-02-09 23:34:02 +01:00
|
|
|
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']")
|
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)
|
|
|
|
|
2019-09-28 18:04:36 +02:00
|
|
|
def reduce_python_package(self):
|
|
|
|
dest_dir = join(self.ctx.site_packages_dir, "kivy")
|
|
|
|
shutil.rmtree(join(dest_dir, "tools"))
|
|
|
|
shutil.rmtree(join(dest_dir, "tests"))
|
2019-09-22 16:48:49 +02:00
|
|
|
|
2015-02-09 11:58:44 +01:00
|
|
|
|
|
|
|
recipe = KivyRecipe()
|