8b2694efb7
* fix build for openssl 1.1.1b required for sdk (cherry picked from commit aa49e3b2755b97b6331cdbbb89efc954de8d5977) * use js code from master * fix openssl recipe and tweak build (cherry picked from commit 6e94c27021c7bd7b1e880c2fc314850e36a5a38e) * remove unused build recipes (cherry picked from commit f5c0577bdb175bfc0990602936bbc9e2052e1f25)
53 lines
2.1 KiB
Python
53 lines
2.1 KiB
Python
import os
|
|
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
|
|
|
|
|
|
class CffiRecipe(CompiledComponentsPythonRecipe):
|
|
"""
|
|
Extra system dependencies: autoconf, automake and libtool.
|
|
"""
|
|
name = 'cffi'
|
|
version = '1.11.5'
|
|
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
|
|
|
|
depends = ['setuptools', 'pycparser', 'libffi']
|
|
|
|
patches = ['disable-pkg-config.patch']
|
|
|
|
# call_hostpython_via_targetpython = False
|
|
install_in_hostpython = True
|
|
|
|
def get_hostrecipe_env(self, arch=None):
|
|
# fixes missing ffi.h on some host systems (e.g. gentoo)
|
|
env = super(CffiRecipe, self).get_hostrecipe_env(arch)
|
|
libffi = self.get_recipe('libffi', self.ctx)
|
|
includes = libffi.get_include_dirs(arch)
|
|
env['FFI_INC'] = ",".join(includes)
|
|
return env
|
|
|
|
def get_recipe_env(self, arch=None):
|
|
env = super(CffiRecipe, self).get_recipe_env(arch)
|
|
libffi = self.get_recipe('libffi', self.ctx)
|
|
includes = libffi.get_include_dirs(arch)
|
|
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
|
|
env['CFLAGS'] += ' -I{}'.format(self.ctx.python_recipe.include_root(arch.arch))
|
|
env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' +
|
|
self.ctx.get_libs_dir(arch.arch))
|
|
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
|
|
# required for libc and libdl
|
|
ndk_dir = self.ctx.ndk_platform
|
|
ndk_lib_dir = os.path.join(ndk_dir, 'usr', 'lib')
|
|
env['LDFLAGS'] += ' -L{}'.format(ndk_lib_dir)
|
|
env['LDFLAGS'] += " --sysroot={}".format(self.ctx.ndk_platform)
|
|
env['PYTHONPATH'] = ':'.join([
|
|
self.ctx.get_site_packages_dir(),
|
|
env['BUILDLIB_PATH'],
|
|
])
|
|
env['LDFLAGS'] += ' -L{}'.format(self.ctx.python_recipe.link_root(arch.arch))
|
|
env['LDFLAGS'] += ' -lpython{}'.format(self.ctx.python_recipe.major_minor_version_string)
|
|
if 'python3' in self.ctx.python_recipe.name:
|
|
env['LDFLAGS'] += 'm'
|
|
return env
|
|
|
|
|
|
recipe = CffiRecipe()
|