From: Steve Hay Date: Tue, 22 Apr 2008 09:41:44 +0000 (+0000) Subject: Upgrade to ExtUtils-CBuilder-0.23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3fb68a339256eb39318fec1e6d5a4f251f9f503;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ExtUtils-CBuilder-0.23 Wipes out local mods in 01-basic.t from #33339 (which are superseded by changes in 0.23), but keeps local mods for VMS from #32277 (which are still not in 0.23) p4raw-id: //depot/perl@33721 --- diff --git a/lib/ExtUtils/CBuilder.pm b/lib/ExtUtils/CBuilder.pm index 209200d..7b97e07 100644 --- a/lib/ExtUtils/CBuilder.pm +++ b/lib/ExtUtils/CBuilder.pm @@ -5,7 +5,7 @@ use File::Path (); use File::Basename (); use vars qw($VERSION @ISA); -$VERSION = '0.22_01'; +$VERSION = '0.23'; $VERSION = eval $VERSION; # Okay, this is the brute-force method of finding out what kind of diff --git a/lib/ExtUtils/CBuilder/Base.pm b/lib/ExtUtils/CBuilder/Base.pm index d12ebfd..59b43b9 100644 --- a/lib/ExtUtils/CBuilder/Base.pm +++ b/lib/ExtUtils/CBuilder/Base.pm @@ -6,9 +6,10 @@ use File::Basename; use Cwd (); use Config; use Text::ParseWords; +use IO::File; use vars qw($VERSION); -$VERSION = '0.22'; +$VERSION = '0.23'; sub new { my $class = shift; @@ -118,10 +119,8 @@ sub have_compiler { my $tmpfile = File::Spec->catfile(File::Spec->tmpdir, 'compilet.c'); { - local *FH; - open FH, "> $tmpfile" or die "Can't create $tmpfile: $!"; - print FH "int boot_compilet() { return 1; }\n"; - close FH; + my $FH = IO::File->new("> $tmpfile") or die "Can't create $tmpfile: $!"; + print $FH "int boot_compilet() { return 1; }\n"; } my ($obj_file, @lib_files); diff --git a/lib/ExtUtils/CBuilder/Changes b/lib/ExtUtils/CBuilder/Changes index fbf6f4a..5105cf9 100644 --- a/lib/ExtUtils/CBuilder/Changes +++ b/lib/ExtUtils/CBuilder/Changes @@ -1,5 +1,23 @@ Revision history for Perl extension ExtUtils::CBuilder. + - Fixed some problems (some old, some new) with Strawberry Perl on + Windows. [Alberto Simo~es] + + - Will now install in the core perl lib directory when the user's + perl is new enough to have us in core. [Yi Ma Mao] + +0.22 - Fri Feb 8 21:52:21 2008 + + - Replaced the split_like_shell() method on Windows with a + near-no-op, which is probably more correct and has the benefit of + not messing up UNC paths. [John R. LoVerso, see + http://rt.cpan.org/Ticket/Display.html?id=26545] + + - Fixed extra_compiler_flags on Windows, they were being + ignored. [Robert May] + +0.21 - Tue Oct 30 06:46:01 2007 + - Clean up perl_src path using Cwd::realpath(). Only affects usage as part of the perl core. diff --git a/lib/ExtUtils/CBuilder/Platform/Unix.pm b/lib/ExtUtils/CBuilder/Platform/Unix.pm index f3d6967..7138dff 100644 --- a/lib/ExtUtils/CBuilder/Platform/Unix.pm +++ b/lib/ExtUtils/CBuilder/Platform/Unix.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Base; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Base); sub link_executable { diff --git a/lib/ExtUtils/CBuilder/Platform/VMS.pm b/lib/ExtUtils/CBuilder/Platform/VMS.pm index ab22cb2..e6babe8 100644 --- a/lib/ExtUtils/CBuilder/Platform/VMS.pm +++ b/lib/ExtUtils/CBuilder/Platform/VMS.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Base; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23_01'; @ISA = qw(ExtUtils::CBuilder::Base); use File::Spec::Functions qw(catfile catdir); diff --git a/lib/ExtUtils/CBuilder/Platform/Windows.pm b/lib/ExtUtils/CBuilder/Platform/Windows.pm index 11662df..e44f3bf 100644 --- a/lib/ExtUtils/CBuilder/Platform/Windows.pm +++ b/lib/ExtUtils/CBuilder/Platform/Windows.pm @@ -7,9 +7,10 @@ use File::Basename; use File::Spec; use ExtUtils::CBuilder::Base; +use IO::File; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Base); sub new { @@ -43,6 +44,16 @@ sub split_like_shell { return ($_); } +sub do_system { + # See above + my $self = shift; + my $cmd = join(" ", + grep length, + map {$a=$_;$a=~s/\t/ /g;$a=~s/^\s+|\s+$//;$a} + grep defined, @_); + return $self->SUPER::do_system($cmd); +} + sub arg_defines { my ($self, %args) = @_; s/"/\\"/g foreach values %args; @@ -282,18 +293,16 @@ sub write_compiler_script { $self->add_to_cleanup($script); print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @spec{ qw(includes cflags optimize defines perlinc) } ) ); - close SCRIPT; - push @{$spec{includes}}, '@"' . $script . '"'; return %spec; @@ -355,10 +364,10 @@ sub write_linker_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @@ -367,8 +376,6 @@ sub write_linker_script { def_file implib map_file) } ) ); - close SCRIPT; - push @{$spec{lddlflags}}, '@"' . $script . '"'; return %spec; @@ -412,7 +419,7 @@ sub write_compiler_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); # XXX Borland "response files" seem to be unable to accept macro @@ -420,15 +427,13 @@ sub write_compiler_script { # backslash doesn't work, and any level of quotes are stripped. The # result is is a floating point number in the source file where a # string is expected. So we leave the macros on the command line. - print SCRIPT join( "\n", + print $SCRIPT join( "\n", map { ref $_ ? @{$_} : $_ } grep defined, delete( @spec{ qw(includes cflags optimize perlinc) } ) ); - close SCRIPT; - push @{$spec{includes}}, '@"' . $script . '"'; return %spec; @@ -478,29 +483,25 @@ sub write_linker_script { print "Generating scripts '$ld_script' and '$ld_libs'.\n" if !$self->{quiet}; # Script 1: contains options & names of object files. - open( LD_SCRIPT, ">$ld_script" ) + my $LD_SCRIPT = IO::File->new( ">$ld_script" ) or die( "Could not create linker script '$ld_script': $!" ); - print LD_SCRIPT join( " +\n", + print $LD_SCRIPT join( " +\n", map { @{$_} } grep defined, delete( @spec{ qw(lddlflags libpath other_ldflags startup objects) } ) ); - close LD_SCRIPT; - # Script 2: contains name of libs to link against. - open( LD_LIBS, ">$ld_libs" ) + my $LD_LIBS = IO::File->new( ">$ld_libs" ) or die( "Could not create linker script '$ld_libs': $!" ); - print LD_LIBS join( " +\n", + print $LD_LIBS join( " +\n", (delete $spec{libperl} || ''), @{delete $spec{perllibs} || []}, ); - close LD_LIBS; - push @{$spec{lddlflags}}, '@"' . $ld_script . '"'; push @{$spec{perllibs}}, '@"' . $ld_libs . '"'; @@ -622,32 +623,30 @@ sub write_linker_script { print "Generating script '$script'\n" if !$self->{quiet}; - open( SCRIPT, ">$script" ) + my $SCRIPT = IO::File->new( ">$script" ) or die( "Could not create script '$script': $!" ); - print( SCRIPT 'SEARCH_DIR(' . $_ . ")\n" ) + print $SCRIPT ( 'SEARCH_DIR(' . $_ . ")\n" ) for @{delete $spec{libpath} || []}; # gcc takes only one startup file, so the first object in startup is # specified as the startup file and any others are shifted into the # beginning of the list of objects. if ( $spec{startup} && @{$spec{startup}} ) { - print SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n"; + print $SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n"; unshift @{$spec{objects}}, @{delete $spec{startup} || []}; } - print SCRIPT 'INPUT(' . join( ',', + print $SCRIPT 'INPUT(' . join( ',', @{delete $spec{objects} || []} ) . ")\n"; - print SCRIPT 'INPUT(' . join( ' ', + print $SCRIPT 'INPUT(' . join( ' ', (delete $spec{libperl} || ''), @{delete $spec{perllibs} || []}, ) . ")\n"; - close SCRIPT; - push @{$spec{other_ldflags}}, '"' . $script . '"'; return %spec; diff --git a/lib/ExtUtils/CBuilder/Platform/aix.pm b/lib/ExtUtils/CBuilder/Platform/aix.pm index 6ecf80e..560b92c 100644 --- a/lib/ExtUtils/CBuilder/Platform/aix.pm +++ b/lib/ExtUtils/CBuilder/Platform/aix.pm @@ -5,7 +5,7 @@ use ExtUtils::CBuilder::Platform::Unix; use File::Spec; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub need_prelink { 1 } diff --git a/lib/ExtUtils/CBuilder/Platform/cygwin.pm b/lib/ExtUtils/CBuilder/Platform/cygwin.pm index 9dcab67..186bf7f 100644 --- a/lib/ExtUtils/CBuilder/Platform/cygwin.pm +++ b/lib/ExtUtils/CBuilder/Platform/cygwin.pm @@ -5,7 +5,7 @@ use File::Spec; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub link_executable { diff --git a/lib/ExtUtils/CBuilder/Platform/darwin.pm b/lib/ExtUtils/CBuilder/Platform/darwin.pm index bf6e5ec..7d00417 100644 --- a/lib/ExtUtils/CBuilder/Platform/darwin.pm +++ b/lib/ExtUtils/CBuilder/Platform/darwin.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub compile { diff --git a/lib/ExtUtils/CBuilder/Platform/dec_osf.pm b/lib/ExtUtils/CBuilder/Platform/dec_osf.pm index bb90ab5..8a1b932 100644 --- a/lib/ExtUtils/CBuilder/Platform/dec_osf.pm +++ b/lib/ExtUtils/CBuilder/Platform/dec_osf.pm @@ -6,7 +6,7 @@ use File::Spec; use vars qw($VERSION @ISA); @ISA = qw(ExtUtils::CBuilder::Platform::Unix); -$VERSION = '0.22'; +$VERSION = '0.23'; sub link_executable { my $self = shift; diff --git a/lib/ExtUtils/CBuilder/Platform/os2.pm b/lib/ExtUtils/CBuilder/Platform/os2.pm index 5f37ebe..da446b3 100644 --- a/lib/ExtUtils/CBuilder/Platform/os2.pm +++ b/lib/ExtUtils/CBuilder/Platform/os2.pm @@ -4,7 +4,7 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.22'; +$VERSION = '0.23'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub need_prelink { 1 } diff --git a/lib/ExtUtils/CBuilder/t/01-basic.t b/lib/ExtUtils/CBuilder/t/01-basic.t index 869350e..3968a37 100644 --- a/lib/ExtUtils/CBuilder/t/01-basic.t +++ b/lib/ExtUtils/CBuilder/t/01-basic.t @@ -53,13 +53,16 @@ for ($source_file, $object_file, $lib_file) { } my @words = $b->split_like_shell(' foo bar'); -if ($^O eq 'MSWin32') { - ok @words, 1; - ok $words[0], ' foo bar'; - skip 'No splitting in split_like_shell() on Win32'; -} -else { - ok @words, 2; - ok $words[0], 'foo'; - ok $words[1], 'bar'; -} + +skip( + $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0, # whether to skip + @words, 2 + ); +skip( + $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0, # whether to skip + $words[0], 'foo' +); +skip( + $^O =~ m/MSWin/ ? "Skip under MSWindows" : 0, # whether to skip + $words[1], 'bar' +);