Hi,
The attached file winres.patch prepared against SVN contains changes to
myldr/Makefile.PL
myldr/boot.c
changes have 2 goals
1) allow compilation with a Microsoft compiler (changes to boot.c and
boot.exe section in Makefile.PL)
2) allow compilation of resource files on Windows with MinGW and MS
compilers.
the file at
http://www.wxperl.co.uk/winres.tar.gz
contains the following additional files needed for the patch to work
myldr/winres/pp.manifest
myldr/winres/pp.ico
myldr/winres/pp.rc
If the patch and extra files are applied, the following 3 files can be
removed from distribution.
myldr/win32.coff
myldr/win32.obj
myldr/win32.res
The patch has been successfully tested with
Windows XP 32 Bit
MinGW.org gcc 3.4.5 ( as installed by ActivePerl if no compiler present)
MinGW.org gcc 4.5.0 - as installed from www.mingw.org
mingw-w32 gcc 4.4.7 - as installed from mingw-w64.sourceforge.net
Windows Vista 32 bit
mingw-w32 gcc 4.4.7 - as installed from mingw-w64.sourceforge.net
Windows Vista 64 bit
mingw-w64 gcc 4.4.7 - as installed from mingw-w64.sourceforge.net
MS Platform SDK 2003 64 bit compiler
Note that in all cases, Module::ScanDeps 1.01 was used.
Module::ScanDeps 1.03 causes test failures as noted in attached
'failures.txt'.
I have one unresolved failure.
Windows XP 32 bit
MS Visual C++ 6
Tests fail as noted in attached failures.txt. I assume this is a Visual
C++ 6 issue (gcc compilers test fine on Win XP 32 bit) but I am not sure.
To do - testing by someone using a VC 2005 (or greater) built Perl.
I think the patch is OK to apply as is. Current CPAN and SVN cannot
compile with any MS compiler so it is at least an improvement on that
and hopefully someone can chip in with some VC 2005 - VC 2010 testing.
Regards
Mark
Index: myldr/boot.c
===================================================================
--- myldr/boot.c (revision 1271)
+++ myldr/boot.c (working copy)
@@ -1,6 +1,9 @@
#undef readdir
-
+#ifdef _MSC_VER
+#include <io.h>
+#else
#include <unistd.h>
+#endif
typedef struct my_chunk
{
Index: myldr/Makefile.PL
===================================================================
--- myldr/Makefile.PL (revision 1271)
+++ myldr/Makefile.PL (working copy)
@@ -83,17 +83,28 @@
my $lib_path = join(' ', map qq(-I"$_"), @INC); # FIXME run_with_inc.pl
-my( $out, $ccdebug, $lddebug, $warn, $rm, $mv, $res, $mt_cmd );
+my( $out, $ccdebug, $lddebug, $warn, $rm, $mv, $res, $mt_cmd, $res_cmd,
$res_section, $rt_cmd, $pre_res );
+$res = '';
+$pre_res = '';
+$res_cmd = '-$(NOOP)';
+$rt_cmd = '-$(NOOP)';
+$res_section = 'noresource.o'; # is never built
+
if( $cc =~ m/^cl\b/i ) {
$out = '-out:';
$ccdebug = $debug ? '-Zi -Zm1000 ' : '-Zm1000 ';
$lddebug = $debug ? '-debug ' : '-release ';
$warn = $debug ? '-W3' : '';
- $res = $Config{ptrsize} == 4 ? 'win32.obj' : '';
+ my $machinearch = ( $Config{ptrsize} == 8 ) ? 'AMD64' : 'X86';
+ $pre_res = qq(winres\\pp.res);
+ $rt_cmd = qq(rc winres\\pp.rc);
+ $res_cmd = qq(cvtres /NOLOGO /MACHINE:$machinearch /OUT:ppresource.obj
$pre_res);
+ $res = 'ppresource.obj';
+ $res_section = $res;
# Embed the manifest file for VC 2005 (aka VC8) or higher, but not for the
- # 64-bit Platform SDK compiler
- if( $Config{ivsize} == 4 and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14 )
{
+ # 64-bit Platform SDK compiler.
+ if( $Config{ptrsize} == 4 and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14
) {
$mt_cmd = 'mt -nologo -manifest $@.manifest -outputresource:$@;1';
} else {
$mt_cmd = '-$(NOOP)';
@@ -103,14 +114,19 @@
$ccdebug = $debug ? '-g ' : '';
$lddebug = ($debug or $^O eq 'darwin') ? '' : '-s ';
$warn = $debug ? '-Wall -Wno-comments ' : '';
- $res = ($^O =~ /^(?:MSWin|cygwin)/ && $Config{ptrsize} == 4) ?
'win32.coff' : '';
+ if( $^O =~ /^(?:MSWin|cygwin)/ ){
+ $res = 'ppresource.coff';
+ $pre_res = qq(winres\\pp.res);
+ $rt_cmd = qq(windres -F pei-i386 -i winres\\pp.rc -o $pre_res);
+ $res_cmd = qq(windres -o ppresource.coff $pre_res);
+ $res_section = $res;
+ }
$mt_cmd = '-$(NOOP)';
} else {
$out = '-o ';
$ccdebug = '';
$lddebug = '';
$warn = '';
- $res = '';
$mt_cmd = '-$(NOOP)';
}
@@ -271,12 +287,16 @@
main$o: main.c my_par_pl.c perlxsi.c internals.c \$(MKTMP_STUFF)
+$res_section:
+ $rt_cmd
+ $res_cmd
+
sha1.c:
\$(PERLRUN) sha1.c.PL
clean::
-\$(RM_F) my_*.c
- -\$(RM_F) main$o boot$o
+ -\$(RM_F) main$o boot$o $res $pre_res
-\$(RM_F) sha1.c
-\$(RM_F) *.opt *.pdb perlxsi.c
-\$(RM_F) usernamefrompwuid.h
@@ -321,7 +341,7 @@
boot$o: \$(MKTMP_STUFF) $my_stuff
$boot_exe: boot$o
- \$(CC) boot$o \$(STATIC_LDFLAGS) $res $out$boot_exe_link
+ \$(LD) boot$o \$(STATIC_LDFLAGS) $res $out$boot_exe_link
$mt_cmd
my_par.c: $par_exe
#-----------------------------------------------------------
# Test Failure Windows XP 32 bit - MS VC++ 6
#-----------------------------------------------------------
Microsoft (R) Program Maintenance Utility Version 7.00.8882
Copyright (C) Microsoft Corp 1988-2000. All rights reserved.
C:\PROGRA~1\MID438~1\Bin\nmake.exe -f Makefile all -nologo
cd ..
C:\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'inc', 'blib\lib', 'blib\arch')" t/00-pod.t t/10-parl-generation.t t/20-pp.t
t/30-current_exec.t t/40-packer_cd_option.t t/90-rt59710.t
t/00-pod.t ............... skipped: Set environment variable PERL_TEST_POD=1 to
test POD
t/10-parl-generation.t ... ok
t/20-pp.t ................ 31/34 'x' outside of string in unpack at
C:\Projects\PAR-Packer-1.011\blib\lib/PAR/Packer.pm line 1425.
t/20-pp.t ................ 32/34 # Failed test 'pp_gui_tests
# amsg572: sub pp_gui_tests cannot system pp --gui --icon hi.ico -o hello.exe
hello.pl:No such file or directory:
# '
# at automated_pp_test.pl line 8445.
t/20-pp.t ................ 34/34 # Looks like you failed 1 test of 34.
t/20-pp.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/34 subtests
t/30-current_exec.t ...... # Please wait
t/30-current_exec.t ...... ok
t/40-packer_cd_option.t .. ok
t/90-rt59710.t ........... ok
Test Summary Report
-------------------
t/20-pp.t (Wstat: 256 Tests: 34 Failed: 1)
Failed test: 32
Non-zero exit status: 1
Files=6, Tests=74, 503 wallclock secs ( 0.03 usr + 0.07 sys = 0.10 CPU)
Result: FAIL
Failed 1/6 test programs. 1/74 subtests failed.
NMAKE : fatal error U1077: 'C:\perl\bin\perl.exe' : return code '0xff'
Stop.
#-----------------------------------------------------------
# Module::ScanDeps 1.03 Failure - Windows Vista
#-----------------------------------------------------------
c:\Projects\PAR-Packer\PAR-Packer-1.011>dmake test
C:\Projects\BuildPerl\bin\perl.exe "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'inc', 'blib\lib', 'blib\arch')" t/00-pod.t t/1
0-parl-generation.t t/20-pp.t t/30-current_exec.t t/40-packer_cd_option.t
t/90-rt59710.t
t/00-pod.t ............... skipped: Set environment variable PERL_TEST_POD=1 to
test POD
t/10-parl-generation.t ... ok
t/20-pp.t ................ 14/34 error extracting info from DataFeed file:
can't read
C:/Projects/PAR-Packer/PAR-Packer-1.011/contrib/automated_pp_test/pp_switc
h_tests/temp0/BOysEY.out: No such file or directory at
C:/Projects/BuildPerl/site/lib/Module/ScanDeps.pm line 1339.
# Failed test 'pp_minus_x_hello
# amsg157: sub pp_minus_x_hello Cannot system pp -x "hello.pl"
# '
# at automated_pp_test.pl line 7680.
error extracting info from DataFeed file: can't read
C:/Projects/PAR-Packer/PAR-Packer-1.011/contrib/automated_pp_test/pp_switch_tests/temp1/kE_gKz.out:
No such
file or directory at C:/Projects/BuildPerl/site/lib/Module/ScanDeps.pm line
1339.
t/20-pp.t ................ 16/34 # Failed test 'pp_minus_n_minus_x_hello
# amsg162: sub pp_minus_n_minus_x_hello cannot system pp -n -x "hello.pl"
# '
# at automated_pp_test.pl line 7728.
t/20-pp.t ................ 33/34 # Looks like you failed 2 tests of 34.
t/20-pp.t ................ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/34 subtests
t/30-current_exec.t ...... # Please wait
t/30-current_exec.t ...... ok
t/40-packer_cd_option.t .. ok
t/90-rt59710.t ........... ok
Test Summary Report
-------------------
t/20-pp.t (Wstat: 512 Tests: 34 Failed: 2)
Failed tests: 15-16
Non-zero exit status: 2
Files=6, Tests=74, 1558 wallclock secs ( 0.03 usr + 0.05 sys = 0.08 CPU)
Result: FAIL
Failed 1/6 test programs. 2/74 subtests failed.
dmake: Error code 255, while making 'test_dynamic'