commit:     fb002e4bedb20a1d5c52788530e084ffc5ca430f
Author:     Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer 
<DOT> com>
AuthorDate: Wed Apr 27 13:41:04 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=fb002e4b

bootstrap-prefix.sh: patch python to use dlltool for Cygwin

 scripts/bootstrap-prefix.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index f24baa9..074276d 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -691,6 +691,7 @@ bootstrap_python() {
        # --disable-shared causes modules to probably link against the
        # executable name, which must be the real executable at runtime
        # as well rather than some symlink (for Cygwin at least).
+       # And with dlltool, find_library("c") can return "cygwin1.dll".
        patch -p0 <<'EOP'
 --- Makefile.pre.in
 +++ Makefile.pre.in
@@ -705,6 +706,29 @@ bootstrap_python() {
 @@ -3,1 +3,1 @@
 -python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
 +$HOSTPYTHON ../../Tools/scripts/h2py.py -i '(u_long)' 
/usr/include/netinet/in.h
+--- Lib/ctypes/util.py
++++ Lib/ctypes/util.py
+@@ -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
 EOP
        local myconf=""
 

Reply via email to