tweaks for cffi and python recipes

This commit is contained in:
Akinwale Ariwodola 2018-06-02 21:17:35 +01:00
parent a1a7ae7d54
commit 839307bb75
3 changed files with 31 additions and 2 deletions

View file

@ -37,5 +37,12 @@ class CffiRecipe(CythonRecipe):
shprint(hostpython, "setup.py", "build_ext", _env=build_env) shprint(hostpython, "setup.py", "build_ext", _env=build_env)
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _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() recipe = CffiRecipe()

View file

@ -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

View file

@ -32,7 +32,13 @@ class PythonRecipe(Recipe):
self.apply_patch("setuppath.patch") self.apply_patch("setuppath.patch")
self.apply_patch("posixmodule.patch") self.apply_patch("posixmodule.patch")
if "openssl.build_all" in self.ctx.state: if "openssl.build_all" in self.ctx.state:
self.append_file("ModulesSetup.openssl", "Modules/Setup.local") self.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") self.set_marker("patched")
@ -42,6 +48,14 @@ class PythonRecipe(Recipe):
local_arch = arch.arch local_arch = arch.arch
if arch.arch == "arm64" : if arch.arch == "arm64" :
local_arch = "aarch64" 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, shprint(configure,
"CC={}".format(build_env["CC"]), "CC={}".format(build_env["CC"]),
"LD={}".format(build_env["LD"]), "LD={}".format(build_env["LD"]),
@ -72,6 +86,7 @@ class PythonRecipe(Recipe):
arch = list(self.filtered_archs)[0] arch = list(self.filtered_archs)[0]
build_env = arch.get_env() build_env = arch.get_env()
build_dir = self.get_build_dir(arch.arch) 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"] build_env["PATH"] = os.environ["PATH"]
shprint(sh.make, shprint(sh.make,
"-C", build_dir, "-C", build_dir,