This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix inclusion of Compress/Raw/Bzip2 and Encode in MinGW ALL_STATIC build
authorSteve Hay <steve.m.hay@googlemail.com>
Fri, 14 Jun 2013 01:34:35 +0000 (02:34 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Fri, 14 Jun 2013 02:10:02 +0000 (03:10 +0100)
The build was previously failing with various undefined references because
there were some clashes in the names of the object files extracted into
STATICDIR (e.g. Compress/Raw/Bzip2 and Compress/Raw/Zlib both have object
files called compress.o).

The fix is to individually extract each static extension library and
archive its object files into the static perl library, rather than doing
them all together, and also to use ar's "quick append" mode rather than
"replace" mode otherwise we still won't get multiple object files with the
same names included in the static perl library as required.

pod/perldelta.pod
win32/makefile.mk

index 0bc2cd0..82c2b74 100644 (file)
@@ -423,10 +423,8 @@ The BUILD_STATIC and ALL_STATIC makefile options for linking some or (nearly)
 all extensions statically (into perl519.dll, and into a separate
 perl-static.exe too) were broken for MinGW builds. This has now been fixed.
 
-The ALL_STATIC option has also been improved to include the Win32 extension,
-and also the Encode extension for VC++ builds. (However, Encode and
-Compress/Raw/Bzip2 are currently still excluded from MinGW builds. This will
-hopefully be rectified soon.)
+The ALL_STATIC option has also been improved to include the Encode and Win32
+extensions (for both VC++ and MinGW builds).
 
 =back
 
index 4c449db..dcd3564 100644 (file)
@@ -875,12 +875,7 @@ SETARGV_OBJ        = setargv$(o)
 .IF "$(ALL_STATIC)" == "define"
 # some exclusions, unfortunately, until fixed:
 #  - MakeMaker isn't capable enough for SDBM_File (small bug)
-#  - GCC's linker gets undefined references to _BZ2_compressBlock and
-#    _cp936_encoding, _cp932_encoding and others in Encode/CN.o and Encode/JP.o
 STATIC_EXT     = * !SDBM_File
-.IF "$(CCTYPE)" == "GCC"
-STATIC_EXT     += !Compress/Raw/Bzip2 !Encode
-.ENDIF
 .ELSE
 # specify static extensions here, for example:
 # (be sure to include Win32CORE to load Win32 on demand)
@@ -1161,11 +1156,13 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
 
 $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
 .IF "$(CCTYPE)" == "GCC"
+       $(LIB32) $(LIB_FLAGS) $@ $(PERLDLL_OBJ)
        if exist $(STATICDIR) rmdir /s /q $(STATICDIR)
-       mkdir $(STATICDIR)
-       cd $(STATICDIR) && for %i in ($(shell @type Extensions_static)) do $(ARCHPREFIX)ar x ..\%i
-       $(LIB32) $(LIB_FLAGS) $@ $(STATICDIR)\*$(o) $(PERLDLL_OBJ)
-       rmdir /s /q $(STATICDIR)
+       for %i in ($(shell @type Extensions_static)) do \
+               @mkdir $(STATICDIR) && cd $(STATICDIR) && \
+               $(ARCHPREFIX)ar x ..\%i && \
+               $(ARCHPREFIX)ar q ..\$@ *$(o) && \
+               cd .. && rmdir /s /q $(STATICDIR)
 .ELSE
        $(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static \
            @$(mktmp $(PERLDLL_OBJ))