From 839307bb7551f9441c76dc8c9c10e4d558736fe7 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 2 Jun 2018 21:17:35 +0100 Subject: [PATCH] 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,