Subject: | [PATCH] Changes needed to embed manifest files when building with VC++ 8.x |
Change 29266 by steveh@mugwump on 2006/11/13 18:09:58
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...)
Affected files ...
... //depot/perl/lib/ExtUtils/MM_Win32.pm#62 edit
... //depot/perl/lib/ExtUtils/MakeMaker.pm#129 edit
... //depot/perl/win32/Makefile#313 edit
... //depot/perl/win32/makefile.mk#348 edit
Differences ...
==== //depot/perl/lib/ExtUtils/MM_Win32.pm#62 (text) ====
@@ -341,6 +341,11 @@
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
Show quoted text
>= 14) { # VC 2005 (aka VC 8) or higher
+ push(@m,
+ q{
+ mt -nologo -manifest $@.manifest -outputresource:$@;2 && del
$@.manifest});
+ }
}
push @m, '
$(CHMOD) $(PERM_RWX) $@
==== //depot/perl/lib/ExtUtils/MakeMaker.pm#129 (text) ====
@@ -21,7 +21,7 @@
use vars qw($Revision);
use strict;
-$VERSION = '6.31';
+$VERSION = '6.31_01';
($Revision) = q$Revision: 19606 $ =~ /Revision:\s+(\S+)/;
@ISA = qw(Exporter);
==== //depot/perl/win32/Makefile#313 (text) ====
@@ -358,6 +358,17 @@
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).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 @@
$(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 @@
$(LINK32) -subsystem:console -out:$@ @<<
$(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ)
<<
+ $(EMBED_EXE_MANI)
$(MINIDIR) :
if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
@@ -1019,6 +1033,7 @@
$(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 @@
$(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 @@
$(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 ..
==== //depot/perl/win32/makefile.mk#348 (text) ====
@@ -357,6 +357,17 @@
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 @@
.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 @@
.ELSE
$(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
perlglob$(o) setargv$(o)
+ $(EMBED_EXE_MANI)
.ENDIF
perlglob$(o) : perlglob.c
@@ -1092,6 +1105,7 @@
.ELSE
$(LINK32) -subsystem:console -out:$@ \
@$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,$B,))
+ $(EMBED_EXE_MANI)
.ENDIF
$(MINIDIR) :
@@ -1159,6 +1173,7 @@
@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 @@
.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 @@
.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