Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions pythonforandroid/recipes/cffi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import os
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.recipe import PyProjectRecipe


class CffiRecipe(CompiledComponentsPythonRecipe):
class CffiRecipe(PyProjectRecipe):
"""
Extra system dependencies: autoconf, automake and libtool.
"""
name = 'cffi'
version = '1.15.1'
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
version = '2.0.0'
url = 'https://github.com/python-cffi/cffi/archive/refs/tags/v{version}.tar.gz'

depends = ['setuptools', 'pycparser', 'libffi']
depends = ['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().get_hostrecipe_env(arch)
Expand All @@ -25,8 +22,8 @@ def get_hostrecipe_env(self, arch=None):
env['FFI_INC'] = ",".join(includes)
return env

def get_recipe_env(self, arch=None):
env = super().get_recipe_env(arch)
def get_recipe_env(self, arch=None, **kwargs):
env = super().get_recipe_env(arch, **kwargs)
libffi = self.get_recipe('libffi', self.ctx)
includes = libffi.get_include_dirs(arch)
env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes)
Expand All @@ -36,7 +33,7 @@ def get_recipe_env(self, arch=None):
env['LDFLAGS'] += ' -L{}'.format(os.path.join(self.ctx.bootstrap.build_dir, 'libs', arch.arch))
# required for libc and libdl
env['LDFLAGS'] += ' -L{}'.format(arch.ndk_lib_dir_versioned)
env['PYTHONPATH'] = ':'.join([
env['PYTHONPATH'] += ':'.join([
self.ctx.get_site_packages_dir(arch),
env['BUILDLIB_PATH'],
])
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/libffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def build_arch(self, arch):
shprint(sh.make, '-j', str(cpu_count()), 'libffi.la', _env=env)

def get_include_dirs(self, arch):
return [join(self.get_build_dir(arch.arch), 'include')]
return [join(self.get_build_dir(arch), 'include')]


recipe = LibffiRecipe()
Loading