Compare commits

...
Sign in to create a new pull request.

32 commits

Author SHA1 Message Date
Mathieu Virbel
55e8785a53 host_cffi: custom cffi module to be used within hostpython 2016-12-04 01:46:16 +01:00
Mathieu Virbel
4b364991fc hostpython: remove dynload patch that is not necessary for host python 2016-12-04 01:45:49 +01:00
Robert Niederreiter
67e8a0fb52 merge kivy master 2016-11-11 13:12:43 +01:00
Robert Niederreiter
263f89bb8c don't try to install cffi to hostpython via cffi recipe 2016-11-11 13:06:15 +01:00
Robert Niederreiter
e0f7ec5197 document new findings, remove build logger, some cleanup 2016-11-04 15:49:44 +01:00
Robert Niederreiter
0404d269b4 Update enum34 url 2016-11-04 15:01:38 +01:00
Robert Niederreiter
da5040d5cd cffi installs and works on device, hostpython not working yet 2016-11-04 14:05:30 +01:00
Robert Niederreiter
b392c61ae5 make cffi recipe work, additionally install pycparser in hostpython 2016-11-04 12:48:30 +01:00
Robert Niederreiter
1eed3853d5 experimenting with cryptography build 2016-11-02 17:43:23 +01:00
Robert Niederreiter
38230677fb build logger experiments 2016-11-02 14:34:21 +01:00
Robert Niederreiter
d65c85b0a8 typo 2016-11-02 14:12:03 +01:00
Robert Niederreiter
7188aa1904 typo 2016-11-02 14:11:11 +01:00
Robert Niederreiter
cd626b1fb7 correct type 2016-11-02 14:09:45 +01:00
Robert Niederreiter
7ff865e274 add command logger for analyzing build process 2016-11-02 13:59:34 +01:00
Robert Niederreiter
cba2e7a30b comment on unpacking setuptools in host_setuptools recipe 2016-10-22 13:38:59 +02:00
Robert Niederreiter
2cb3124e35 pycparser and cffi recipes install 2016-10-17 08:55:33 +02:00
Robert Niederreiter
26a76b65e5 recipe dependencies 2016-10-14 17:59:39 +02:00
Robert Niederreiter
bad28e3735 add enum34 recipe 2016-10-14 17:26:38 +02:00
Robert Niederreiter
11f84ec830 add ipaddress recipe 2016-10-14 17:21:02 +02:00
Robert Niederreiter
d0ba2dd4dd fix host_setuptools recipe 2016-10-14 16:01:50 +02:00
Robert Niederreiter
1c37a80b81 Install pure python packages like werkzeug 2016-10-14 14:57:49 +02:00
Robert Niederreiter
d4cb02ccf1 work on twisted related recipes 2016-10-14 14:07:10 +02:00
Robert Niederreiter
bbd1dadb16 reduce zope_interface recipe 2016-10-14 13:04:01 +02:00
Robert Niederreiter
02e9e08b5a ... 2016-10-14 12:39:39 +02:00
Robert Niederreiter
638e355df0 add archive dummy for host_setuptools to make toolchain happy 2016-10-14 10:13:38 +02:00
Robert Niederreiter
3375a52195 host_setuptools WIP 2016-10-14 10:05:44 +02:00
Robert Niederreiter
c34f792a17 tell hostpython where to find openssl 2016-10-14 10:04:15 +02:00
Robert Niederreiter
228c4c320d Merge branch 'docs' into twisted_recipe 2016-10-14 09:59:11 +02:00
Robert Niederreiter
7ff3e7982f add minimal docs 2016-10-14 09:58:41 +02:00
Robert Niederreiter
805c52bd6d work on hostpython and host_setuptools 2016-10-14 09:57:34 +02:00
Robert Niederreiter
0b696d6557 implement build_arch 2016-10-13 16:07:58 +02:00
Robert Niederreiter
8481f19564 twisted and autobahn related recipe stubs 2016-10-13 11:20:55 +02:00
20 changed files with 532 additions and 15 deletions

2
.gitignore vendored
View file

@ -2,6 +2,8 @@
*.pyc *.pyc
*.pyo *.pyo
*.swp *.swp
.project
.pydevproject
freetype-* freetype-*
build/* build/*
dist/* dist/*

View file

@ -87,6 +87,7 @@ For a complete list of available commands, type::
$ ./toolchain.py $ ./toolchain.py
Create the Xcode project Create the Xcode project
------------------------ ------------------------
@ -109,6 +110,7 @@ Then click on `Play`, and enjoy.
the `<title>-ios/YourApp` directory. Don't make changes in the -ios the `<title>-ios/YourApp` directory. Don't make changes in the -ios
directory directly. directory directly.
Configuring your App Configuring your App
-------------------- --------------------
@ -123,6 +125,7 @@ launch environment.
the 'export_orientation' function in 'main.m'. The XCode orientation the 'export_orientation' function in 'main.m'. The XCode orientation
settings should be set to support all. settings should be set to support all.
FAQ FAQ
--- ---
@ -132,6 +135,7 @@ Fatal error: "stdio.h" file not found
You must build with bitcode disabled (Xcode setting ENABLE_BITCODE should be No). You must build with bitcode disabled (Xcode setting ENABLE_BITCODE should be No).
We don't support bitcode. You need to go to the project setting, and disable bitcode. We don't support bitcode. You need to go to the project setting, and disable bitcode.
Support Support
------- -------
@ -146,6 +150,7 @@ We also have an IRC channel:
* Port : 6667, 6697 (SSL only) * Port : 6667, 6697 (SSL only)
* Channel : #kivy * Channel : #kivy
Contributing Contributing
------------ ------------
@ -165,6 +170,7 @@ IRC channel:
* Port : 6667, 6697 (SSL only) * Port : 6667, 6697 (SSL only)
* Channel : #kivy-dev * Channel : #kivy-dev
License License
------- -------

View file

@ -0,0 +1,26 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class AutobahnRecipe(PythonRecipe):
name = "autobahn"
version = "0.16.0"
url = "https://github.com/crossbario/autobahn-python/archive/v{version}.zip"
depends = ["twisted", "six", "txaio"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = AutobahnRecipe()

68
recipes/cffi/__init__.py Normal file
View file

@ -0,0 +1,68 @@
from os.path import join
from toolchain import CythonRecipe
from toolchain import shprint
import os
import sh
class CffiRecipe(CythonRecipe):
depends = ["host_cffi"]
name = "cffi"
version = "1.8.3"
url = (
"https://pypi.python.org/packages/0a/f3/"
"686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a/"
"cffi-{version}.tar.gz"
)
library = "libcffi.a"
depends = ["libffi", "host_setuptools", "pycparser"]
cythonize = False
def get_recipe_env(self, arch):
env = super(CffiRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
return env
def install(self):
arch = [arch for arch in self.filtered_archs if arch.arch == 'x86_64'][0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
# install cffi in hostpython
#
# XXX: installs, module import works, but FFI fails to instanciate:
#
# myhost:kivy-ios user$ ./dist/hostpython/bin/python
# Could not find platform dependent libraries <exec_prefix>
# Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
# Python 2.7.1 (r271:86832, Nov 4 2016, 10:41:44)
# [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# >>> import cffi
# >>> cffi.api.FFI()
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# File "/.../kivy-ios/dist/hostpython/lib/python2.7/site-packages/cffi/api.py", line 56, in __init__
# import _cffi_backend as backend
# ImportError: dynamic module does not define init function (init_cffi_backend)
#
#r = self.get_recipe('hostlibffi', self.ctx)
#build_env = r.get_recipe_env(arch)
#args = [hostpython, "setup.py", "install"]
#shprint(*args, _env=build_env)
# install cffi in root site packages
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = CffiRecipe()

View file

@ -0,0 +1,47 @@
from os.path import join
from toolchain import CythonRecipe
from toolchain import shprint
import os
import sh
class CryptographyRecipe(CythonRecipe):
name = "cryptography"
version = "1.5.2"
url = (
"https://pypi.python.org/packages/03/1a/"
"60984cb85cc38c4ebdfca27b32a6df6f1914959d8790f5a349608c78be61/"
"cryptography-{version}.tar.gz"
)
library = "libcryptography.a"
depends = ["host_setuptools", "cffi", "six", "idna", "pyasn1", "enum34"]
cythonize = False
def get_recipe_env(self, arch):
env = super(CryptographyRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
env["CFLAGS"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "openssl", "openssl"))
return env
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
args = [hostpython, "setup.py", "install"]
shprint(*args, _env=build_env)
recipe = CryptographyRecipe()

View file

@ -0,0 +1,25 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class Enum34Recipe(PythonRecipe):
version = "1.1.6"
url = 'https://pypi.python.org/packages/source/e/enum34/enum34-{version}.tar.gz'
depends = ["python", "host_setuptools"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = Enum34Recipe()

View file

@ -0,0 +1,66 @@
from os.path import join
from toolchain import Recipe
from toolchain import shprint
import os
import sh
libffi_tpl = """
prefix=%PREFIX%
exec_prefix=${prefix}
libdir=${exec_prefix}/build/Release
includedir=${libdir}/build_macosx-x86_64/include
Name: libffi
Description: Library supporting Foreign Function Interfaces
Version: %VERSION%
Libs: -L${libdir} -lffi
Cflags: -I${includedir}
"""
class HostCffiRecipe(Recipe):
name = "host_cffi"
version = "1.8.3"
archs = ["x86_64"]
url = (
"https://pypi.python.org/packages/0a/f3/"
"686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a/"
"cffi-{version}.tar.gz"
)
depends = ["libffi", "host_setuptools", "pycparser"]
def get_recipe_env(self, arch):
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
env = super(HostCffiRecipe, self).get_recipe_env(arch)
env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics"
env["LDFLAGS"] = " ".join([
"-undefined dynamic_lookup",
"-shared",
"-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib"))
])
env["CFLAGS"] = " ".join([
"--sysroot={}".format(sdk_path),
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
])
return env
def prebuild_arch(self, arch):
hostpython = sh.Command(self.ctx.hostpython)
build_dir = self.get_build_dir(arch.arch)
build_env = self.get_recipe_env(arch)
os.chdir(build_dir)
# generate a fake libffi pkg-config to let cffi use it
hostlibffi = Recipe.get_recipe("hostlibffi", self.ctx)
with open("libffi.pc", "w") as fd:
tpl = libffi_tpl.replace("%PREFIX%",
hostlibffi.get_build_dir(arch.arch))
tpl = tpl.replace("%VERSION%", hostlibffi.version)
fd.write(tpl)
build_env["PKG_CONFIG"] = "/usr/local/bin/pkg-config"
build_env["PKG_CONFIG_PATH"] = build_dir
shprint(hostpython, "setup.py", "build_ext", _env=build_env)
shprint(hostpython, "setup.py", "install", _env=build_env)
recipe = HostCffiRecipe()

View file

@ -28,7 +28,9 @@ class HostSetuptools(Recipe):
shprint(unzip, setuptools_egg_path) shprint(unzip, setuptools_egg_path)
os.remove(setuptools_egg_path) os.remove(setuptools_egg_path)
os.remove('setuptools.pth') os.remove('setuptools.pth')
os.remove('easy-install.pth') # XXX: setuptools egg is referenced in easy-install.pth, check removal
# after unpacking setuptools if necessary
#os.remove('easy-install.pth')
shutil.rmtree('EGG-INFO') shutil.rmtree('EGG-INFO')
recipe = HostSetuptools() recipe = HostSetuptools()

View file

@ -24,7 +24,7 @@ class HostpythonRecipe(Recipe):
return return
self.copy_file("_scproxy.py", "Lib/_scproxy.py") self.copy_file("_scproxy.py", "Lib/_scproxy.py")
self.apply_patch("ssize-t-max.patch") self.apply_patch("ssize-t-max.patch")
self.apply_patch("dynload.patch") # self.apply_patch("dynload.patch")
self.apply_patch("static-_sqlite3.patch") self.apply_patch("static-_sqlite3.patch")
self.copy_file("ModulesSetup", "Modules/Setup.local") self.copy_file("ModulesSetup", "Modules/Setup.local")
if "openssl.build_all" in self.ctx.state: if "openssl.build_all" in self.ctx.state:

29
recipes/idna/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class IdnaRecipe(PythonRecipe):
version = "2.1"
url = (
"https://pypi.python.org/packages/fb/84/"
"8c27516fbaa8147acd2e431086b473c453c428e24e8fb99a1d89ce381851/"
"idna-{version}.tar.gz"
)
depends = ["python", "host_setuptools"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = IdnaRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class IPAddressRecipe(PythonRecipe):
version = "1.0.17"
url = (
"https://pypi.python.org/packages/bb/26/"
"3b64955ff73f9e3155079b9ed31812afdfa5333b5c76387454d651ef593a/"
"ipaddress-{version}.tar.gz"
)
depends = ["python", "host_setuptools"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = IPAddressRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class Pyasn1Recipe(PythonRecipe):
version = "0.1.9"
url = (
"https://pypi.python.org/packages/f7/83/"
"377e3dd2e95f9020dbd0dfd3c47aaa7deebe3c68d3857a4e51917146ae8b/"
"pyasn1-{version}.tar.gz"
)
depends = ["ipaddress"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = Pyasn1Recipe()

View file

@ -0,0 +1,35 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class PycparserRecipe(PythonRecipe):
version = "2.14"
url = (
"https://pypi.python.org/packages/6d/31/"
"666614af3db0acf377876d48688c5d334b6e493b96d21aa7d332169bee50/"
"pycparser-{version}.tar.gz"
)
depends = ["python"]
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
args = [hostpython, "setup.py", "install"]
shprint(*args, _env=build_env)
recipe = PycparserRecipe()

View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class PyOpenSSLRecipe(PythonRecipe):
version = "16.1.0"
url = (
"https://pypi.python.org/packages/15/1e/"
"79c75db50e57350a7cefb70b110255757e9abd380a50ebdc0cfd853b7450/"
"pyOpenSSL-{version}.tar.gz"
)
depends = ["openssl", "cryptography"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = PyOpenSSLRecipe()

View file

@ -7,7 +7,7 @@ import os
class PythonRecipe(Recipe): class PythonRecipe(Recipe):
version = "2.7.1" version = "2.7.1"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2" url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
depends = ["hostpython", "libffi", ] depends = ["hostpython", "libffi"]
optional_depends = ["openssl"] optional_depends = ["openssl"]
library = "libpython2.7.a" library = "libpython2.7.a"
pbx_libraries = ["libz", "libbz2", "libsqlite3"] pbx_libraries = ["libz", "libbz2", "libsqlite3"]
@ -33,7 +33,6 @@ class PythonRecipe(Recipe):
self.append_file("ModulesSetup.mobile", "Modules/Setup.local") self.append_file("ModulesSetup.mobile", "Modules/Setup.local")
if "openssl.build_all" in self.ctx.state: if "openssl.build_all" in self.ctx.state:
self.append_file("ModulesSetup.openssl", "Modules/Setup.local") self.append_file("ModulesSetup.openssl", "Modules/Setup.local")
self.set_marker("patched") self.set_marker("patched")
def build_arch(self, arch): def build_arch(self, arch):

29
recipes/six/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class SixRecipe(PythonRecipe):
version = "1.10.0"
url = (
"https://pypi.python.org/packages/b3/b2/"
"238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/"
"six-{version}.tar.gz"
)
depends = ["python"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = SixRecipe()

View file

@ -0,0 +1,12 @@
from toolchain import CythonRecipe
class TwistedRecipe(CythonRecipe):
name = "twisted"
version = "16.1.1"
url = "https://github.com/twisted/twisted/archive/twisted-{version}.zip"
depends = ["pyopenssl", "zope_interface"]
cythonize = False
recipe = TwistedRecipe()

29
recipes/txaio/__init__.py Normal file
View file

@ -0,0 +1,29 @@
from os.path import join
from toolchain import PythonRecipe
from toolchain import shprint
import os
import sh
class TxaioRecipe(PythonRecipe):
version = "2.5.1"
url = (
"https://pypi.python.org/packages/45/e1/"
"f7d88767d65dbfc20d4b4aa0dad657dbbe8ca629ead2bef24da04630a12a/"
"txaio-{version}.tar.gz"
)
depends = ["host_setuptools", "six"]
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 = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
recipe = TxaioRecipe()

View file

@ -0,0 +1,13 @@
from toolchain import CythonRecipe
class ZopeInterfaceRecipe(CythonRecipe):
name = "zope"
version = "4.3.2"
url = 'http://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz'
depends = ["python", "host_setuptools"]
cythonize = False
recipe = ZopeInterfaceRecipe()

View file

@ -118,7 +118,9 @@ class JsonStore(object):
with io.open(self.filename, 'w', encoding='utf-8') as fd: with io.open(self.filename, 'w', encoding='utf-8') as fd:
fd.write(unicode(json.dumps(self.data, ensure_ascii=False))) fd.write(unicode(json.dumps(self.data, ensure_ascii=False)))
class Arch(object): class Arch(object):
def __init__(self, ctx): def __init__(self, ctx):
super(Arch, self).__init__() super(Arch, self).__init__()
self.ctx = ctx self.ctx = ctx
@ -135,7 +137,6 @@ class Arch(object):
d.format(arch=self)) d.format(arch=self))
for d in self.ctx.include_dirs] for d in self.ctx.include_dirs]
def get_env(self): def get_env(self):
include_dirs = [ include_dirs = [
"-I{}/{}".format( "-I{}/{}".format(
@ -196,7 +197,6 @@ class Arch(object):
return env return env
class ArchSimulator(Arch): class ArchSimulator(Arch):
sdk = "iphonesimulator" sdk = "iphonesimulator"
arch = "i386" arch = "i386"
@ -227,7 +227,7 @@ class Arch64IOS(Arch):
triple = "aarch64-apple-darwin13" triple = "aarch64-apple-darwin13"
version_min = "-miphoneos-version-min=7.0" version_min = "-miphoneos-version-min=7.0"
sysroot = sh.xcrun("--sdk", "iphoneos", "--show-sdk-path").strip() sysroot = sh.xcrun("--sdk", "iphoneos", "--show-sdk-path").strip()
class Graph(object): class Graph(object):
# Taken from python-for-android/depsort # Taken from python-for-android/depsort
@ -375,19 +375,60 @@ class Context(object):
class Recipe(object): class Recipe(object):
version = None """Base recipe for compiling and installing dependency libraries and
packages to kivy iOS build.
"""
url = None url = None
"""Either folder name relative to recipe or download URL.
"""
version = None
"""Gets formatted with ``url`` if download URL.
"""
archs = [] archs = []
"""Architectures this recipe applies, empty list means all.
"""
depends = [] depends = []
"""Dependency recipes.
"""
optional_depends = [] optional_depends = []
"""???
"""
library = None library = None
"""???
"""
libraries = [] libraries = []
"""???
"""
include_dir = None include_dir = None
"""Include directory for compilation"""
include_per_arch = False include_per_arch = False
"""???
"""
frameworks = [] frameworks = []
"""OS X frameworks.
"""
sources = [] sources = []
"""???
"""
pbx_frameworks = [] pbx_frameworks = []
"""???
"""
pbx_libraries = [] pbx_libraries = []
"""???
"""
# API available for recipes # API available for recipes
def download_file(self, url, filename, cwd=None): def download_file(self, url, filename, cwd=None):
@ -396,6 +437,7 @@ class Recipe(object):
""" """
if not url: if not url:
return return
def report_hook(index, blksize, size): def report_hook(index, blksize, size):
if size <= 0: if size <= 0:
progression = '{0} bytes'.format(index * blksize) progression = '{0} bytes'.format(index * blksize)
@ -638,7 +680,7 @@ class Recipe(object):
shutil.copytree(src_dir, dest_dir) shutil.copytree(src_dir, dest_dir)
return return
ensure_dir(build_dir) ensure_dir(build_dir)
self.extract_file(self.archive_fn, build_dir) self.extract_file(self.archive_fn, build_dir)
@cache_execution @cache_execution
def build(self, arch): def build(self, arch):
@ -812,7 +854,7 @@ class Recipe(object):
@classmethod @classmethod
def get_recipe(cls, name, ctx): def get_recipe(cls, name, ctx):
if not hasattr(cls, "recipes"): if not hasattr(cls, "recipes"):
cls.recipes = {} cls.recipes = {}
if '==' in name: if '==' in name:
name, version = name.split('==') name, version = name.split('==')
@ -850,7 +892,8 @@ class PythonRecipe(Recipe):
"""Automate the installation of a Python package into the target """Automate the installation of a Python package into the target
site-packages. site-packages.
It will works with the first filtered_archs, and the name of the recipe. It will works with the first filtered_archs, and the name of the
recipe.
""" """
arch = self.filtered_archs[0] arch = self.filtered_archs[0]
if name is None: if name is None:
@ -1047,7 +1090,6 @@ def update_pbxproj(filename):
fn = join(ctx.dist_dir, "sources", name) fn = join(ctx.dist_dir, "sources", name)
project.add_folder(fn, parent=g_classes) project.add_folder(fn, parent=g_classes)
if project.modified: if project.modified:
project.backup() project.backup()
project.save() project.save()
@ -1055,13 +1097,13 @@ def update_pbxproj(filename):
if __name__ == "__main__": if __name__ == "__main__":
import argparse import argparse
class ToolchainCL(object): class ToolchainCL(object):
def __init__(self): def __init__(self):
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Tool for managing the iOS / Python toolchain", description="Tool for managing the iOS / Python toolchain",
usage="""toolchain <command> [<args>] usage="""toolchain <command> [<args>]
Available commands: Available commands:
build Build a recipe (compile a library for the required target build Build a recipe (compile a library for the required target
architecture) architecture)
@ -1177,7 +1219,7 @@ Xcode:
parser.add_argument("name", help="Name of your project") parser.add_argument("name", help="Name of your project")
parser.add_argument("directory", help="Directory where your project live") parser.add_argument("directory", help="Directory where your project live")
args = parser.parse_args(sys.argv[2:]) args = parser.parse_args(sys.argv[2:])
from cookiecutter.main import cookiecutter from cookiecutter.main import cookiecutter
ctx = Context() ctx = Context()
template_dir = join(curdir, "tools", "templates") template_dir = join(curdir, "tools", "templates")