commit:     6b8e9c8593f902585590f446a291f492e4d2bf82
Author:     Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer 
<DOT> com>
AuthorDate: Wed Apr 27 13:42:59 2016 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 15:05:43 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6b8e9c85

python-2.7.11: add patch to use dlltool on Cygwin

 .../files/python-2.5.2-cygwin-find_library.patch   | 34 ++++++++++++++++++++++
 dev-lang/python/python-2.7.11.ebuild               |  3 ++
 2 files changed, 37 insertions(+)

diff --git a/dev-lang/python/files/python-2.5.2-cygwin-find_library.patch 
b/dev-lang/python/files/python-2.5.2-cygwin-find_library.patch
new file mode 100644
index 0000000..381d073
--- /dev/null
+++ b/dev-lang/python/files/python-2.5.2-cygwin-find_library.patch
@@ -0,0 +1,34 @@
+--- origsrc/Python-2.5.2/Lib/ctypes/util.py    2007-09-14 15:05:26.000000000 
-0500
++++ src/Python-2.5.2/Lib/ctypes/util.py        2008-11-25 17:54:47.319296200 
-0600
+@@ -41,6 +41,20 @@
+                 continue
+         return None
+ 
++elif sys.platform == "cygwin":
++    def find_library(name):
++        for libdir in ['/usr/lib', '/usr/local/lib']:
++            for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
++                implib = os.path.join(libdir, libext)
++                if not os.path.exists(implib):
++                    continue
++                cmd = "dlltool -I " + implib + " 2>/dev/null"
++                res = os.popen(cmd).read().replace("\n","")
++                if not res:
++                    continue
++                return res
++        return None
++
+ elif os.name == "posix":
+     # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
+     import re, tempfile, errno
+@@ -157,6 +173,10 @@
+             print cdll.LoadLibrary("libcrypto.dylib")
+             print cdll.LoadLibrary("libSystem.dylib")
+             print cdll.LoadLibrary("System.framework/System")
++        elif sys.platform == "cygwin":
++            print cdll.LoadLibrary("cygbz2-1.dll") 
++            print find_library("crypt")
++            print cdll.LoadLibrary("cygcrypt-0.dll") 
+         else:
+             print cdll.LoadLibrary("libm.so")
+             print cdll.LoadLibrary("libcrypt.so")

diff --git a/dev-lang/python/python-2.7.11.ebuild 
b/dev-lang/python/python-2.7.11.ebuild
index d974398..4906dc2 100644
--- a/dev-lang/python/python-2.7.11.ebuild
+++ b/dev-lang/python/python-2.7.11.ebuild
@@ -129,6 +129,9 @@ src_prepare() {
        epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
        epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
 
+       # On Cygwin, find_library("c") has to return "cygwin1.dll"
+       epatch "${FILESDIR}/python-2.5.2-cygwin-find_library.patch"
+
        # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
        sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
 

Reply via email to