Skip to content

Commit 1d4e128

Browse files
committed
Fix libffi includedir
Because the python3's recipe uses pkg-config to link with the libffi library, and pkg-config reads the libffi.pc file which does not have the right values for us because we never performed the install for the libffi recipe. With this, we will make sure that the libffi.pc files has the standard header values so the python build could make use of it and explicitly link with our library.
1 parent 7ff372c commit 1d4e128

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

pythonforandroid/recipes/libffi/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ class LibffiRecipe(Recipe):
1717
version = '3.2.1'
1818
url = 'https://github.com/libffi/libffi/archive/v{version}.tar.gz'
1919

20-
patches = ['remove-version-info.patch']
20+
patches = ['remove-version-info.patch',
21+
# This patch below is already included into libffi's master
22+
# branch and included in the pre-release 3.3rc0...so we should
23+
# remove this when we update the version number for libffi
24+
'fix-includedir.patch']
2125

2226
def should_build(self, arch):
2327
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so'))
@@ -30,7 +34,7 @@ def build_arch(self, arch):
3034
shprint(sh.Command('autoreconf'), '-vif', _env=env)
3135
shprint(sh.Command('./configure'),
3236
'--host=' + arch.command_prefix,
33-
'--prefix=' + self.ctx.get_python_install_dir(),
37+
'--prefix=' + self.get_build_dir(arch.arch),
3438
'--disable-builddir',
3539
'--enable-shared', _env=env)
3640
# '--with-sysroot={}'.format(self.ctx.ndk_platform),
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 982b89c01aca99c7bc229914fc1521f96930919b Mon Sep 17 00:00:00 2001
2+
From: Yen Chi Hsuan <[email protected]>
3+
Date: Sun, 13 Nov 2016 19:17:19 +0800
4+
Subject: [PATCH] Install public headers in the standard path
5+
6+
---
7+
include/Makefile.am | 3 +--
8+
libffi.pc.in | 2 +-
9+
2 files changed, 2 insertions(+), 3 deletions(-)
10+
11+
diff --git a/include/Makefile.am b/include/Makefile.am
12+
index bb241e88..c59df9fb 100644
13+
--- a/include/Makefile.am
14+
+++ b/include/Makefile.am
15+
@@ -6,5 +6,4 @@ DISTCLEANFILES=ffitarget.h
16+
noinst_HEADERS=ffi_common.h ffi_cfi.h
17+
EXTRA_DIST=ffi.h.in
18+
19+
-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
20+
-nodist_includes_HEADERS = ffi.h ffitarget.h
21+
+nodist_include_HEADERS = ffi.h ffitarget.h
22+
diff --git a/libffi.pc.in b/libffi.pc.in
23+
index edf6fde5..6fad83b4 100644
24+
--- a/libffi.pc.in
25+
+++ b/libffi.pc.in
26+
@@ -2,7 +2,7 @@ prefix=@prefix@
27+
exec_prefix=@exec_prefix@
28+
libdir=@libdir@
29+
toolexeclibdir=@toolexeclibdir@
30+
-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
31+
+includedir=@includedir@
32+
33+
Name: @PACKAGE_NAME@
34+
Description: Library supporting Foreign Function Interfaces

0 commit comments

Comments
 (0)