recipes: update all Cython/Python recipe to use new classes
This commit is contained in:
parent
c0f5cae59a
commit
f23f86dfef
6 changed files with 47 additions and 252 deletions
|
@ -1,56 +1,13 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import shutil
|
||||
from toolchain import CythonRecipe
|
||||
|
||||
|
||||
class AudiostreamRecipe(Recipe):
|
||||
class AudiostreamRecipe(CythonRecipe):
|
||||
version = "master"
|
||||
url = "https://github.com/kivy/audiostream/archive/{version}.zip"
|
||||
library = "libaudiostream.a"
|
||||
depends = ["python", "sdl2"]
|
||||
pre_build_ext = True
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["CC"] = "{} -I{}".format(
|
||||
build_env["CC"],
|
||||
join(self.ctx.dist_dir, "include", "common", "sdl2"))
|
||||
build_env["ARCH"] = arch.arch
|
||||
return build_env
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
try:
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
except:
|
||||
pass
|
||||
self.cythonize_build()
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "audiostream")
|
||||
shutil.copytree(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "audiostream"),
|
||||
dest_dir)
|
||||
|
||||
recipe = AudiostreamRecipe()
|
||||
|
||||
|
||||
|
|
|
@ -1,66 +1,30 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from toolchain import CythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import fnmatch
|
||||
import shutil
|
||||
|
||||
|
||||
class FFPyplayerRecipe(Recipe):
|
||||
class FFPyplayerRecipe(CythonRecipe):
|
||||
version = "master"
|
||||
url = "https://github.com/tito/ffpyplayer/archive/{version}.zip"
|
||||
url = "https://github.com/matham/ffpyplayer/archive/{version}.zip"
|
||||
library = "libffpyplayer.a"
|
||||
depends = ["python", "ffmpeg"]
|
||||
pbx_frameworks = [
|
||||
"CoreVideo", "CoreMedia", "CoreImage", "AVFoundation", "UIKit",
|
||||
"CoreMotion"]
|
||||
pbx_libraries = ["libiconv"]
|
||||
pre_build_ext = True
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["IOSSDKROOT"] = arch.sysroot
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["CC"] = "{} -I{}".format(
|
||||
build_env["CC"],
|
||||
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["ARCH"] = arch.arch
|
||||
build_env["SDL_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
"common", "sdl2")
|
||||
build_env["FFMPEG_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
arch.arch, "ffmpeg")
|
||||
build_env["CONFIG_POSTPROC"] = "0"
|
||||
return build_env
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(FFPyplayerRecipe, self).get_recipe_env(arch)
|
||||
env["CC"] += " -I{}".format(
|
||||
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
|
||||
env["SDL_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
"common", "sdl2")
|
||||
env["FFMPEG_INCLUDE_DIR"] = join(self.ctx.dist_dir, "include",
|
||||
arch.arch, "ffmpeg")
|
||||
env["CONFIG_POSTPROC"] = "0"
|
||||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
try:
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
except:
|
||||
pass
|
||||
self.cythonize_build()
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "ffpyplayer")
|
||||
shutil.copytree(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "ffpyplayer"),
|
||||
dest_dir)
|
||||
|
||||
recipe = FFPyplayerRecipe()
|
||||
|
||||
|
|
|
@ -1,50 +1,16 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
import sh
|
||||
import os
|
||||
import fnmatch
|
||||
import shutil
|
||||
from toolchain import CythonRecipe
|
||||
|
||||
|
||||
class IosRecipe(Recipe):
|
||||
class IosRecipe(CythonRecipe):
|
||||
version = "master"
|
||||
url = "src"
|
||||
library = "libios.a"
|
||||
depends = ["python"]
|
||||
pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit"]
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["IOSSDKROOT"] = arch.sysroot
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["ARCH"] = arch.arch
|
||||
return build_env
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
self.cythonize_build()
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "ios.so")
|
||||
shutil.copy(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "ios.so"),
|
||||
dest_dir)
|
||||
self.install_python_package(name="ios.so", is_dir=False)
|
||||
|
||||
|
||||
recipe = IosRecipe()
|
||||
|
||||
|
|
|
@ -12,35 +12,20 @@ class KivyRecipe(Recipe):
|
|||
library = "libkivy.a"
|
||||
depends = ["python", "sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios"]
|
||||
pbx_frameworks = ["OpenGLES", "Accelerate"]
|
||||
pre_build_ext = True
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["IOSSDKROOT"] = arch.sysroot
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["ARCH"] = arch.arch
|
||||
build_env["KIVY_SDL2_PATH"] = ":".join([
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(KivyRecipe, self).get_recipe_env(arch)
|
||||
env["KIVY_SDL2_PATH"] = ":".join([
|
||||
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")])
|
||||
return build_env
|
||||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
self._patch_setup()
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
# first try to generate .h
|
||||
try:
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
except:
|
||||
pass
|
||||
self.cythonize_build()
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
super(KivyRecipe, self).build_arch(arch)
|
||||
|
||||
def _patch_setup(self):
|
||||
# patch setup to remove some functionnalities
|
||||
|
@ -56,24 +41,6 @@ class KivyRecipe(Recipe):
|
|||
with open(pyconfig, "wb") as fd:
|
||||
fd.writelines(lines)
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "kivy")
|
||||
if exists(dest_dir):
|
||||
shutil.rmtree(dest_dir)
|
||||
shutil.copytree(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "kivy"),
|
||||
dest_dir)
|
||||
|
||||
recipe = KivyRecipe()
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
from toolchain import CythonRecipe
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
class NumpyRecipe(Recipe):
|
||||
class NumpyRecipe(CythonRecipe):
|
||||
version = "1.9.1"
|
||||
url = "http://pypi.python.org/packages/source/n/numpy/numpy-{version}.tar.gz"
|
||||
library = "libnumpy.a"
|
||||
|
@ -19,49 +18,24 @@ class NumpyRecipe(Recipe):
|
|||
self.apply_patch("numpy-1.9.1.patch")
|
||||
self.set_marker("patched")
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(NumpyRecipe, self).get_recipe_env(arch)
|
||||
# CC must have the CFLAGS with arm arch, because numpy tries first to
|
||||
# compile and execute an empty C to see if the compiler works. This is
|
||||
# obviously not working when crosscompiling
|
||||
build_env["CC"] = "{} {}".format(
|
||||
build_env["CC"],
|
||||
build_env["CFLAGS"])
|
||||
build_env["ARCH"] = arch.arch
|
||||
env["CC"] = "{} {}".format(env["CC"], env["CFLAGS"])
|
||||
# Numpy configuration. Don't try to compile anything related to it,
|
||||
# we're going to use the Accelerate framework
|
||||
build_env["NPYCONFIG"] = "env BLAS=None LAPACK=None ATLAS=None"
|
||||
return build_env
|
||||
env["NPYCONFIG"] = "env BLAS=None LAPACK=None ATLAS=None"
|
||||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g", "-v",
|
||||
_env=build_env)
|
||||
super(NumpyRecipe, self).build_arch(arch)
|
||||
sh.cp(sh.glob(join(self.build_dir, "build", "temp.*", "libnpy*.a")),
|
||||
self.build_dir)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "numpy")
|
||||
if exists(dest_dir):
|
||||
shutil.rmtree(dest_dir)
|
||||
shutil.copytree(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "numpy"),
|
||||
dest_dir)
|
||||
def reduce_python_package(self):
|
||||
dest_dir = join(self.ctx.site_packages_dir, "numpy")
|
||||
shutil.rmtree(join(dest_dir, "core", "include"))
|
||||
shutil.rmtree(join(dest_dir, "core", "tests"))
|
||||
shutil.rmtree(join(dest_dir, "distutils"))
|
||||
|
|
|
@ -1,60 +1,27 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from toolchain import CythonRecipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
class PyobjusRecipe(Recipe):
|
||||
class PyobjusRecipe(CythonRecipe):
|
||||
version = "master"
|
||||
url = "https://github.com/kivy/pyobjus/archive/{version}.zip"
|
||||
library = "libpyobjus.a"
|
||||
depends = ["python"]
|
||||
pre_build_ext = True
|
||||
|
||||
def get_kivy_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["KIVYIOSROOT"] = self.ctx.root_dir
|
||||
build_env["IOSSDKROOT"] = arch.sysroot
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["CC"] = "{} -I{}".format(
|
||||
build_env["CC"],
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(PyobjusRecipe, self).get_recipe_env(arch)
|
||||
env["CC"] += " -I{}".format(
|
||||
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["ARCH"] = arch.arch
|
||||
return build_env
|
||||
return env
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = self.get_kivy_env(arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
try:
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
except:
|
||||
pass
|
||||
self.cythonize_build()
|
||||
def cythonize_build(self):
|
||||
super(PyobjusRecipe, self).cythonize_build()
|
||||
shprint(sh.sed,
|
||||
"-i.bak",
|
||||
"s/ffi\///g",
|
||||
"pyobjus/pyobjus.c")
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_kivy_env(arch)
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", join(build_dir, "iosbuild"),
|
||||
_env=build_env)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7",
|
||||
"site-packages", "pyobjus")
|
||||
shutil.copytree(
|
||||
join(build_dir, "iosbuild", "lib",
|
||||
"python2.7", "site-packages", "pyobjus"),
|
||||
dest_dir)
|
||||
|
||||
recipe = PyobjusRecipe()
|
||||
|
||||
|
|
Loading…
Reference in a new issue