From 1eed3853d5c786ad2a480571cd15d6e38fee8f2d Mon Sep 17 00:00:00 2001 From: Robert Niederreiter Date: Wed, 2 Nov 2016 17:43:23 +0100 Subject: [PATCH] experimenting with cryptography build --- recipes/cryptography/__init__.py | 33 +++++++++++++++--------------- recipes/pycrypto/__init__.py | 9 +------- recipes/zope_interface/__init__.py | 3 ++- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/recipes/cryptography/__init__.py b/recipes/cryptography/__init__.py index a34d4ed..798a1c2 100644 --- a/recipes/cryptography/__init__.py +++ b/recipes/cryptography/__init__.py @@ -16,7 +16,6 @@ class CryptographyRecipe(CythonRecipe): cythonize = False def get_recipe_env(self, arch): - env = super(CryptographyRecipe, self).get_recipe_env(arch) #env['LN_FLAGS'] = "-lboost_thread-mt" #env['PKG_CONFIG_PATH'] = join(self.ctx.dist_dir, "include", arch.arch, "libffi") #env['PKG_CONFIG_PATH'] += ":" + join(self.ctx.dist_dir, "include", arch.arch, "openssl") @@ -37,8 +36,8 @@ class CryptographyRecipe(CythonRecipe): #env["CFLAGS"] += " -I{}".format( # join(self.ctx.dist_dir, "include", arch.arch, "openssl", "openssl")) """ - dest_dir = join(self.ctx.dist_dir, "root", "python") - pythonpath = join(dest_dir, "lib", "python2.7", "site-packages") + #dest_dir = join(self.ctx.dist_dir, "root", "python") + #pythonpath = join(dest_dir, "lib", "python2.7", "site-packages") #env["PYTHONPATH"] = pythonpath #env["CC"] += " -I{}".format( # join(self.ctx.dist_dir, "include", arch.arch, "libffi")) @@ -46,20 +45,20 @@ class CryptographyRecipe(CythonRecipe): # join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib")) #env["CFLAGS"] += "-I{}".format( # join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include")) + env = super(CryptographyRecipe, self).get_recipe_env(arch) + r = self.get_recipe('openssl', self.ctx) + openssl_dir = r.get_build_dir(arch.arch) + env['PYTHON_ROOT'] = join(self.ctx.dist_dir, 'root', 'python') + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \ + ' -I' + join(openssl_dir, 'include') + # Set linker to use the correct gcc + env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions' + env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \ + ' -L' + openssl_dir + \ + ' -lpython2.7' + \ + ' -lssl' + r.version + \ + ' -lcrypto' + r.version return env - def install(self): - print 'INSTALL #####################################' - super(CryptographyRecipe, self).install() - - def build_arch(self, arch): - print 'BUILD_ARCH ###################################' - build_env = self.get_recipe_env(arch) - print 'ENV #################' - for k, v in sorted(build_env.items()): - print k + ': ' + v - hostpython = sh.Command(self.ctx.hostpython) - shprint(hostpython, "setup.py", "build_ext", "-g", "-v", _env=build_env) - self.biglink() - recipe = CryptographyRecipe() + diff --git a/recipes/pycrypto/__init__.py b/recipes/pycrypto/__init__.py index d6bee69..cf341c2 100644 --- a/recipes/pycrypto/__init__.py +++ b/recipes/pycrypto/__init__.py @@ -1,6 +1,6 @@ '''Recipe for pycrypto on ios ''' -from toolchain import CythonRecipe, shprint, build_logger +from toolchain import CythonRecipe, shprint from os.path import join, exists import sh import os @@ -15,7 +15,6 @@ class PycryptoRecipe(CythonRecipe): def build_arch(self, arch): - build_logger.log('PycryptoRecipe.build_arch()') build_env = arch.get_env() build_logger.log(**build_env) self.apply_patch('hash_SHA2_template.c.patch', target_dir=self.build_dir + '/src') @@ -34,19 +33,13 @@ class PycryptoRecipe(CythonRecipe): super(PycryptoRecipe, self).build_arch(arch) def install(self): - build_logger.log('PycryptoRecipe.install()') arch = list(self.filtered_archs)[0] - build_logger.log('arch:\n ', arch) build_dir = self.get_build_dir(arch.arch) - build_logger.log('build_dir:\n ', arch) os.chdir(build_dir) hostpython = sh.Command(self.ctx.hostpython) - build_logger.log('hostpython:\n ', hostpython) build_env = arch.get_env() dest_dir = join(self.ctx.dist_dir, "root", "python") - build_logger.log('dest_dir:\n ', dest_dir) build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages') - build_logger.log('build_env', **build_env) shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env) recipe = PycryptoRecipe() diff --git a/recipes/zope_interface/__init__.py b/recipes/zope_interface/__init__.py index 95b1f7b..82ce7a6 100644 --- a/recipes/zope_interface/__init__.py +++ b/recipes/zope_interface/__init__.py @@ -4,9 +4,10 @@ from toolchain import CythonRecipe class ZopeInterfaceRecipe(CythonRecipe): name = "zope" version = "4.3.2" - url = "https://github.com/zopefoundation/zope.interface/archive/{version}.zip" + url = 'http://pypi.python.org/packages/source/z/zope.interface/zope.interface-{version}.tar.gz' depends = ["python", "host_setuptools"] cythonize = False recipe = ZopeInterfaceRecipe() +