From: Steve Hay Date: Mon, 13 Nov 2006 18:09:58 +0000 (+0000) Subject: Embed manifest files in EXEs and DLLs when building with VC++ 8.x X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c8e599d3a7f82b1ac9916859e455d8fd113f5731;p=p5sagit%2Fp5-mst-13.2.git Embed manifest files in EXEs and DLLs when building with VC++ 8.x See the thread starting here for details: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00398.html (Still need to do something for Module::Build somtime...) p4raw-id: //depot/perl@29266 --- diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 86777d3..efbd582 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -341,6 +341,11 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP). push(@m, q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) } .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)}); + if ($Config{cc} eq 'cl' and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) { # VC 2005 (aka VC 8) or higher + push(@m, + q{ + mt -nologo -manifest $@.manifest -outputresource:$@;2 && del $@.manifest}); + } } push @m, ' $(CHMOD) $(PERM_RWX) $@ diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index dbc5f8d..7720259 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -21,7 +21,7 @@ use vars qw( use vars qw($Revision); use strict; -$VERSION = '6.31'; +$VERSION = '6.31_01'; ($Revision) = q$Revision: 19606 $ =~ /Revision:\s+(\S+)/; @ISA = qw(Exporter); diff --git a/win32/Makefile b/win32/Makefile index e5faa76..a8d1af1 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -358,6 +358,17 @@ ARCHNAME = $(ARCHNAME)-thread DELAYLOAD = -DELAYLOAD:ws2_32.dll -DELAYLOAD:shell32.dll delayimp.lib !ENDIF +# Visual C++ 2005 (VC++ 8.x) creates manifest files for EXEs and DLLs. These +# either need copying everywhere with the binaries, or else need embedding in +# them otherwise MSVCR80.dll won't be found. Embed them for simplicity, and +# delete them afterwards so that they don't get installed too. +!IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" +EMBED_EXE_MANI = mt -nologo -manifest $@.manifest -outputresource:$@;1 && \ + del $@.manifest +EMBED_DLL_MANI = mt -nologo -manifest $@.manifest -outputresource:$@;2 && \ + del $@.manifest +!ENDIF + ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto @@ -492,6 +503,7 @@ o = .obj $(o).dll: $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \ -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL) + $(EMBED_DLL_MANI) .rc.res: $(RSC) -i.. $< @@ -941,6 +953,7 @@ $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c $(GLOBEXE) : perlglob$(o) $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ perlglob$(o) setargv$(o) + $(EMBED_EXE_MANI) perlglob$(o) : perlglob.c @@ -984,6 +997,7 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(LINK32) -subsystem:console -out:$@ @<< $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ) << + $(EMBED_EXE_MANI) $(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" @@ -1019,6 +1033,7 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static $(LINK32) -dll -def:perldll.def -base:0x28000000 -out:$@ @Extensions_static @<< $(LINK_FLAGS) $(DELAYLOAD) $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES) << + $(EMBED_DLL_MANI) $(XCOPY) $(PERLIMPLIB) $(COREDIR) $(PERLEXE_ICO): $(MINIPERL) makeico.pl @@ -1052,6 +1067,7 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) $(LINK32) -subsystem:console -out:$@ @<< $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ) << + $(EMBED_EXE_MANI) perlmain.c : runperl.c copy runperl.c perlmain.c @@ -1062,6 +1078,7 @@ perlmain$(o) : perlmain.c $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES) $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(LINK_FLAGS) \ $(LIBFILES) $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES) + $(EMBED_EXE_MANI) copy $(PERLEXE) $(WPERLEXE) $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS copy splittree.pl .. diff --git a/win32/makefile.mk b/win32/makefile.mk index c1744f8..db133af 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -357,6 +357,17 @@ ARCHNAME !:= $(ARCHNAME)-thread DELAYLOAD *= -DELAYLOAD:ws2_32.dll -DELAYLOAD:shell32.dll delayimp.lib .ENDIF +# Visual C++ 2005 (VC++ 8.x) creates manifest files for EXEs and DLLs. These +# either need copying everywhere with the binaries, or else need embedding in +# them otherwise MSVCR80.dll won't be found. Embed them for simplicity, and +# delete them afterwards so that they don't get installed too. +.IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" +EMBED_EXE_MANI = mt -nologo -manifest $@.manifest -outputresource:$@;1 && \ + del $@.manifest +EMBED_DLL_MANI = mt -nologo -manifest $@.manifest -outputresource:$@;2 && \ + del $@.manifest +.ENDIF + ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto @@ -647,6 +658,7 @@ $(o).dll: .ELSE $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \ -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL) + $(EMBED_DLL_MANI) .ENDIF .rc.res: @@ -1041,6 +1053,7 @@ $(GLOBEXE) : perlglob$(o) .ELSE $(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ perlglob$(o) setargv$(o) + $(EMBED_EXE_MANI) .ENDIF perlglob$(o) : perlglob.c @@ -1092,6 +1105,7 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS) .ELSE $(LINK32) -subsystem:console -out:$@ \ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,$B,)) + $(EMBED_EXE_MANI) .ENDIF $(MINIDIR) : @@ -1159,6 +1173,7 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static @Extensions_static \ @$(mktmp -base:0x28000000 $(BLINK_FLAGS) $(DELAYLOAD) $(LIBFILES) \ $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,$B,)) + $(EMBED_DLL_MANI) .ENDIF $(XCOPY) $(PERLIMPLIB) $(COREDIR) @@ -1198,6 +1213,7 @@ $(X2P) : $(MINIPERL) $(X2P_OBJ) .ELSE $(LINK32) -subsystem:console -out:$@ \ @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,$B,)) + $(EMBED_EXE_MANI) .ENDIF perlmain.c : runperl.c @@ -1218,6 +1234,7 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES) .ELSE $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(BLINK_FLAGS) \ $(LIBFILES) $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES) + $(EMBED_EXE_MANI) .ENDIF copy $(PERLEXE) $(WPERLEXE) $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS