[Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py,1.23,1.24

jlt63@users.sourceforge.net jlt63@users.sourceforge.net
Mon, 14 Apr 2003 05:51:31 -0700


Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory sc8-pr-cvs1:/tmp/cvs-serv8459

Modified Files:
	cygwinccompiler.py 
Log Message:
Patch #709178: remove -static option from cygwinccompiler

After some more reflection (and no negative feedback), I am reverting the
original patch and applying my version, cygwinccompiler.py-shared.diff,
instead.

My reasons are the following:

1. support for older toolchains is retained
2. support for new toolchains (i.e., ld -shared) is added

The goal of my approach is to avoid breaking older toolchains while adding
better support for newer ones.


Index: cygwinccompiler.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** cygwinccompiler.py	9 Apr 2003 20:13:59 -0000	1.23
--- cygwinccompiler.py	14 Apr 2003 12:51:26 -0000	1.24
***************
*** 34,38 ****
--- 34,48 ----
  #   - its dllwrap doesn't work, there is a bug in binutils 2.10.90
  #     see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html
+ #   - using gcc -mdll instead dllwrap doesn't work without -static because
+ #     it tries to link against dlls instead their import libraries. (If
+ #     it finds the dll first.)
+ #     By specifying -static we force ld to link against the import libraries,
+ #     this is windows standard and there are normally not the necessary symbols
+ #     in the dlls.
  #   *** only the version of June 2000 shows these problems
+ # * cygwin gcc 3.2/ld 2.13.90 works
+ #   (ld supports -shared)
+ # * mingw gcc 3.2/ld 2.13 works
+ #   (ld supports -shared)
  
  # This module should be kept compatible with Python 1.5.2.
***************
*** 78,82 ****
                            self.dllwrap_version) )
  
!         # ld_version >= "2.10.90" should also be able to use
          # gcc -mdll instead of dllwrap
          # Older dllwraps had own version numbers, newer ones use the
--- 88,92 ----
                            self.dllwrap_version) )
  
!         # ld_version >= "2.10.90" and < "2.13" should also be able to use
          # gcc -mdll instead of dllwrap
          # Older dllwraps had own version numbers, newer ones use the
***************
*** 88,91 ****
--- 98,108 ----
              self.linker_dll = "dllwrap"
  
+         # ld_version >= "2.13" support -shared so use it instead of
+         # -mdll -static
+         if self.ld_version >= "2.13":
+             shared_option = "-shared"
+         else:
+             shared_option = "-mdll -static"
+ 
          # Hard-code GCC because that's what this is all about.
          # XXX optimization, warnings etc. should be customizable.
***************
*** 93,98 ****
                               compiler_so='gcc -mcygwin -mdll -O -Wall',
                               linker_exe='gcc -mcygwin',
!                              linker_so=('%s -mcygwin -mdll' %
!                                         self.linker_dll))
  
          # cygwin and mingw32 need different sets of libraries
--- 110,115 ----
                               compiler_so='gcc -mcygwin -mdll -O -Wall',
                               linker_exe='gcc -mcygwin',
!                              linker_so=('%s -mcygwin %s' %
!                                         (self.linker_dll, shared_option)))
  
          # cygwin and mingw32 need different sets of libraries
***************
*** 263,266 ****
--- 280,290 ----
          CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  
+         # ld_version >= "2.13" support -shared so use it instead of
+         # -mdll -static
+         if self.ld_version >= "2.13":
+             shared_option = "-shared"
+         else:
+             shared_option = "-mdll -static"
+ 
          # A real mingw32 doesn't need to specify a different entry point,
          # but cygwin 2.91.57 in no-cygwin-mode needs it.
***************
*** 273,278 ****
                               compiler_so='gcc -mno-cygwin -mdll -O -Wall',
                               linker_exe='gcc -mno-cygwin',
!                              linker_so='%s -mno-cygwin -mdll %s'
!                                         % (self.linker_dll, entry_point))
          # Maybe we should also append -mthreads, but then the finished
          # dlls need another dll (mingwm10.dll see Mingw32 docs)
--- 297,303 ----
                               compiler_so='gcc -mno-cygwin -mdll -O -Wall',
                               linker_exe='gcc -mno-cygwin',
!                              linker_so='%s -mno-cygwin %s %s'
!                                         % (self.linker_dll, shared_option,
!                                            entry_point))
          # Maybe we should also append -mthreads, but then the finished
          # dlls need another dll (mingwm10.dll see Mingw32 docs)