experimenting with cryptography build

This commit is contained in:
Robert Niederreiter 2016-11-02 17:43:23 +01:00
parent 38230677fb
commit 1eed3853d5
3 changed files with 19 additions and 26 deletions

View file

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

View file

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

View file

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