Skip to content

Commit cbfa514

Browse files
authored
Merge pull request kivy#1364 from plapadoo/fix-cffi
Fix cffi build failing on some hosts
2 parents 0dc7664 + c7f6af8 commit cbfa514

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

pythonforandroid/recipes/cffi/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
1414
# call_hostpython_via_targetpython = False
1515
install_in_hostpython = True
1616

17+
def get_hostrecipe_env(self, arch=None):
18+
# fixes missing ffi.h on some host systems (e.g. gentoo)
19+
env = super(CffiRecipe, self).get_hostrecipe_env(arch)
20+
libffi = self.get_recipe('libffi', self.ctx)
21+
includes = libffi.get_include_dirs(arch)
22+
env['FFI_INC'] = ",".join(includes)
23+
return env
24+
1725
def get_recipe_env(self, arch=None):
1826
env = super(CffiRecipe, self).get_recipe_env(arch)
1927
# sets linker to use the correct gcc (cross compiler)

pythonforandroid/recipes/cffi/disable-pkg-config.patch

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
diff -Naur cffi-1.4.2/setup.py b/setup.py
2-
--- cffi-1.4.2/setup.py 2015-12-21 12:09:47.000000000 -0600
3-
+++ b/setup.py 2015-12-23 10:20:40.590622524 -0600
4-
@@ -5,8 +5,7 @@
1+
diff --git a/setup.py b/setup.py
2+
index c1db368..57311c3 100644
3+
--- a/setup.py
4+
+++ b/setup.py
5+
@@ -5,8 +5,7 @@ import errno
56

67
sources = ['c/_cffi_backend.c']
78
libraries = ['ffi']
89
-include_dirs = ['/usr/include/ffi',
910
- '/usr/include/libffi'] # may be changed by pkg-config
10-
+include_dirs = []
11+
+include_dirs = os.environ['FFI_INC'].split(",") if 'FFI_INC' in os.environ else []
1112
define_macros = []
1213
library_dirs = []
1314
extra_compile_args = []
14-
@@ -67,14 +66,7 @@
15+
@@ -67,14 +66,7 @@ def ask_supports_thread():
1516
sys.stderr.write("The above error message can be safely ignored\n")
1617

1718
def use_pkg_config():

0 commit comments

Comments
 (0)