From 45b97ea28ea221289fc0e2a32bcc2585facf9b5e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 1 Jun 2018 10:44:31 +0100 Subject: [PATCH 1/3] Python 2.7.13 support based on https://github.com/kivy/kivy-ios/pull/242 --- recipes/hostopenssl/__init__.py | 73 ++++++++ recipes/hostpython/ModulesSetup | 2 +- recipes/hostpython/__init__.py | 10 +- recipes/ios/__init__.py | 14 ++ recipes/kivy/__init__.py | 14 ++ recipes/openssl/__init__.py | 3 +- recipes/pyobjus/__init__.py | 38 +++- recipes/python/ModulesSetup | 2 +- recipes/python/__init__.py | 28 +-- recipes/python/ctypes_duplicate.patch | 19 +- .../python/ctypes_duplicate_longdouble.patch | 17 -- recipes/python/posixmodule.patch | 14 +- recipes/python/random.patch | 31 ++++ recipes/python/xcompile.patch | 166 +++--------------- recipes/sdl2/__init__.py | 10 +- toolchain.py | 1 + .../project.pbxproj | 2 +- 17 files changed, 240 insertions(+), 204 deletions(-) create mode 100644 recipes/hostopenssl/__init__.py delete mode 100644 recipes/python/ctypes_duplicate_longdouble.patch create mode 100644 recipes/python/random.patch diff --git a/recipes/hostopenssl/__init__.py b/recipes/hostopenssl/__init__.py new file mode 100644 index 0000000..8af912d --- /dev/null +++ b/recipes/hostopenssl/__init__.py @@ -0,0 +1,73 @@ +from toolchain import Recipe, shprint +from os.path import join, exists, basename, dirname +from os import makedirs +import sh +import shutil + +def ensure_dir(filename): + if not exists(filename): + makedirs(filename) + +class HostOpenSSLRecipe(Recipe): + version = "1.0.2l" + url = "http://www.openssl.org/source/openssl-{version}.tar.gz" + archs = ["x86_64"] + libraries = ["libssl.a", "libcrypto.a"] + include_dir = "include" + + def build_x86_64(self): + arch = self.archs[0] + sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip() + dist_dir = join(self.ctx.dist_dir,"hostopenssl") + print("OpenSSL for host to be installed at: {}").format(dist_dir) + sh.perl(join(self.build_dir, "Configure"), "darwin64-x86_64-cc", + "--openssldir={}".format(dist_dir), + "--prefix={}".format(dist_dir)) + + shprint(sh.make, "clean") + shprint(sh.make, "-j4", "build_libs") + + def install_include(self): + arch = self.archs[0] + print("Custom include file install...") + print("Dist dir = {}".format(self.ctx.dist_dir)) + dest_dir = join(self.ctx.dist_dir,"hostopenssl","include") + if exists(dest_dir): + shutil.rmtree(dest_dir) + src_dir = join(self.ctx.build_dir,"hostopenssl",arch,"openssl-{}".format(self.version),"include") + shutil.copytree(src_dir,dest_dir) + + def build_all(self): + filtered_archs = self.filtered_archs + print("Build {} for {} (filtered)".format( + self.name, + ", ".join([x.arch for x in filtered_archs]))) + for arch in self.filtered_archs: + self.build(arch) + + name = self.name + if self.library: + print("Create lipo library for {}".format(name)) + if not name.startswith("lib"): + name = "lib{}".format(name) + static_fn = join(self.ctx.dist_dir, "hostopenssl", "lib", "{}.a".format(name)) + ensure_dir(dirname(static_fn)) + print("Lipo {} to {}".format(self.name, static_fn)) + self.make_lipo(static_fn) + if self.libraries: + print("Create multiple lipo for {}".format(name)) + for library in self.libraries: + static_fn = join(self.ctx.dist_dir, "hostopenssl", "lib", basename(library)) + ensure_dir(dirname(static_fn)) + print(" - Lipo-ize {}".format(library)) + self.make_lipo(static_fn, library) + print("Install include files for {}".format(self.name)) + self.install_include() + print("Install frameworks for {}".format(self.name)) + self.install_frameworks() + print("Install sources for {}".format(self.name)) + self.install_sources() + print("Install {}".format(self.name)) + self.install() + +recipe = HostOpenSSLRecipe() diff --git a/recipes/hostpython/ModulesSetup b/recipes/hostpython/ModulesSetup index 28403a9..6affaed 100644 --- a/recipes/hostpython/ModulesSetup +++ b/recipes/hostpython/ModulesSetup @@ -8,7 +8,7 @@ zipimport zipimport.c _symtable symtablemodule.c array arraymodule.c # array objects cmath cmathmodule.c # -lm # complex math library functions -math mathmodule.c # -lm # math library functions, e.g. sin() +math _math.c mathmodule.c # -lm # math library functions, e.g. sin() _struct _struct.c # binary structure packing/unpacking time timemodule.c # -lm # time operations and variables operator operator.c # operator.add() and similar goodies diff --git a/recipes/hostpython/__init__.py b/recipes/hostpython/__init__.py index 2645fce..4dd92b0 100644 --- a/recipes/hostpython/__init__.py +++ b/recipes/hostpython/__init__.py @@ -6,10 +6,10 @@ import shutil class HostpythonRecipe(Recipe): - version = "2.7.1" - url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2" + version = "2.7.13" + url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" depends = ["hostlibffi"] - optional_depends = ["openssl"] + optional_depends = ["hostopenssl", "openssl"] archs = ["x86_64"] def init_with_ctx(self, ctx): @@ -66,8 +66,8 @@ class HostpythonRecipe(Recipe): ]) if "openssl.build_all" in self.ctx.state: - build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "include", - "x86_64", "openssl")) + build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "hostopenssl", "include")) + build_env["LDFLAGS"] += " -L{}".format(join(self.ctx.dist_dir, "hostopenssl", "lib")) configure = sh.Command(join(self.build_dir, "configure")) shprint(configure, diff --git a/recipes/ios/__init__.py b/recipes/ios/__init__.py index af4264d..39a30c5 100644 --- a/recipes/ios/__init__.py +++ b/recipes/ios/__init__.py @@ -8,6 +8,20 @@ class IosRecipe(CythonRecipe): depends = ["python"] pbx_frameworks = ["MessageUI", "CoreMotion", "UIKit"] + def prebuild_arch(self, arch): + from os.path import join + destdir = self.get_build_dir(arch.arch) + local_arch = arch.arch + if arch.arch == "arm64" : + local_arch = "aarch64" + if arch.arch == "armv7" : + local_arch = "arm" + build_dir = join(destdir, "../../../python", arch.arch, "Python-2.7.13", "build", "lib.darwin-{}-2.7".format(local_arch)) + print("build_dir = "+build_dir) + copyfile = join(build_dir,"_sysconfigdata.py") + # Copy _sysconfigdata.py for this architecture across + self.copy_file(copyfile, destdir) + def install(self): self.install_python_package(name="ios.so", is_dir=False) diff --git a/recipes/kivy/__init__.py b/recipes/kivy/__init__.py index 98c1c55..ca1d548 100644 --- a/recipes/kivy/__init__.py +++ b/recipes/kivy/__init__.py @@ -20,6 +20,20 @@ class KivyRecipe(CythonRecipe): join(self.ctx.dist_dir, "include", "common", "sdl2_mixer")]) return env + def prebuild_arch(self, arch): + from os.path import join + destdir = self.get_build_dir(arch.arch) + local_arch = arch.arch + if arch.arch == "arm64" : + local_arch = "aarch64" + if arch.arch == "armv7" : + local_arch = "arm" + build_dir = join(destdir, "../../../python", arch.arch, "Python-2.7.13", "build", "lib.darwin-{}-2.7".format(local_arch)) + print("build_dir = "+build_dir) + copyfile = join(build_dir,"_sysconfigdata.py") + # Copy _sysconfigdata.py for this architecture across + self.copy_file(copyfile, destdir) + def build_arch(self, arch): self._patch_setup() super(KivyRecipe, self).build_arch(arch) diff --git a/recipes/openssl/__init__.py b/recipes/openssl/__init__.py index f93cbea..090a8cc 100644 --- a/recipes/openssl/__init__.py +++ b/recipes/openssl/__init__.py @@ -10,8 +10,9 @@ arch_mapper = {'i386': 'darwin-i386-cc', class OpensslRecipe(Recipe): - version = "1.0.2k" + version = "1.0.2l" url = "http://www.openssl.org/source/openssl-{version}.tar.gz" + depends = ["hostopenssl"] libraries = ["libssl.a", "libcrypto.a"] include_dir = "include" include_per_arch = True diff --git a/recipes/pyobjus/__init__.py b/recipes/pyobjus/__init__.py index 639b838..414da4a 100644 --- a/recipes/pyobjus/__init__.py +++ b/recipes/pyobjus/__init__.py @@ -1,5 +1,7 @@ from toolchain import CythonRecipe, shprint from os.path import join +from os import walk +import fnmatch import sh @@ -10,16 +12,44 @@ class PyobjusRecipe(CythonRecipe): depends = ["python"] pre_build_ext = True + def prebuild_arch(self, arch): + from os.path import join + destdir = self.get_build_dir(arch.arch) + local_arch = arch.arch + if arch.arch == "arm64" : + local_arch = "aarch64" + if arch.arch == "armv7" : + local_arch = "arm" + build_dir = join(destdir, "../../../python", arch.arch, "Python-2.7.13", "build", "lib.darwin-{}-2.7".format(local_arch)) + print("build_dir = "+build_dir) + copyfile = join(build_dir,"_sysconfigdata.py") + # Copy _sysconfigdata.py for this architecture across + self.copy_file(copyfile,destdir) + 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")) return env + def cythonize_file(self, filename): + if filename.startswith(self.build_dir): + filename = filename[len(self.build_dir) + 1:] + print("Cython {}".format(filename)) + cmd = sh.Command("/usr/local/bin/cython") + shprint(cmd, filename) + def cythonize_build(self): - # don't use the cythonize, pyobjus don't support method rewriting - shprint(sh.find, self.build_dir, "-iname", "*.pyx", - "-exec", "cython", "{}", ";") + if not self.cythonize: + return + root_dir = self.build_dir + + for root, dirnames, filenames in walk(root_dir): + #print(filenames) + for filename in fnmatch.filter(filenames, "*.pyx"): + #print("DBJ pyx files "+filename) + #shprint(cmd, filename) + self.cythonize_file(join(root, filename)) # ffi is installed somewhere else, this include doesn't work # XXX ideally, we need to fix libffi installation... shprint(sh.sed, @@ -28,5 +58,3 @@ class PyobjusRecipe(CythonRecipe): "pyobjus/pyobjus.c") recipe = PyobjusRecipe() - - diff --git a/recipes/python/ModulesSetup b/recipes/python/ModulesSetup index d4f936d..10de7a9 100644 --- a/recipes/python/ModulesSetup +++ b/recipes/python/ModulesSetup @@ -8,7 +8,7 @@ #_symtable symtablemodule.c array arraymodule.c # array objects cmath cmathmodule.c # -lm # complex math library functions -math mathmodule.c # -lm # math library functions, e.g. sin() +math _math.c mathmodule.c # -lm # math library functions, e.g. sin() _struct _struct.c # binary structure packing/unpacking time timemodule.c # -lm # time operations and variables operator operator.c # operator.add() and similar goodies diff --git a/recipes/python/__init__.py b/recipes/python/__init__.py index 24cde16..04c703c 100644 --- a/recipes/python/__init__.py +++ b/recipes/python/__init__.py @@ -5,8 +5,8 @@ import os class PythonRecipe(Recipe): - version = "2.7.1" - url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2" + version = "2.7.13" + url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" depends = ["hostpython", "libffi", ] optional_depends = ["openssl"] library = "libpython2.7.a" @@ -15,7 +15,6 @@ class PythonRecipe(Recipe): def init_with_ctx(self, ctx): super(PythonRecipe, self).init_with_ctx(ctx) self.ctx.python_ver_dir = "python2.7" - self.ctx.python_prefix = join(ctx.dist_dir, "root", "python") self.ctx.site_packages_dir = join( ctx.dist_dir, "root", "python", "lib", ctx.python_ver_dir, "site-packages") @@ -31,36 +30,41 @@ class PythonRecipe(Recipe): self.copy_file("_scproxy.py", "Lib/_scproxy.py") self.apply_patch("xcompile.patch") self.apply_patch("setuppath.patch") + self.apply_patch("posixmodule.patch") self.append_file("ModulesSetup.mobile", "Modules/Setup.local") - self.apply_patch("ipv6.patch") if "openssl.build_all" in self.ctx.state: self.append_file("ModulesSetup.openssl", "Modules/Setup.local") - self.apply_patch("posixmodule.patch") self.set_marker("patched") def build_arch(self, arch): build_env = arch.get_env() configure = sh.Command(join(self.build_dir, "configure")) + local_arch = arch.arch + if arch.arch == "arm64" : + local_arch = "aarch64" shprint(configure, "CC={}".format(build_env["CC"]), "LD={}".format(build_env["LD"]), "CFLAGS={}".format(build_env["CFLAGS"]), "LDFLAGS={} -undefined dynamic_lookup".format(build_env["LDFLAGS"]), + "ac_cv_file__dev_ptmx=no", + "ac_cv_file__dev_ptc=no", "--without-pymalloc", "--disable-toolbox-glue", - "--host={}-apple-darwin".format(arch), + "--host={}-apple-darwin".format(local_arch), + "--build=x86_64-apple-darwin16.4.0", "--prefix=/python", + "--enable-ipv6", "--with-system-ffi", "--without-doc-strings", - "--enable-ipv6", _env=build_env) self._patch_pyconfig() + self.apply_patch("random.patch") self.apply_patch("ctypes_duplicate.patch") - self.apply_patch("ctypes_duplicate_longdouble.patch") - shprint(sh.make, self.ctx.concurrent_make, + shprint(sh.make, "-j4", "CROSS_COMPILE_TARGET=yes", "HOSTPYTHON={}".format(self.ctx.hostpython), "HOSTPGEN={}".format(self.ctx.hostpgen)) @@ -70,7 +74,7 @@ class PythonRecipe(Recipe): build_env = arch.get_env() build_dir = self.get_build_dir(arch.arch) build_env["PATH"] = os.environ["PATH"] - shprint(sh.make, self.ctx.concurrent_make, + shprint(sh.make, "-C", build_dir, "install", "CROSS_COMPILE_TARGET=yes", @@ -90,7 +94,7 @@ class PythonRecipe(Recipe): for line in lines[:]: if pattern in line: lines.remove(line) - with open(pyconfig, "r") as fd: + with open(pyconfig) as fd: lines = fd.readlines() _remove_line(lines, "#define HAVE_BIND_TEXTDOMAIN_CODESET 1") _remove_line(lines, "#define HAVE_FINITE 1") @@ -111,7 +115,7 @@ class PythonRecipe(Recipe): _remove_line(lines, "#define HAVE_TMPNAM_R 1") _remove_line(lines, "#define HAVE__GETPTY 1") lines.append("#define HAVE_GETHOSTBYNAME 1\n") - with open(pyconfig, "w") as fd: + with open(pyconfig, "wb") as fd: fd.writelines(lines) def reduce_python(self): diff --git a/recipes/python/ctypes_duplicate.patch b/recipes/python/ctypes_duplicate.patch index c895dc5..06d398f 100644 --- a/recipes/python/ctypes_duplicate.patch +++ b/recipes/python/ctypes_duplicate.patch @@ -1,9 +1,10 @@ ---- Python2.7-old/Modules/_ctypes/cfield.c 2010-05-09 16:46:46.000000000 +0200 -+++ Python2.7-new/Modules/_ctypes/cfield.c 2013-08-27 00:21:15.000000000 +0200 -@@ -1747,24 +1747,6 @@ +--- Python-2.7.13/Modules/_ctypes/cfield.c.orig 2017-03-08 16:42:49.000000000 +0000 ++++ Python-2.7.13/Modules/_ctypes/cfield.c 2017-03-08 16:52:33.000000000 +0000 +@@ -1725,32 +1725,12 @@ + struct _ffi_type **elements; } ffi_type; */ - +- -/* align and size are bogus for void, but they must not be zero */ -ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; - @@ -13,8 +14,8 @@ -ffi_type ffi_type_uint16 = { 2, 2, FFI_TYPE_UINT16 }; -ffi_type ffi_type_sint16 = { 2, 2, FFI_TYPE_SINT16 }; - --ffi_type ffi_type_uint32 = { 4, 4, FFI_TYPE_UINT32 }; --ffi_type ffi_type_sint32 = { 4, 4, FFI_TYPE_SINT32 }; +-ffi_type ffi_type_uint32 = { 4, INT_ALIGN, FFI_TYPE_UINT32 }; +-ffi_type ffi_type_sint32 = { 4, INT_ALIGN, FFI_TYPE_SINT32 }; - -ffi_type ffi_type_uint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_UINT64 }; -ffi_type ffi_type_sint64 = { 8, LONG_LONG_ALIGN, FFI_TYPE_SINT64 }; @@ -22,13 +23,15 @@ -ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT }; -ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE }; - ++#if 0 #ifdef ffi_type_longdouble #undef ffi_type_longdouble #endif -@@ -1772,6 +1754,4 @@ + /* This is already defined on OSX */ ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, FFI_TYPE_LONGDOUBLE }; - +- -ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; - ++#endif /*---------------- EOF ----------------*/ diff --git a/recipes/python/ctypes_duplicate_longdouble.patch b/recipes/python/ctypes_duplicate_longdouble.patch deleted file mode 100644 index 1bffbb5..0000000 --- a/recipes/python/ctypes_duplicate_longdouble.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -Naur Python-2.7.1.orig/Modules/_ctypes/cfield.c Python-2.7.1/Modules/_ctypes/cfield.c ---- Python-2.7.1.orig/Modules/_ctypes/cfield.c 2015-02-11 13:00:42.000000000 +0100 -+++ Python-2.7.1/Modules/_ctypes/cfield.c 2015-02-11 13:01:12.000000000 +0100 -@@ -1747,11 +1747,12 @@ - } ffi_type; - */ - -+#if 0 - #ifdef ffi_type_longdouble - #undef ffi_type_longdouble - #endif - /* This is already defined on OSX */ - ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, - FFI_TYPE_LONGDOUBLE }; -- -+#endif - /*---------------- EOF ----------------*/ diff --git a/recipes/python/posixmodule.patch b/recipes/python/posixmodule.patch index d993d77..38f904e 100644 --- a/recipes/python/posixmodule.patch +++ b/recipes/python/posixmodule.patch @@ -1,15 +1,9 @@ -Index: Python-2.7.1/Modules/posixmodule.c -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- Python-2.7.1/Modules/posixmodule.c (date 1290868829000) -+++ Python-2.7.1/Modules/posixmodule.c (revision ) -@@ -2644,7 +2644,7 @@ - #endif +--- Python-2.7.13/Modules/posixmodule.c 2016-12-17 21:05:07.000000000 +0100 ++++ Python-2.7.13-patch/Modules/posixmodule.c 2018-05-31 20:13:42.000000000 +0100 +@@ -2828,6 +2828,7 @@ } -- + +#undef HAVE_SYSTEM #ifdef HAVE_SYSTEM PyDoc_STRVAR(posix_system__doc__, diff --git a/recipes/python/random.patch b/recipes/python/random.patch new file mode 100644 index 0000000..6de4b04 --- /dev/null +++ b/recipes/python/random.patch @@ -0,0 +1,31 @@ +--- Python-2.7.13/Python/random.c.orig 2017-02-19 13:55:43.000000000 +0000 ++++ Python-2.7.13/Python/random.c 2017-02-19 13:56:29.000000000 +0000 +@@ -3,7 +3,7 @@ + #include + #else + #include +-#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) ++#if defined(HAVE_GETRANDOM)// || defined(HAVE_GETENTROPY) + #include + #endif + #endif +@@ -114,7 +114,7 @@ + + if (!fatal) { + Py_BEGIN_ALLOW_THREADS +- res = getentropy(buffer, len); ++ res = 0; + Py_END_ALLOW_THREADS + + if (res < 0) { +@@ -123,8 +123,8 @@ + } + } + else { +- res = getentropy(buffer, len); +- if (res < 0) ++ res = 0; ++ if (res < 0) + Py_FatalError("getentropy() failed"); + } + \ No newline at end of file diff --git a/recipes/python/xcompile.patch b/recipes/python/xcompile.patch index 6f3a08e..77f59b0 100644 --- a/recipes/python/xcompile.patch +++ b/recipes/python/xcompile.patch @@ -1,138 +1,28 @@ -diff -Naur Python-2.7-old/Makefile.pre.in Python-2.7-new/Makefile.pre.in ---- Python-2.7-old/Makefile.pre.in 2010-04-11 17:10:46.000000000 -0700 -+++ Python-2.7-new/Makefile.pre.in 2010-07-09 13:40:47.000000000 -0700 -@@ -179,6 +179,7 @@ - - PYTHON= python$(EXE) - BUILDPYTHON= python$(BUILDEXE) -+HOSTPYTHON= ./$(BUILDPYTHON) - - # The task to run while instrument when building the profile-opt target - PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -@@ -212,6 +213,8 @@ - # Parser - PGEN= Parser/pgen$(EXE) - -+HOSTPGEN= $(PGEN) -+ - POBJS= \ - Parser/acceler.o \ - Parser/grammar1.o \ -@@ -404,8 +407,8 @@ - # Build the shared modules - sharedmods: $(BUILDPYTHON) - @case $$MAKEFLAGS in \ -- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ -- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ -+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ -+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ - esac - - # Build static library -@@ -538,7 +541,7 @@ - - $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - -@$(INSTALL) -d Include -- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - - $(PGEN): $(PGENOBJS) - $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) -@@ -919,26 +922,26 @@ - done; \ - done - $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -+ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST)/site-packages -f \ - -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -- ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" -+ $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" - - # Create the PLATDIR source directory, if one wasn't distributed.. - $(srcdir)/Lib/$(PLATDIR): -@@ -1042,8 +1045,10 @@ - - # Install the dynamically loadable modules - # This goes into $(exec_prefix) --sharedinstall: sharedmods -- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ -+sharedinstall: sharedmods -+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \ -+ --skip-build \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ -diff -Naur Python-2.7-old/setup.py Python-2.7-new/setup.py ---- Python-2.7-old/setup.py 2010-06-27 05:36:16.000000000 -0700 -+++ Python-2.7-new/setup.py 2010-07-09 13:54:29.000000000 -0700 -@@ -23,6 +23,10 @@ - # This global variable is used to hold the list of modules to be disabled. - disabled_module_list = [] - -+# _ctypes fails to cross-compile due to the libffi configure script. -+if os.environ.has_key('PYTHONXCPREFIX'): -+ disabled_module_list.append('_ctypes') -+ - def add_dir_to_list(dirlist, dir): - """Add the directory 'dir' to the list 'dirlist' (at the front) if - 1) 'dir' is not already in 'dirlist' -@@ -278,6 +282,14 @@ - (ext.name, sys.exc_info()[1])) - self.failed.append(ext.name) - return -+ -+ # Inport check will not work when cross-compiling. -+ if os.environ.has_key('PYTHONXCPREFIX'): -+ self.announce( -+ 'WARNING: skipping inport check for cross-compiled: "%s"' % -+ ext.name) -+ return -+ - # Workaround for Mac OS X: The Carbon-based modules cannot be - # reliably imported into a command-line Python - if 'Carbon' in ext.extra_link_args: - ---- Python-2.7Orig/configure 2011-04-29 22:30:59.231331437 +1000 -+++ Python-2.7/configure 2010-05-29 01:28:47.000000000 +1000 -@@ -13517,7 +13517,7 @@ - $as_echo_n "(cached) " >&6 - else - if test "$cross_compiling" = yes; then : -- ac_cv_have_long_long_format=no -+ ac_cv_have_long_long_format="cross -- assuming yes" - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ -@@ -13569,7 +13569,7 @@ - $as_echo "$ac_cv_have_long_long_format" >&6; } - fi - --if test "$ac_cv_have_long_long_format" = yes -+if test "$ac_cv_have_long_long_format" != no - then - - $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h - +--- Python-2.7.13/configure.orig 2017-02-08 10:11:52.000000000 +0000 ++++ Python-2.7.13/configure 2017-02-08 10:15:10.000000000 +0000 +@@ -3242,6 +3242,9 @@ + *-*-linux*) + ac_sys_system=Linux + ;; ++ *-*-darwin*) ++ ac_sys_system=Darwin ++ ;; + *-*-cygwin*) + ac_sys_system=Cygwin + ;; +@@ -3288,6 +3291,15 @@ + _host_cpu=$host_cpu + esac + ;; ++ *-*-darwin*) ++ case "$host_cpu" in ++ arm*) ++ _host_cpu=arm ++ ;; ++ *) ++ _host_cpu=$host_cpu ++ esac ++ ;; + *-*-cygwin*) + _host_cpu= + ;; diff --git a/recipes/sdl2/__init__.py b/recipes/sdl2/__init__.py index 6fe77cf..c8f2d3d 100644 --- a/recipes/sdl2/__init__.py +++ b/recipes/sdl2/__init__.py @@ -3,14 +3,14 @@ import sh class LibSDL2Recipe(Recipe): - #version = "2.0.3" - #url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" - version = "iOS-improvements" - url = "https://bitbucket.org/slime73/sdl-experiments/get/{version}.tar.gz" + version = "2.0.5" + url = "https://www.libsdl.org/release/SDL2-{version}.tar.gz" + #version = "iOS-improvements" + #url = "https://bitbucket.org/slime73/sdl-experiments/get/{version}.tar.gz" library = "Xcode-iOS/SDL/build/Release-{arch.sdk}/libSDL2.a" include_dir = "include" pbx_frameworks = ["OpenGLES", "AudioToolbox", "QuartzCore", "CoreGraphics", - "CoreMotion"] + "CoreMotion", "AVFoundation", "GameController"] def prebuild_arch(self, arch): if self.has_marker("patched"): diff --git a/toolchain.py b/toolchain.py index 133bac6..16d4a8c 100755 --- a/toolchain.py +++ b/toolchain.py @@ -947,6 +947,7 @@ class CythonRecipe(PythonRecipe): env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink") env["ARM_LD"] = env["LD"] env["ARCH"] = arch.arch + env["PYTHONPATH"] = dirname(realpath(__file__)) return env def build_arch(self, arch): diff --git a/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj b/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj index 0d00e86..39c04d2 100755 --- a/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj +++ b/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj @@ -234,7 +234,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "{{ cookiecutter.dist_dir }}/hostpython/bin/python -OO -m compileall \"$PROJECT_DIR\"/YourApp"; + shellScript = "if [ $arch = \"arm64\" ]; then export local_arch=\"aarch64\"; elif [ $arch = \"armv7\" ]; then export local_arch=\"arm\"; else export local_arch=$arch; fi; export PYTHONPATH={{ cookiecutter.dist_dir }}/../build/python/$arch/Python-2.7.13/build/lib.darwin-$local_arch-2.7; {{ cookiecutter.dist_dir }}/hostpython/bin/python -OO -m compileall \"$PROJECT_DIR\"/YourApp"; }; /* End PBXShellScriptBuildPhase section */ From a1a7ae7d547b83f388bf7a5ed73647d0b842142b Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 2 Jun 2018 09:39:18 +0100 Subject: [PATCH 2/3] Add all the things to make lbrynet daemon build --- recipes/appdirs/__init__.py | 20 ++++++ recipes/argparse/__init__.py | 20 ++++++ recipes/asn1crypto/__init__.py | 20 ++++++ recipes/attrs/__init__.py | 20 ++++++ recipes/base58/__init__.py | 20 ++++++ recipes/cffi/__init__.py | 41 ++++++++++++ recipes/colorama/__init__.py | 20 ++++++ recipes/constantly/__init__.py | 20 ++++++ recipes/cryptography/__init__.py | 60 ++++++++++++++++++ recipes/cryptography/getentropy.patch | 45 ++++++++++++++ recipes/cryptography/osrandom.patch | 16 +++++ recipes/dnspython/__init__.py | 20 ++++++ recipes/docopt/__init__.py | 20 ++++++ recipes/ecdsa/__init__.py | 20 ++++++ recipes/enum34/__init__.py | 20 ++++++ recipes/envparse/__init__.py | 20 ++++++ recipes/functools32/__init__.py | 20 ++++++ recipes/host_cffi/__init__.py | 62 +++++++++++++++++++ recipes/host_setuptools/__init__.py | 28 +++++++-- recipes/hostpython/ModulesSetup | 2 + recipes/hostpython/__init__.py | 16 +++-- recipes/hostpython/_scproxy.py | 10 --- recipes/idna/__init__.py | 20 ++++++ recipes/incremental/__init__.py | 20 ++++++ recipes/ipaddress/__init__.py | 20 ++++++ recipes/jsonrpc/__init__.py | 20 ++++++ recipes/jsonrpclib/__init__.py | 20 ++++++ recipes/jsonschema/__init__.py | 20 ++++++ recipes/keyring/__init__.py | 20 ++++++ recipes/lbry/__init__.py | 51 +++++++++++++++ recipes/lbryschema/__init__.py | 20 ++++++ recipes/lbryum/__init__.py | 20 ++++++ recipes/miniupnpc/__init__.py | 26 ++++++++ recipes/pbkdf2/__init__.py | 20 ++++++ recipes/protobuf/__init__.py | 21 +++++++ recipes/pyasn1-modules/__init__.py | 20 ++++++ recipes/pyasn1/__init__.py | 20 ++++++ recipes/pycparser/__init__.py | 32 ++++++++++ recipes/pycrypto/__init__.py | 1 - recipes/pygithub/__init__.py | 20 ++++++ recipes/pyjwt/__init__.py | 20 ++++++ recipes/pyopenssl/__init__.py | 20 ++++++ recipes/python/ModulesSetup | 5 ++ recipes/python/ModulesSetup.mobile | 2 - recipes/python/__init__.py | 5 +- recipes/pyyaml/__init__.py | 2 +- recipes/qrcode/__init__.py | 20 ++++++ recipes/requests/__init__.py | 20 ++++++ recipes/service_identity/__init__.py | 20 ++++++ recipes/setuptools/__init__.py | 31 ++++++++++ recipes/six/__init__.py | 20 ++++++ recipes/slowaes/__init__.py | 20 ++++++ recipes/treq/__init__.py | 20 ++++++ recipes/twisted/__init__.py | 34 ++++++++++ .../twisted/remove_portmap_extension.patch | 14 +++++ recipes/txjson-rpc/__init__.py | 20 ++++++ recipes/txrequests/__init__.py | 20 ++++++ recipes/wsgiref/__init__.py | 20 ++++++ recipes/zope_interface/__init__.py | 20 ++++++ 59 files changed, 1238 insertions(+), 26 deletions(-) create mode 100644 recipes/appdirs/__init__.py create mode 100644 recipes/argparse/__init__.py create mode 100644 recipes/asn1crypto/__init__.py create mode 100644 recipes/attrs/__init__.py create mode 100644 recipes/base58/__init__.py create mode 100644 recipes/cffi/__init__.py create mode 100644 recipes/colorama/__init__.py create mode 100644 recipes/constantly/__init__.py create mode 100644 recipes/cryptography/__init__.py create mode 100644 recipes/cryptography/getentropy.patch create mode 100644 recipes/cryptography/osrandom.patch create mode 100644 recipes/dnspython/__init__.py create mode 100644 recipes/docopt/__init__.py create mode 100644 recipes/ecdsa/__init__.py create mode 100644 recipes/enum34/__init__.py create mode 100644 recipes/envparse/__init__.py create mode 100644 recipes/functools32/__init__.py create mode 100644 recipes/host_cffi/__init__.py delete mode 100644 recipes/hostpython/_scproxy.py create mode 100644 recipes/idna/__init__.py create mode 100644 recipes/incremental/__init__.py create mode 100644 recipes/ipaddress/__init__.py create mode 100644 recipes/jsonrpc/__init__.py create mode 100644 recipes/jsonrpclib/__init__.py create mode 100644 recipes/jsonschema/__init__.py create mode 100644 recipes/keyring/__init__.py create mode 100644 recipes/lbry/__init__.py create mode 100644 recipes/lbryschema/__init__.py create mode 100644 recipes/lbryum/__init__.py create mode 100644 recipes/miniupnpc/__init__.py create mode 100644 recipes/pbkdf2/__init__.py create mode 100644 recipes/protobuf/__init__.py create mode 100644 recipes/pyasn1-modules/__init__.py create mode 100644 recipes/pyasn1/__init__.py create mode 100644 recipes/pycparser/__init__.py create mode 100644 recipes/pygithub/__init__.py create mode 100644 recipes/pyjwt/__init__.py create mode 100644 recipes/pyopenssl/__init__.py delete mode 100644 recipes/python/ModulesSetup.mobile create mode 100644 recipes/qrcode/__init__.py create mode 100644 recipes/requests/__init__.py create mode 100644 recipes/service_identity/__init__.py create mode 100644 recipes/setuptools/__init__.py create mode 100644 recipes/six/__init__.py create mode 100644 recipes/slowaes/__init__.py create mode 100644 recipes/treq/__init__.py create mode 100644 recipes/twisted/__init__.py create mode 100644 recipes/twisted/remove_portmap_extension.patch create mode 100644 recipes/txjson-rpc/__init__.py create mode 100644 recipes/txrequests/__init__.py create mode 100644 recipes/wsgiref/__init__.py create mode 100644 recipes/zope_interface/__init__.py diff --git a/recipes/appdirs/__init__.py b/recipes/appdirs/__init__.py new file mode 100644 index 0000000..12ff802 --- /dev/null +++ b/recipes/appdirs/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class AppdirsRecipe(PythonRecipe): + version = "1.4.3" + url = "https://pypi.python.org/packages/source/a/appdirs/appdirs-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = AppdirsRecipe() diff --git a/recipes/argparse/__init__.py b/recipes/argparse/__init__.py new file mode 100644 index 0000000..ce0cefd --- /dev/null +++ b/recipes/argparse/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ArgparseRecipe(PythonRecipe): + version = "1.2.1" + url = "https://pypi.python.org/packages/source/a/argparse/argparse-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ArgparseRecipe() diff --git a/recipes/asn1crypto/__init__.py b/recipes/asn1crypto/__init__.py new file mode 100644 index 0000000..e939160 --- /dev/null +++ b/recipes/asn1crypto/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Asn1CryptoRecipe(PythonRecipe): + version = "0.24.0" + url = "https://pypi.python.org/packages/source/a/asn1crypto/asn1crypto-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Asn1CryptoRecipe() diff --git a/recipes/attrs/__init__.py b/recipes/attrs/__init__.py new file mode 100644 index 0000000..57a0687 --- /dev/null +++ b/recipes/attrs/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class AttrsRecipe(PythonRecipe): + version = "18.1.0" + url = "https://pypi.python.org/packages/source/a/attrs/attrs-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = AttrsRecipe() diff --git a/recipes/base58/__init__.py b/recipes/base58/__init__.py new file mode 100644 index 0000000..f8fbc4f --- /dev/null +++ b/recipes/base58/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Base58Recipe(PythonRecipe): + version = "0.2.2" + url = "https://pypi.python.org/packages/source/b/base58/base58-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Base58Recipe() diff --git a/recipes/cffi/__init__.py b/recipes/cffi/__init__.py new file mode 100644 index 0000000..f4d06b7 --- /dev/null +++ b/recipes/cffi/__init__.py @@ -0,0 +1,41 @@ +from toolchain import CythonRecipe, shprint +from os.path import join +import os +import sh + + +class CffiRecipe(CythonRecipe): + name = "cffi" + version = "1.11.5" + url = "https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz" + library = "libcffi.a" + depends = ["host_cffi", "libffi", "setuptools", "pycparser"] + cythonize = False + + def get_recipe_env(self, arch): + env = super(CffiRecipe, self).get_recipe_env(arch) + env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "include", arch.arch, "libffi")) + env["LDFLAGS"] = " ".join([ + env.get('CFLAGS', '') + ]) + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "build_ext", _env=build_env) + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = CffiRecipe() diff --git a/recipes/colorama/__init__.py b/recipes/colorama/__init__.py new file mode 100644 index 0000000..b3728f4 --- /dev/null +++ b/recipes/colorama/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ColoramaRecipe(PythonRecipe): + version = "0.3.7" + url = "https://pypi.python.org/packages/source/c/colorama/colorama-{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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ColoramaRecipe() diff --git a/recipes/constantly/__init__.py b/recipes/constantly/__init__.py new file mode 100644 index 0000000..8aaa965 --- /dev/null +++ b/recipes/constantly/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ConstantlyRecipe(PythonRecipe): + version = "15.1.0" + url = "https://pypi.python.org/packages/source/c/constantly/constantly-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ConstantlyRecipe() diff --git a/recipes/cryptography/__init__.py b/recipes/cryptography/__init__.py new file mode 100644 index 0000000..42fe487 --- /dev/null +++ b/recipes/cryptography/__init__.py @@ -0,0 +1,60 @@ +from os.path import join +from toolchain import CythonRecipe, PythonRecipe, Recipe +from toolchain import shprint +import os +import sh + + +class CryptographyRecipe(CythonRecipe): + name = "cryptography" + version = "2.2.2" + url = "https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz" + library = "libcryptography.a" + depends = ["host_setuptools", "host_cffi", "setuptools", "asn1crypto", + "cffi", "enum34", "idna", "ipaddress", "six"] + cythonize = False + + def prebuild_arch(self, arch): + if self.has_marker("patched"): + return + self.apply_patch("getentropy.patch") + self.apply_patch("osrandom.patch") + self.set_marker("patched") + + def get_recipe_env(self, arch): + env = super(CryptographyRecipe, self).get_recipe_env(arch) + r = self.get_recipe('openssl', self.ctx) + openssl_dir = r.get_build_dir(arch.arch) + target_python = Recipe.get_recipe('python', self.ctx).get_build_dir(arch.arch) + + env['PYTHON_ROOT'] = join(self.ctx.dist_dir, "root", "python") + env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics" + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \ + ' -I' + join(openssl_dir, 'include') + \ + ' -I' + join(self.ctx.dist_dir, "include", arch.arch, "libffi") + env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \ + ' -L' + openssl_dir + \ + ' -lpython2.7' + \ + ' -lssl' + r.version + \ + ' -lcrypto' + r.version + 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) + +recipe = CryptographyRecipe() diff --git a/recipes/cryptography/getentropy.patch b/recipes/cryptography/getentropy.patch new file mode 100644 index 0000000..97b8a84 --- /dev/null +++ b/recipes/cryptography/getentropy.patch @@ -0,0 +1,45 @@ +--- cryptography-2.2.2/src/_cffi_src/openssl/src/osrandom_engine.c 2018-03-27 15:12:05.000000000 +0100 ++++ cryptography-2.2.2-patch/src/_cffi_src/openssl/src/osrandom_engine.c 2018-06-02 05:21:49.000000000 +0100 +@@ -205,14 +205,10 @@ + #if !defined(__APPLE__) + getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS; + #else +- if (&getentropy != NULL) { +- getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS; +- } else { +- getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_FALLBACK; +- int fd = dev_urandom_fd(); +- if (fd < 0) { +- return 0; +- } ++ getentropy_works = CRYPTOGRAPHY_OSRANDOM_GETENTROPY_FALLBACK; ++ int fd = dev_urandom_fd(); ++ if (fd < 0) { ++ return 0; + } + #endif + return 1; +@@ -228,22 +224,7 @@ + return dev_urandom_read(buffer, size); + #endif + case CRYPTOGRAPHY_OSRANDOM_GETENTROPY_WORKS: +- while (size > 0) { +- /* OpenBSD and macOS restrict maximum buffer size to 256. */ +- len = size > 256 ? 256 : (size_t)size; +- res = getentropy(buffer, len); +- if (res < 0) { +- ERR_Cryptography_OSRandom_error( +- CRYPTOGRAPHY_OSRANDOM_F_RAND_BYTES, +- CRYPTOGRAPHY_OSRANDOM_R_GETENTROPY_FAILED, +- __FILE__, __LINE__ +- ); +- return 0; +- } +- buffer += len; +- size -= len; +- } +- return 1; ++ return 0; + } + __builtin_unreachable(); + } diff --git a/recipes/cryptography/osrandom.patch b/recipes/cryptography/osrandom.patch new file mode 100644 index 0000000..630cc30 --- /dev/null +++ b/recipes/cryptography/osrandom.patch @@ -0,0 +1,16 @@ +--- cryptography-2.2.2/src/_cffi_src/openssl/src/osrandom_engine.h 2018-03-27 15:12:05.000000000 +0100 ++++ cryptography-2.2.2-patch/src/_cffi_src/openssl/src/osrandom_engine.h 2018-06-02 05:06:04.000000000 +0100 +@@ -11,13 +11,6 @@ + #include + #endif + +- #ifdef __APPLE__ +- #include +- /* To support weak linking we need to declare this as a weak import even if +- * it's not present in sys/random (e.g. macOS < 10.12). */ +- extern int getentropy(void *buffer, size_t size) __attribute((weak_import)); +- #endif +- + #ifdef __linux__ + /* for SYS_getrandom */ + #include diff --git a/recipes/dnspython/__init__.py b/recipes/dnspython/__init__.py new file mode 100644 index 0000000..96de195 --- /dev/null +++ b/recipes/dnspython/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class DnsPythonRecipe(PythonRecipe): + version = "1.12.0" + url = "http://www.dnspython.org/kits/{version}/dnspython-{version}.zip" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = DnsPythonRecipe() diff --git a/recipes/docopt/__init__.py b/recipes/docopt/__init__.py new file mode 100644 index 0000000..f6d9638 --- /dev/null +++ b/recipes/docopt/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class DocoptRecipe(PythonRecipe): + version = "0.6.2" + url = "https://pypi.python.org/packages/source/d/docopt/docopt-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = DocoptRecipe() diff --git a/recipes/ecdsa/__init__.py b/recipes/ecdsa/__init__.py new file mode 100644 index 0000000..062f443 --- /dev/null +++ b/recipes/ecdsa/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class EcdsaRecipe(PythonRecipe): + version = "0.13" + url = "https://pypi.python.org/packages/source/e/ecdsa/ecdsa-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = EcdsaRecipe() diff --git a/recipes/enum34/__init__.py b/recipes/enum34/__init__.py new file mode 100644 index 0000000..9635622 --- /dev/null +++ b/recipes/enum34/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Enum34Recipe(PythonRecipe): + version = "1.1.6" + url = "https://pypi.python.org/packages/source/e/enum34/enum34-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Enum34Recipe() diff --git a/recipes/envparse/__init__.py b/recipes/envparse/__init__.py new file mode 100644 index 0000000..66965b0 --- /dev/null +++ b/recipes/envparse/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class EnvparseRecipe(PythonRecipe): + version = "0.2.0" + url = "https://pypi.python.org/packages/source/e/envparse/envparse-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = EnvparseRecipe() diff --git a/recipes/functools32/__init__.py b/recipes/functools32/__init__.py new file mode 100644 index 0000000..ea5be50 --- /dev/null +++ b/recipes/functools32/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Functools32Recipe(PythonRecipe): + version = "3.2.3-2" + url = "https://pypi.python.org/packages/source/f/functools32/functools32-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Functools32Recipe() diff --git a/recipes/host_cffi/__init__.py b/recipes/host_cffi/__init__.py new file mode 100644 index 0000000..1a8aa5f --- /dev/null +++ b/recipes/host_cffi/__init__.py @@ -0,0 +1,62 @@ +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.11.5" + archs = ["x86_64"] + url = "https://pypi.python.org/packages/source/c/cffi/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() diff --git a/recipes/host_setuptools/__init__.py b/recipes/host_setuptools/__init__.py index 5ee6056..c3f5fa0 100644 --- a/recipes/host_setuptools/__init__.py +++ b/recipes/host_setuptools/__init__.py @@ -9,12 +9,19 @@ import shutil class HostSetuptools(Recipe): depends = ["openssl", "hostpython"] archs = ["x86_64"] - url = "setuptools" + #url = "setuptools" + version = "18.5" + url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz" + cythonize = False + ''' def prebuild_arch(self, arch): - hostpython = sh.Command(self.ctx.hostpython) - sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py") - shprint(hostpython, "./ez_setup.py") + dest_dir = join( + self.ctx.dist_dir, 'hostpython', + 'lib', 'python2.7', 'site-packages') + #hostpython = sh.Command(self.ctx.hostpython) + #sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py") + #shprint(hostpython, "./ez_setup.py") # Extract setuptools egg and remove .pth files. Otherwise subsequent # python package installations using setuptools will raise exceptions. # Setuptools version 28.3.0 @@ -30,5 +37,16 @@ class HostSetuptools(Recipe): os.remove('setuptools.pth') os.remove('easy-install.pth') shutil.rmtree('EGG-INFO') - + ''' + + def install(self): + import sh + from toolchain import shprint + from os import chdir + arch = self.filtered_archs[0] + build_dir = self.get_build_dir(arch.arch) + chdir(build_dir) + hostpython = sh.Command(self.ctx.hostpython) + shprint(hostpython, "setup.py", "install", "--prefix", "{}/hostpython".format(self.ctx.dist_dir)) + recipe = HostSetuptools() diff --git a/recipes/hostpython/ModulesSetup b/recipes/hostpython/ModulesSetup index 6affaed..677149d 100644 --- a/recipes/hostpython/ModulesSetup +++ b/recipes/hostpython/ModulesSetup @@ -54,3 +54,5 @@ future_builtins future_builtins.c # ctypes _ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c +# scproxy +_scproxy -framework SystemConfiguration -framework CoreFoundation _scproxy.c diff --git a/recipes/hostpython/__init__.py b/recipes/hostpython/__init__.py index 4dd92b0..b185b44 100644 --- a/recipes/hostpython/__init__.py +++ b/recipes/hostpython/__init__.py @@ -22,11 +22,11 @@ class HostpythonRecipe(Recipe): def prebuild_arch(self, arch): if self.has_marker("patched"): return - self.copy_file("_scproxy.py", "Lib/_scproxy.py") self.apply_patch("ssize-t-max.patch") - self.apply_patch("dynload.patch") + #self.apply_patch("dynload.patch") self.apply_patch("static-_sqlite3.patch") self.copy_file("ModulesSetup", "Modules/Setup.local") + self.copy_file(join(self.build_dir, "Mac/Modules/_scproxy.c"), "Modules/_scproxy.c") if "openssl.build_all" in self.ctx.state: self.append_file("ModulesSetup.openssl", "Modules/Setup.local") self.set_marker("patched") @@ -58,13 +58,14 @@ class HostpythonRecipe(Recipe): "-lffi", "-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib")) ]) + build_env["CFLAGS"] = " ".join([ "--sysroot={}".format(sdk_path), "-arch x86_64", "-mmacosx-version-min=10.12", "-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include")) ]) - + if "openssl.build_all" in self.ctx.state: build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "hostopenssl", "include")) build_env["LDFLAGS"] += " -L{}".format(join(self.ctx.dist_dir, "hostopenssl", "lib")) @@ -72,9 +73,10 @@ class HostpythonRecipe(Recipe): configure = sh.Command(join(self.build_dir, "configure")) shprint(configure, "--prefix={}".format(join(self.ctx.dist_dir, "hostpython")), - "--disable-toolbox-glue", + "--disable-toolbox-glue" "--without-gcc", _env=build_env) + shprint(sh.make, self.ctx.concurrent_make, _env=build_env) shprint(sh.make, "-C", self.build_dir, self.ctx.concurrent_make, "python", "Parser/pgen", _env=build_env) shutil.move("python", "hostpython") @@ -107,6 +109,12 @@ class HostpythonRecipe(Recipe): shutil.copy( join(build_dir, "Parser", "pgen"), join(self.ctx.dist_dir, "hostpython", "bin", "pgen")) + shutil.copy( + join(build_dir, "build", "lib.macosx-10.4-x86_64-2.7", "_sysconfigdata.py"), + join(pylib_dir, "_sysconfigdata.py")) + shutil.copy( + join(build_dir, "build", "lib.macosx-10.4-x86_64-2.7", "_sysconfigdata.pyc"), + join(pylib_dir, "_sysconfigdata.pyc")) recipe = HostpythonRecipe() diff --git a/recipes/hostpython/_scproxy.py b/recipes/hostpython/_scproxy.py deleted file mode 100644 index 11c8409..0000000 --- a/recipes/hostpython/_scproxy.py +++ /dev/null @@ -1,10 +0,0 @@ -''' -Stub functions for _scproxy on OsX -No proxy is supported yet. -''' - -def _get_proxy_settings(): - return {'exclude_simple': 1} - -def _get_proxies(): - return {} diff --git a/recipes/idna/__init__.py b/recipes/idna/__init__.py new file mode 100644 index 0000000..1e477b2 --- /dev/null +++ b/recipes/idna/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class IdnaRecipe(PythonRecipe): + version = "2.6" + url = "https://pypi.python.org/packages/source/i/idna/idna-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = IdnaRecipe() diff --git a/recipes/incremental/__init__.py b/recipes/incremental/__init__.py new file mode 100644 index 0000000..f0e7461 --- /dev/null +++ b/recipes/incremental/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class IncrementalRecipe(PythonRecipe): + version = "17.5.0" + url = "https://pypi.python.org/packages/source/i/incremental/incremental-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = IncrementalRecipe() diff --git a/recipes/ipaddress/__init__.py b/recipes/ipaddress/__init__.py new file mode 100644 index 0000000..c3b3d52 --- /dev/null +++ b/recipes/ipaddress/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class IpaddressRecipe(PythonRecipe): + version = "1.0.22" + url = "https://pypi.python.org/packages/source/i/ipaddress/ipaddress-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = IpaddressRecipe() diff --git a/recipes/jsonrpc/__init__.py b/recipes/jsonrpc/__init__.py new file mode 100644 index 0000000..6261b51 --- /dev/null +++ b/recipes/jsonrpc/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class JsonrpcRecipe(PythonRecipe): + version = "1.2" + url = "https://pypi.python.org/packages/source/j/jsonrpc/jsonrpc-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = JsonrpcRecipe() diff --git a/recipes/jsonrpclib/__init__.py b/recipes/jsonrpclib/__init__.py new file mode 100644 index 0000000..08f89f5 --- /dev/null +++ b/recipes/jsonrpclib/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class JsonrpclibRecipe(PythonRecipe): + version = "0.1.7" + url = "https://pypi.python.org/packages/source/j/jsonrpclib/jsonrpclib-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = JsonrpclibRecipe() diff --git a/recipes/jsonschema/__init__.py b/recipes/jsonschema/__init__.py new file mode 100644 index 0000000..84522bb --- /dev/null +++ b/recipes/jsonschema/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class JsonschemaRecipe(PythonRecipe): + version = "2.6.0" + url = "https://pypi.python.org/packages/source/j/jsonschema/jsonschema-{version}.tar.gz" + depends = ["python", "setuptools", "functools32"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = JsonschemaRecipe() diff --git a/recipes/keyring/__init__.py b/recipes/keyring/__init__.py new file mode 100644 index 0000000..ab02d6c --- /dev/null +++ b/recipes/keyring/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class KeyringRecipe(PythonRecipe): + version = "10.4.0" + url = "https://pypi.python.org/packages/source/k/keyring/keyring-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = KeyringRecipe() diff --git a/recipes/lbry/__init__.py b/recipes/lbry/__init__.py new file mode 100644 index 0000000..4a425ae --- /dev/null +++ b/recipes/lbry/__init__.py @@ -0,0 +1,51 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class LbryRecipe(PythonRecipe): + version = "v0.20.0rc10" + url = "https://github.com/lbryio/lbry/archive/{version}.tar.gz" + depends = [ + "python", + "setuptools", + "twisted", + "cryptography", + "appdirs", + "argparse", + "docopt", + "base58", + "colorama", + "dnspython", + "ecdsa", + "envparse", + "jsonrpc", + "jsonrpclib", + "keyring", + "lbryschema", + "lbryum", + "miniupnpc", + "pbkdf2", + "pyyaml", + "pygithub", + "qrcode", + "requests", + "service_identity", + "six", + "slowaes", + "txjson-rpc", + "wsgiref", + "zope_interface", + "treq" + ] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = LbryRecipe() diff --git a/recipes/lbryschema/__init__.py b/recipes/lbryschema/__init__.py new file mode 100644 index 0000000..a228d06 --- /dev/null +++ b/recipes/lbryschema/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class LbrySchemaRecipe(PythonRecipe): + version = "v0.0.16rc2" + url = "https://github.com/lbryio/lbryschema/archive/{version}.tar.gz" + depends = ["python", "setuptools", "ecdsa", "jsonschema", "protobuf"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = LbrySchemaRecipe() diff --git a/recipes/lbryum/__init__.py b/recipes/lbryum/__init__.py new file mode 100644 index 0000000..fc56507 --- /dev/null +++ b/recipes/lbryum/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class LbryumRecipe(PythonRecipe): + version = "v3.2.2rc1" + url = "https://github.com/lbryio/lbryum/archive/{version}.tar.gz" + depends = ["python", "setuptools", "appdirs", "ecdsa", "jsonrpclib", "keyring", "lbryschema"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = LbryumRecipe() diff --git a/recipes/miniupnpc/__init__.py b/recipes/miniupnpc/__init__.py new file mode 100644 index 0000000..4992d1e --- /dev/null +++ b/recipes/miniupnpc/__init__.py @@ -0,0 +1,26 @@ +from toolchain import CythonRecipe, shprint +from os.path import join +import os +import sh + + +class MiniupnpcRecipe(CythonRecipe): + name = "miniupnpc" + version = "1.9" + url = "https://pypi.python.org/packages/source/m/miniupnpc/miniupnpc-{version}.tar.gz" + library = "libminiupnpc.a" + depends = ["python", "setuptools"] + cythonize = False + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = MiniupnpcRecipe() diff --git a/recipes/pbkdf2/__init__.py b/recipes/pbkdf2/__init__.py new file mode 100644 index 0000000..ce3fc5d --- /dev/null +++ b/recipes/pbkdf2/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Pbkdf2Recipe(PythonRecipe): + version = "1.3" + url = "https://pypi.python.org/packages/source/p/pbkdf2/pbkdf2-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Pbkdf2Recipe() diff --git a/recipes/protobuf/__init__.py b/recipes/protobuf/__init__.py new file mode 100644 index 0000000..bc04bd0 --- /dev/null +++ b/recipes/protobuf/__init__.py @@ -0,0 +1,21 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ProtobufRecipe(PythonRecipe): + version = "3.2.0" + url = "https://pypi.python.org/packages/source/p/protobuf/protobuf-{version}.tar.gz" + depends = ["python", "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") + build_env['PATH'] = '' + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ProtobufRecipe() diff --git a/recipes/pyasn1-modules/__init__.py b/recipes/pyasn1-modules/__init__.py new file mode 100644 index 0000000..ada572c --- /dev/null +++ b/recipes/pyasn1-modules/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Pyasn1ModulesRecipe(PythonRecipe): + version = "0.2.1" + url = "https://pypi.python.org/packages/source/p/pyasn1-modules/pyasn1-modules-{version}.tar.gz" + depends = ["python", "setuptools", "pyasn1"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Pyasn1ModulesRecipe() diff --git a/recipes/pyasn1/__init__.py b/recipes/pyasn1/__init__.py new file mode 100644 index 0000000..45a2f22 --- /dev/null +++ b/recipes/pyasn1/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class Pyasn1Recipe(PythonRecipe): + version = "0.4.3" + url = "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = Pyasn1Recipe() diff --git a/recipes/pycparser/__init__.py b/recipes/pycparser/__init__.py new file mode 100644 index 0000000..d2d8a68 --- /dev/null +++ b/recipes/pycparser/__init__.py @@ -0,0 +1,32 @@ +from os.path import join +from toolchain import PythonRecipe +from toolchain import shprint +import os +import sh + + +class PycparserRecipe(PythonRecipe): + version = "2.18" + url = "https://pypi.python.org/packages/source/p/pycparser/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 + build_env['PYTHONHOME'] = '/usr' + 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() diff --git a/recipes/pycrypto/__init__.py b/recipes/pycrypto/__init__.py index 4b8f49f..989120c 100644 --- a/recipes/pycrypto/__init__.py +++ b/recipes/pycrypto/__init__.py @@ -13,7 +13,6 @@ class PycryptoRecipe(CythonRecipe): include_per_arch = True library="libpycrypto.a" - def build_arch(self, arch): build_env = arch.get_env() self.apply_patch('hash_SHA2_template.c.patch', target_dir=self.build_dir + '/src') diff --git a/recipes/pygithub/__init__.py b/recipes/pygithub/__init__.py new file mode 100644 index 0000000..6c54686 --- /dev/null +++ b/recipes/pygithub/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class PyGithubRecipe(PythonRecipe): + version = "1.34" + url = "https://pypi.python.org/packages/source/p/pygithub/PyGithub-{version}.tar.gz" + depends = ["python", "setuptools", "pyjwt"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = PyGithubRecipe() diff --git a/recipes/pyjwt/__init__.py b/recipes/pyjwt/__init__.py new file mode 100644 index 0000000..2f6212b --- /dev/null +++ b/recipes/pyjwt/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class PyJWTRecipe(PythonRecipe): + version = "1.6.4" + url = "https://pypi.python.org/packages/source/p/pyjwt/PyJWT-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = PyJWTRecipe() diff --git a/recipes/pyopenssl/__init__.py b/recipes/pyopenssl/__init__.py new file mode 100644 index 0000000..f7eaa62 --- /dev/null +++ b/recipes/pyopenssl/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class PyOpenSSLRecipe(PythonRecipe): + version = "17.4.0" + url = "https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-{version}.tar.gz" + depends = ["python", "setuptools", "cryptography", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = PyOpenSSLRecipe() diff --git a/recipes/python/ModulesSetup b/recipes/python/ModulesSetup index 10de7a9..edb3cd7 100644 --- a/recipes/python/ModulesSetup +++ b/recipes/python/ModulesSetup @@ -52,3 +52,8 @@ pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Mo # Future (used by numpy) future_builtins future_builtins.c +# Ctypes +_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -I$(srcdir)/../../build/include/ffi + +# scproxy +# _scproxy -framework SystemConfiguration -framework CoreFoundation _scproxy.c diff --git a/recipes/python/ModulesSetup.mobile b/recipes/python/ModulesSetup.mobile deleted file mode 100644 index 826bf1c..0000000 --- a/recipes/python/ModulesSetup.mobile +++ /dev/null @@ -1,2 +0,0 @@ -# Ctypes -_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -I$(srcdir)/../../build/include/ffi diff --git a/recipes/python/__init__.py b/recipes/python/__init__.py index 04c703c..c6c3858 100644 --- a/recipes/python/__init__.py +++ b/recipes/python/__init__.py @@ -23,15 +23,14 @@ class PythonRecipe(Recipe): # common to all archs if self.has_marker("patched"): return + self.copy_file("ModulesSetup", "Modules/Setup.local") + self.copy_file("_scproxy.py", "Lib/_scproxy.py") self.apply_patch("ssize-t-max.patch") self.apply_patch("dynload.patch") self.apply_patch("static-_sqlite3.patch") - self.copy_file("ModulesSetup", "Modules/Setup.local") - self.copy_file("_scproxy.py", "Lib/_scproxy.py") self.apply_patch("xcompile.patch") self.apply_patch("setuppath.patch") self.apply_patch("posixmodule.patch") - self.append_file("ModulesSetup.mobile", "Modules/Setup.local") if "openssl.build_all" in self.ctx.state: self.append_file("ModulesSetup.openssl", "Modules/Setup.local") diff --git a/recipes/pyyaml/__init__.py b/recipes/pyyaml/__init__.py index 9f06bfa..2e58384 100644 --- a/recipes/pyyaml/__init__.py +++ b/recipes/pyyaml/__init__.py @@ -4,7 +4,7 @@ import sh from toolchain import PythonRecipe, shprint class PyYamlRecipe(PythonRecipe): - version = "3.11" + version = "3.12" url = "https://pypi.python.org/packages/source/P/PyYAML/PyYAML-{version}.tar.gz" depends = ["python"] diff --git a/recipes/qrcode/__init__.py b/recipes/qrcode/__init__.py new file mode 100644 index 0000000..59ea1ac --- /dev/null +++ b/recipes/qrcode/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class QrcodeRecipe(PythonRecipe): + version = "5.2.2" + url = "https://pypi.python.org/packages/source/q/qrcode/qrcode-{version}.tar.gz" + depends = ["python", "setuptools", "colorama", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = QrcodeRecipe() diff --git a/recipes/requests/__init__.py b/recipes/requests/__init__.py new file mode 100644 index 0000000..d8fba04 --- /dev/null +++ b/recipes/requests/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class RequestsRecipe(PythonRecipe): + version = "2.9.1" + url = "https://pypi.python.org/packages/source/r/requests/requests-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = RequestsRecipe() diff --git a/recipes/service_identity/__init__.py b/recipes/service_identity/__init__.py new file mode 100644 index 0000000..16a04e7 --- /dev/null +++ b/recipes/service_identity/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ServiceIdentityRecipe(PythonRecipe): + version = "16.0.0" + url = "https://pypi.python.org/packages/source/s/service_identity/service_identity-{version}.tar.gz" + depends = ["python", "setuptools", "attrs", "pyasn1", "pyasn1-modules", "pyopenssl"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ServiceIdentityRecipe() diff --git a/recipes/setuptools/__init__.py b/recipes/setuptools/__init__.py new file mode 100644 index 0000000..f491a11 --- /dev/null +++ b/recipes/setuptools/__init__.py @@ -0,0 +1,31 @@ +from toolchain import CythonRecipe + + +class SetuptoolsRecipe(CythonRecipe): + name = "setuptools" + version = "18.5" + url = "https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz" + depends = ["python", "host_setuptools"] + cythonize = False + + def get_recipe_env(self, arch): + env = super(SetuptoolsRecipe, self).get_recipe_env(arch) + env["PYTHONPATH"] = self.get_build_dir(arch.arch) + "/iosbuild/lib/python2.7/site-packages" + return env + + def install(self): + import sh + from toolchain import shprint + from os import chdir + arch = self.filtered_archs[0] + + build_env = arch.get_env() + + build_dir = self.get_build_dir(arch.arch) + chdir(build_dir) + hostpython = sh.Command(self.ctx.hostpython) + shprint(hostpython, "setup.py", "install", "--prefix", self.ctx.install_dir, "--old-and-unmanageable") + # "--single-version-externally-managed", "--root", "/", "-O2") + + +recipe = SetuptoolsRecipe() diff --git a/recipes/six/__init__.py b/recipes/six/__init__.py new file mode 100644 index 0000000..8c79f4b --- /dev/null +++ b/recipes/six/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class SixRecipe(PythonRecipe): + version = "1.11.0" + url = "https://pypi.python.org/packages/source/s/six/six-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = SixRecipe() diff --git a/recipes/slowaes/__init__.py b/recipes/slowaes/__init__.py new file mode 100644 index 0000000..2f626d2 --- /dev/null +++ b/recipes/slowaes/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class SlowaesRecipe(PythonRecipe): + version = "0.1a1" + url = "https://pypi.python.org/packages/source/s/slowaes/slowaes-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = SlowaesRecipe() diff --git a/recipes/treq/__init__.py b/recipes/treq/__init__.py new file mode 100644 index 0000000..7ebbc22 --- /dev/null +++ b/recipes/treq/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class TreqRecipe(PythonRecipe): + version = "17.8.0" + url = "https://pypi.python.org/packages/source/t/treq/treq-{version}.tar.gz" + depends = ["python", "setuptools", "six", "twisted"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = TreqRecipe() diff --git a/recipes/twisted/__init__.py b/recipes/twisted/__init__.py new file mode 100644 index 0000000..79b4696 --- /dev/null +++ b/recipes/twisted/__init__.py @@ -0,0 +1,34 @@ +from toolchain import CythonRecipe, shprint +from os.path import join +import os +import sh + + +class TwistedRecipe(CythonRecipe): + name = "twisted" + version = "16.6.0" + url = "https://github.com/twisted/twisted/archive/twisted-{version}.tar.gz" + library = "libtwisted.a" + depends = ["python", "setuptools", "constantly", "incremental", "zope_interface"] + optional_depends = ["pyopenssl"] + cythonize = False + + def prebuild_arch(self, arch): + if self.has_marker("patched"): + return + self.apply_patch("remove_portmap_extension.patch") + + self.set_marker("patched") + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + +recipe = TwistedRecipe() diff --git a/recipes/twisted/remove_portmap_extension.patch b/recipes/twisted/remove_portmap_extension.patch new file mode 100644 index 0000000..a1f46fa --- /dev/null +++ b/recipes/twisted/remove_portmap_extension.patch @@ -0,0 +1,14 @@ +--- twisted-twisted-16.6.0/src/twisted/python/_setup.py 2016-11-17 09:10:00.000000000 +0100 ++++ twisted-twisted-16.6.0-patch/src/twisted/python/_setup.py 2018-06-02 08:05:51.000000000 +0100 +@@ -187,11 +187,6 @@ + sources=["src/twisted/python/_sendmsg.c"], + condition=lambda _: not _PY3 and sys.platform != "win32"), + +- ConditionalExtension( +- "twisted.runner.portmap", +- sources=["src/twisted/runner/portmap.c"], +- condition=lambda builder: not _PY3 and +- builder._check_header("rpc/rpc.h")), + ] + + diff --git a/recipes/txjson-rpc/__init__.py b/recipes/txjson-rpc/__init__.py new file mode 100644 index 0000000..c1210f1 --- /dev/null +++ b/recipes/txjson-rpc/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class TxJsonRpcRecipe(PythonRecipe): + version = "0.5" + url = "https://pypi.python.org/packages/source/t/txJSON-RPC/txJSON-RPC-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = TxJsonRpcRecipe() diff --git a/recipes/txrequests/__init__.py b/recipes/txrequests/__init__.py new file mode 100644 index 0000000..93a21b5 --- /dev/null +++ b/recipes/txrequests/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class TxRequestsRecipe(PythonRecipe): + version = "0.9.5" + url = "https://pypi.python.org/packages/source/t/txrequests/txrequests-{version}.tar.gz" + depends = ["python", "setuptools", "requests", "twisted"] + + 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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = TxRequestsRecipe() diff --git a/recipes/wsgiref/__init__.py b/recipes/wsgiref/__init__.py new file mode 100644 index 0000000..85ede68 --- /dev/null +++ b/recipes/wsgiref/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class WsgiRefRecipe(PythonRecipe): + version = "0.1.2" + url = "https://pypi.python.org/packages/source/w/wsgiref/wsgiref-{version}.zip" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = WsgiRefRecipe() diff --git a/recipes/zope_interface/__init__.py b/recipes/zope_interface/__init__.py new file mode 100644 index 0000000..b115b23 --- /dev/null +++ b/recipes/zope_interface/__init__.py @@ -0,0 +1,20 @@ +from toolchain import PythonRecipe, shprint +from os.path import join +import sh, os + +class ZopeInterfaceRecipe(PythonRecipe): + version = "4.5.0" + url = "https://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz" + depends = ["python", "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") + build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') + shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + +recipe = ZopeInterfaceRecipe() From 839307bb7551f9441c76dc8c9c10e4d558736fe7 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 2 Jun 2018 21:17:35 +0100 Subject: [PATCH 3/3] tweaks for cffi and python recipes --- recipes/cffi/__init__.py | 7 +++++++ recipes/python/ModulesSetup.openssl | 9 ++++++++- recipes/python/__init__.py | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/recipes/cffi/__init__.py b/recipes/cffi/__init__.py index f4d06b7..480a433 100644 --- a/recipes/cffi/__init__.py +++ b/recipes/cffi/__init__.py @@ -36,6 +36,13 @@ class CffiRecipe(CythonRecipe): build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') shprint(hostpython, "setup.py", "build_ext", _env=build_env) shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) + + # hack: copy _cffi_backend.so from hostpython + so_file = "_cffi_backend.so" + egg_name = "cffi-1.11.5-py2.7-macosx-10.4-x86_64.egg" # harded - needs to change + dest_dir = join(self.ctx.dist_dir, "root", "python", "lib", "python2.7", "site-packages", egg_name) + src_dir = join(self.ctx.dist_dir, "hostpython", "lib", "python2.7", "site-packages", egg_name) + sh.cp(join(src_dir, so_file), join(dest_dir, so_file)) recipe = CffiRecipe() diff --git a/recipes/python/ModulesSetup.openssl b/recipes/python/ModulesSetup.openssl index 331ec43..ca2dee7 100644 --- a/recipes/python/ModulesSetup.openssl +++ b/recipes/python/ModulesSetup.openssl @@ -1 +1,8 @@ -_ssl _ssl.c -DUSE_SSL -lssl -lcrypto +SSL= +SSL_LIBS= +_ssl _ssl.c \ + -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ + -L$(SSL_LIBS) -lssl -lcrypto +_hashlib _hashopenssl.c \ + -I$(SSL)/include -I$(SSL)/include/openssl \ + -L$(SSL_LIBS) -lssl -lcrypto diff --git a/recipes/python/__init__.py b/recipes/python/__init__.py index c6c3858..1330c6d 100644 --- a/recipes/python/__init__.py +++ b/recipes/python/__init__.py @@ -32,7 +32,13 @@ class PythonRecipe(Recipe): self.apply_patch("setuppath.patch") self.apply_patch("posixmodule.patch") if "openssl.build_all" in self.ctx.state: - self.append_file("ModulesSetup.openssl", "Modules/Setup.local") + self.copy_file("ModulesSetup.openssl", "Modules/Setup.openssl") + r = Recipe.get_recipe('openssl', self.ctx) + openssl_build_dir = r.get_build_dir(arch.arch) + shprint(sh.sed, '-i.backup', 's#^SSL=.*#SSL={}#'.format(openssl_build_dir), "Modules/Setup.openssl") + shprint(sh.sed, '-i.backup', 's#^SSL_LIBS=.*#SSL_LIBS={}#'.format(join(self.ctx.dist_dir, "lib")), "Modules/Setup.openssl") + os.system('cat Modules/Setup.openssl >> Modules/Setup.local') + sh.rm("Modules/Setup.openssl") self.set_marker("patched") @@ -42,6 +48,14 @@ class PythonRecipe(Recipe): local_arch = arch.arch if arch.arch == "arm64" : local_arch = "aarch64" + + if "openssl.build_all" in self.ctx.state: + r = Recipe.get_recipe('openssl', self.ctx) + openssl_build_dir = r.get_build_dir(arch.arch) + build_env['OPENSSL_VERSION'] = r.version + build_env['CFLAGS'] += ' -I%s' % join(openssl_build_dir, "include") + build_env['LDFLAGS'] += ' -L%s' % join(self.ctx.dist_dir, "lib") + shprint(configure, "CC={}".format(build_env["CC"]), "LD={}".format(build_env["LD"]), @@ -72,6 +86,7 @@ class PythonRecipe(Recipe): arch = list(self.filtered_archs)[0] build_env = arch.get_env() build_dir = self.get_build_dir(arch.arch) + build_env["LD_LIBRRAY_PATH"] = join(self.ctx.dist_dir, "lib") build_env["PATH"] = os.environ["PATH"] shprint(sh.make, "-C", build_dir,