# -----Original Message-----
# From: Mattia Barbon [mailto:[EMAIL PROTECTED]]
# Sent: Sunday, September 16, 2001 14:30
# To: [EMAIL PROTECTED]
# Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
# Subject: [PATCH] Win32 (resubmit)
#
#
# This patch adds:
# * Win32 compilation ( of course! )
# * Configure.pl
#    --debugging          Enable debugging
#    --defaults           Accept all default values
#    --define name=value  Defines value name as value
#    --help               This text
#    --version            Show assembler version
#
# Support for hints files ( named hints/lc($^O).pl ).
# Support for debugging on *NIX/GCC, Win32/MSVC
#
# * Makes Opcodes.pm 5.005-happy

I'm applying this at least in spirit.  The actual diff (not a context
diff, unfortunately) is after my sig.  I'm also making Configure.pl
check the MANIFEST.

# P.S.: don't forget to cvs-add hints/mswin32.pl

I won't forget, even if it doesn't appear in the diff.

By the way, I got this to work as a project under Visual Studio 7 (with
a ton of fiddling and adding custom build steps).  If anyone is as crazy
as me, feel free to ask for the project files.

--Brent Dax
[EMAIL PROTECTED]

They *will* pay for what they've done.


cvs server: Diffing .
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.5
diff -r1.5 Configure.pl
7a8,36
> use Getopt::Long;
>
> my( $opt_debugging, $opt_defaults, $opt_version, $opt_help ) = ( 0, 0,
0, 0 );
> my( %opt_defines );
> my $result = GetOptions(
>       'debugging!' => \$opt_debugging,
>       'defaults!'  => \$opt_defaults,
>       'version'    => \$opt_version,
>       'help'       => \$opt_help,
>       'define=s'   => \%opt_defines,
> );
>
> if( $opt_version ) {
>       print '$Id:$' . "\n";
>       exit;
> }
>
> if( $opt_help ) {
>       print <<"EOT";
> $0 - Parrot Configure
> Options:
>    --debugging          Enable debugging
>    --defaults           Accept all default values
>    --define name=value  Defines value name as value
>    --help               This text
>    --version            Show assembler version
> EOT
>       exit;
> }
24,25c53,54
< Rules are the same as Perl 5's Configure--defaults are in
< square brackets, and you can hit enter to accept them.
---
> First, I'm gonna check the manifest, to make sure you got a
> complete Parrot kit.
27a57,58
> check_manifest();
>
32,37c63,76
<       iv =>           ($Config{ivtype}||'long'),
<       nv =>           ($Config{nvtype}||'long double'),
<       cc =>           $Config{cc},
<       ccflags =>      $Config{ccflags},
<       libs =>         $Config{libs},
<       perl =>         $^X,
---
>       iv =>                   ($Config{ivtype}||'long'),
>       nv =>                   ($Config{nvtype}||'double'),
>       cc =>                   $Config{cc},
>       #ADD C COMPILER FLAGS HERE
>       ccflags =>              $Config{ccflags}." -I.. -I./include",
>       libs =>                 $Config{libs},
>       perl =>                 $^X,
>       cc_debug =>             '-g',
>       o =>                    '.o',           # object files extension
>       exe =>                  $Config{_exe},
>       ld =>                   $Config{ld},
>       ld_out =>               '-o ',          # ld output file
>       ld_debug =>     '',                     # include debug info in executable
>       debugging =>    $opt_debugging,
39a79,92
> foreach my $i ( keys %opt_defines ) {
>       $c{$i} = $opt_defines{$i};
> }
>
> # set up default values
> my $hints = "hints/" . lc( $^O ) . ".pl";
> if( -f $hints ) {
>       local($/);
>       open HINT, "< $hints" or die "Unable to open hints file '$hints'";
>       my $hint = <HINT>;
>       close HINT;
>       eval $hint or die "Error in hints file $hints: '$@/$!'";
> }
>
41a95
> prompt("How about your linker?", 'ld');
45c99
< prompt("How about your floats?", 'nv');
---
> prompt("And your floats?", 'nv');
46a101,104
> unless( $c{debugging} ) {
>       $c{ld_debug} = ' ';
>       $c{cc_denug} = ' ';
> }
97a156,157
>       return if $opt_defaults;
>
149a210,242
>
> sub check_manifest {
>       my $not_ok;
>       open(MANIFEST, "MANIFEST");
>
>       while(<MANIFEST>) {
>               chomp;
>               unless(-e $_) {
>                       print "File $_ is missing!\n";
>                       $not_ok=1;
>               }
>       }
>
>       if($not_ok) {
>               print <<"END";
>
> Ack, some files were missing!  I can't continue running
> without everything here.  Please try to find the above
> files and then try running Configure again.
> END
>               exit;
>       }
>       else {
>               print <<"END";
>
> Okay, we found everything.  Next you'll need to answer
> a few questions about your system.  Rules are the same
> as Perl 5's Configure--defaults are in square brackets,
> and you can hit enter to accept them.
>
> END
>       }
> }
\ No newline at end of file
Index: Makefile.in
===================================================================
RCS file: /home/perlcvs/parrot/Makefile.in,v
retrieving revision 1.5
diff -r1.5 Makefile.in
1c1
< O = .o
---
> O = ${o}
7c7,10
< C_FLAGS = ${ccflags} -I..
---
> #DO NOT ADD C COMPILER FLAGS HERE
> #Add them in Configure.pl--look for the
> #comment 'ADD C COMPILER FLAGS HERE'
> C_FLAGS = ${ccflags} ${cc_debug}
12a16,18
> LD = ${ld}
> PERL = ${perl}
> TEST_PROG = test_prog${exe}
14c20
< all : $(O_FILES)
---
> all : $(TEST_PROG)
15a22
> #XXX This target is not portable to Win32
20,21c27,28
< test_prog: test_main$(O) $(O_FILES)
<       $(CC) $(C_LIBS) -o test_prog $(O_FILES) test_main$(O)
---
> $(TEST_PROG): test_main$(O) $(O_FILES)
>       $(LD) $(C_LIBS) ${ld_debug} ${ld_out}$(TEST_PROG) $(O_FILES)
test_main$(O)
23a31
>       $(CC) -o $*$(O) -c $*.c
25a34
>       $(CC) -o $*$(O) -c $*.c
28c37,38
<
---
>       $(CC) -o $*$(O) -c $*.c
>
30c40,41
<
---
>       $(CC) -o $*$(O) -c $*.c
>
32c43
<       ${perl} build_interp_starter.pl
---
>       $(PERL) build_interp_starter.pl
36a48
>       $(CC) -o $*$(O) -c $*.c
39c51,52
<
---
>       $(CC) -o $*$(O) -c $*.c
>
41c54,55
<
---
>       $(CC) -o $*$(O) -c $*.c
>
43c57,58
<
---
>       $(CC) -o $*$(O) -c $*.c
>
45c60,61
<
---
>       $(CC) -o $*$(O) -c $*.c
>
47c63
<       ${perl} process_opfunc.pl basic_opcodes.ops
---
>       $(PERL) process_opfunc.pl basic_opcodes.ops
50c66
<       ${perl} make_op_header.pl opcode_table > op.h
---
>       $(PERL) make_op_header.pl opcode_table > op.h
53,56c69
<       ${perl} Configure.pl
<
< test: test_prog
<       perl t/harness
---
>       $(PERL) Configure.pl
59c72,75
<       rm -f *$(O) *.s basic_opcodes.c interp_guts.h op.h test_prog
---
>       rm -f *$(O) *.s basic_opcodes.c interp_guts.h op.h $(TEST_PROG)
>
> test:
>       $(PERL) t/harness
Index: parrot.h
===================================================================
RCS file: /home/perlcvs/parrot/parrot.h,v
retrieving revision 1.7
diff -r1.7 parrot.h
28,29c28,40
< #include <unistd.h>
< #include <sys/mman.h>
---
>
> #ifdef WIN32
> #     include <io.h>
> #endif
>
> #ifdef HAS_HEADER_UNISTD
> #     include <unistd.h>
> #endif
>
> #ifdef HAS_HEADER_SYSMMAN
> #     include <sys/mman.h>
> #endif
>
Index: test_main.c
===================================================================
RCS file: /home/perlcvs/parrot/test_main.c,v
retrieving revision 1.7
diff -r1.7 test_main.c
75c75,80
<         program_code = mmap(0, file_stat.st_size, PROT_READ,
MAP_SHARED, fd, 0);
---
> #ifndef HAS_HEADER_SYSMMAN
>               program_code = mem_sys_allocate(file_stat.st_size);
>               _read(fd, program_code, file_stat.st_size);
> #else
>               program_code = mmap(0, file_stat.st_size, PROT_READ, MAP_SHARED, fd,
0);
> #endif
cvs server: Diffing Parrot
cvs server: Diffing docs
cvs server: Diffing little_languages
cvs server: Diffing t


*****CVS exited normally with code 1*****

'C:\Brent\Visual Studio Projects\Perl 6\parrot\parrot\Parrot\patch.txt'
has been moved successfully to the recycle bin...
'C:\Brent\Visual Studio Projects\Perl 6\parrot\parrot\Parrot\Config.pm'
has been moved successfully to the recycle bin...
cvs diff (in directory C:\Brent\Visual Studio Projects\Perl
6\parrot\parrot)
? hints
cvs server: Diffing .
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.5
diff -r1.5 Configure.pl
7a8,36
> use Getopt::Long;
>
> my( $opt_debugging, $opt_defaults, $opt_version, $opt_help ) = ( 0, 0,
0, 0 );
> my( %opt_defines );
> my $result = GetOptions(
>       'debugging!' => \$opt_debugging,
>       'defaults!'  => \$opt_defaults,
>       'version'    => \$opt_version,
>       'help'       => \$opt_help,
>       'define=s'   => \%opt_defines,
> );
>
> if( $opt_version ) {
>       print '$Id:$' . "\n";
>       exit;
> }
>
> if( $opt_help ) {
>       print <<"EOT";
> $0 - Parrot Configure
> Options:
>    --debugging          Enable debugging
>    --defaults           Accept all default values
>    --define name=value  Defines value name as value
>    --help               This text
>    --version            Show assembler version
> EOT
>       exit;
> }
24,25c53,54
< Rules are the same as Perl 5's Configure--defaults are in
< square brackets, and you can hit enter to accept them.
---
> First, I'm gonna check the manifest, to make sure you got a
> complete Parrot kit.
27a57,58
> check_manifest();
>
32,37c63,76
<       iv =>           ($Config{ivtype}||'long'),
<       nv =>           ($Config{nvtype}||'long double'),
<       cc =>           $Config{cc},
<       ccflags =>      $Config{ccflags},
<       libs =>         $Config{libs},
<       perl =>         $^X,
---
>       iv =>                   ($Config{ivtype}||'long'),
>       nv =>                   ($Config{nvtype}||'double'),
>       cc =>                   $Config{cc},
>       #ADD C COMPILER FLAGS HERE
>       ccflags =>              $Config{ccflags}." -I.. -I./include",
>       libs =>                 $Config{libs},
>       perl =>                 $^X,
>       cc_debug =>             '-g',
>       o =>                    '.o',           # object files extension
>       exe =>                  $Config{_exe},
>       ld =>                   $Config{ld},
>       ld_out =>               '-o ',          # ld output file
>       ld_debug =>     '',                     # include debug info in executable
>       debugging =>    $opt_debugging,
39a79,92
> foreach my $i ( keys %opt_defines ) {
>       $c{$i} = $opt_defines{$i};
> }
>
> # set up default values
> my $hints = "hints/" . lc( $^O ) . ".pl";
> if( -f $hints ) {
>       local($/);
>       open HINT, "< $hints" or die "Unable to open hints file '$hints'";
>       my $hint = <HINT>;
>       close HINT;
>       eval $hint or die "Error in hints file $hints: '$@/$!'";
> }
>
41a95
> prompt("How about your linker?", 'ld');
45c99
< prompt("How about your floats?", 'nv');
---
> prompt("And your floats?", 'nv');
46a101,104
> unless( $c{debugging} ) {
>       $c{ld_debug} = ' ';
>       $c{cc_denug} = ' ';
> }
97a156,157
>       return if $opt_defaults;
>
149a210,242
>
> sub check_manifest {
>       my $not_ok;
>       open(MANIFEST, "MANIFEST");
>
>       while(<MANIFEST>) {
>               chomp;
>               unless(-e $_) {
>                       print "File $_ is missing!\n";
>                       $not_ok=1;
>               }
>       }
>
>       if($not_ok) {
>               print <<"END";
>
> Ack, some files were missing!  I can't continue running
> without everything here.  Please try to find the above
> files and then try running Configure again.
> END
>               exit;
>       }
>       else {
>               print <<"END";
>
> Okay, we found everything.  Next you'll need to answer
> a few questions about your system.  Rules are the same
> as Perl 5's Configure--defaults are in square brackets,
> and you can hit enter to accept them.
>
> END
>       }
> }
\ No newline at end of file
Index: Makefile.in
===================================================================
RCS file: /home/perlcvs/parrot/Makefile.in,v
retrieving revision 1.5
diff -r1.5 Makefile.in
1c1
< O = .o
---
> O = ${o}
7c7,10
< C_FLAGS = ${ccflags} -I..
---
> #DO NOT ADD C COMPILER FLAGS HERE
> #Add them in Configure.pl--look for the
> #comment 'ADD C COMPILER FLAGS HERE'
> C_FLAGS = ${ccflags} ${cc_debug}
12a16,18
> LD = ${ld}
> PERL = ${perl}
> TEST_PROG = test_prog${exe}
14c20
< all : $(O_FILES)
---
> all : $(TEST_PROG)
15a22
> #XXX This target is not portable to Win32
20,21c27,28
< test_prog: test_main$(O) $(O_FILES)
<       $(CC) $(C_LIBS) -o test_prog $(O_FILES) test_main$(O)
---
> $(TEST_PROG): test_main$(O) $(O_FILES)
>       $(LD) $(C_LIBS) ${ld_debug} ${ld_out}$(TEST_PROG) $(O_FILES)
test_main$(O)
23a31
>       $(CC) -o $*$(O) -c $*.c
25a34
>       $(CC) -o $*$(O) -c $*.c
28c37,38
<
---
>       $(CC) -o $*$(O) -c $*.c
>
30c40,41
<
---
>       $(CC) -o $*$(O) -c $*.c
>
32c43
<       ${perl} build_interp_starter.pl
---
>       $(PERL) build_interp_starter.pl
36a48
>       $(CC) -o $*$(O) -c $*.c
39c51,52
<
---
>       $(CC) -o $*$(O) -c $*.c
>
41c54,55
<
---
>       $(CC) -o $*$(O) -c $*.c
>
43c57,58
<
---
>       $(CC) -o $*$(O) -c $*.c
>
45c60,61
<
---
>       $(CC) -o $*$(O) -c $*.c
>
47c63
<       ${perl} process_opfunc.pl basic_opcodes.ops
---
>       $(PERL) process_opfunc.pl basic_opcodes.ops
50c66
<       ${perl} make_op_header.pl opcode_table > op.h
---
>       $(PERL) make_op_header.pl opcode_table > op.h
53,56c69
<       ${perl} Configure.pl
<
< test: test_prog
<       perl t/harness
---
>       $(PERL) Configure.pl
59c72,75
<       rm -f *$(O) *.s basic_opcodes.c interp_guts.h op.h test_prog
---
>       rm -f *$(O) *.s basic_opcodes.c interp_guts.h op.h $(TEST_PROG)
>
> test:
>       $(PERL) t/harness
Index: parrot.h
===================================================================
RCS file: /home/perlcvs/parrot/parrot.h,v
retrieving revision 1.7
diff -r1.7 parrot.h
28,29c28,40
< #include <unistd.h>
< #include <sys/mman.h>
---
>
> #ifdef WIN32
> #     include <io.h>
> #endif
>
> #ifdef HAS_HEADER_UNISTD
> #     include <unistd.h>
> #endif
>
> #ifdef HAS_HEADER_SYSMMAN
> #     include <sys/mman.h>
> #endif
>
Index: test_main.c
===================================================================
RCS file: /home/perlcvs/parrot/test_main.c,v
retrieving revision 1.7
diff -r1.7 test_main.c
75c75,80
<         program_code = mmap(0, file_stat.st_size, PROT_READ,
MAP_SHARED, fd, 0);
---
> #ifndef HAS_HEADER_SYSMMAN
>               program_code = mem_sys_allocate(file_stat.st_size);
>               _read(fd, program_code, file_stat.st_size);
> #else
>               program_code = mmap(0, file_stat.st_size, PROT_READ, MAP_SHARED, fd,
0);
> #endif
cvs server: Diffing Parrot
Index: Parrot/Opcode.pm
===================================================================
RCS file: /home/perlcvs/parrot/Parrot/Opcode.pm,v
retrieving revision 1.3
diff -r1.3 Opcode.pm
3d2
< use 5.6.0;
8,9c7,8
< our %opcode;
< our $fingerprint;
---
> my %opcode;
> my $fingerprint;
cvs server: Diffing docs
cvs server: Diffing little_languages
cvs server: Diffing t

Reply via email to