commit:     bc2ac53cf53217339edc0b1f1f2009453d2b043b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 19 19:31:33 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 19 19:40:49 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc2ac53c

dev-lang/python: fix system libffi handling

 .../python/files/python-2.7.10-system-libffi.patch | 36 ++++++++++++++++++++++
 dev-lang/python/python-2.7.10-r3.ebuild            |  1 +
 dev-lang/python/python-2.7.10-r4.ebuild            |  1 +
 3 files changed, 38 insertions(+)

diff --git a/dev-lang/python/files/python-2.7.10-system-libffi.patch 
b/dev-lang/python/files/python-2.7.10-system-libffi.patch
new file mode 100644
index 0000000..0b49b79
--- /dev/null
+++ b/dev-lang/python/files/python-2.7.10-system-libffi.patch
@@ -0,0 +1,36 @@
+make sure we respect the system libffi setting in our build config.
+the compiler probing is fragile and can break in some situations.
+
+--- a/setup.py
++++ b/setup.py
+@@ -2069,7 +2069,7 @@ class PyBuildExt(build_ext):
+         return True
+ 
+     def detect_ctypes(self, inc_dirs, lib_dirs):
+-        self.use_system_libffi = False
++        self.use_system_libffi = ('--with-system-ffi' in 
sysconfig.get_config_var("CONFIG_ARGS"))
+         include_dirs = []
+         extra_compile_args = []
+         extra_link_args = []
+@@ -2113,7 +2113,7 @@ class PyBuildExt(build_ext):
+                              sources=['_ctypes/_ctypes_test.c'])
+         self.extensions.extend([ext, ext_test])
+ 
+-        if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
++        if not self.use_system_libffi:
+             return
+ 
+         if host_platform == 'darwin':
+@@ -2141,10 +2141,10 @@ class PyBuildExt(build_ext):
+                     ffi_lib = lib_name
+                     break
+ 
+-        if ffi_inc and ffi_lib:
++        if ffi_inc:
+             ext.include_dirs.extend(ffi_inc)
++        if ffi_lib:
+             ext.libraries.append(ffi_lib)
+-            self.use_system_libffi = True
+ 
+ 
+ class PyBuildInstall(install):

diff --git a/dev-lang/python/python-2.7.10-r3.ebuild 
b/dev-lang/python/python-2.7.10-r3.ebuild
index 0a4bd58..f0723cc 100644
--- a/dev-lang/python/python-2.7.10-r3.ebuild
+++ b/dev-lang/python/python-2.7.10-r3.ebuild
@@ -101,6 +101,7 @@ src_prepare() {
        epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
        epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
        epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
+       epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
 
        sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
                Lib/distutils/command/install.py \

diff --git a/dev-lang/python/python-2.7.10-r4.ebuild 
b/dev-lang/python/python-2.7.10-r4.ebuild
index 2158a54..f947f61 100644
--- a/dev-lang/python/python-2.7.10-r4.ebuild
+++ b/dev-lang/python/python-2.7.10-r4.ebuild
@@ -102,6 +102,7 @@ src_prepare() {
        epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
        epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
        epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
+       epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
 
        sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
                Lib/distutils/command/install.py \

Reply via email to