Blob Blame History Raw
perl-update-ExtUtils-CBuilder-0.24

diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Base.pm perl-5.10.0/lib/ExtUtils/CBuilder/Base.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Base.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Base.pm	2009-03-11 20:12:36.000000000 +0100
@@ -6,9 +6,10 @@
 use Cwd ();
 use Config;
 use Text::ParseWords;
+use IO::File;
 
 use vars qw($VERSION);
-$VERSION = '0.21';
+$VERSION = '0.24';
 
 sub new {
   my $class = shift;
@@ -118,10 +119,8 @@
   
   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 -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Changes perl-5.10.0/lib/ExtUtils/CBuilder/Changes
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Changes	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Changes	2009-03-11 20:13:30.000000000 +0100
@@ -1,5 +1,31 @@
 Revision history for Perl extension ExtUtils::CBuilder.
 
+ - Added 'gnu' and 'gnukfreebsd' as Unix variants. [Niko Tyni]
+
+ - Brought in some VMS fixes from bleadperl: "Correct and complete
+   CBuilder's handling of external libraries when linking on VMS."
+   [Craig Berry]
+
+0.23 - Sat Apr 19 22:28:03 2008
+
+ - 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 -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/Unix.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/Unix.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/Unix.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/Unix.pm	2009-03-11 20:12:36.000000000 +0100
@@ -4,7 +4,7 @@
 use ExtUtils::CBuilder::Base;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 sub link_executable {
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/VMS.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/VMS.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/VMS.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/VMS.pm	2009-03-11 20:12:36.000000000 +0100
@@ -4,7 +4,7 @@
 use ExtUtils::CBuilder::Base;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.22';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 use File::Spec::Functions qw(catfile catdir);
@@ -134,7 +134,7 @@
   # In general, we pass through the basic libraries from %Config unchanged.
   # The one exception is that if we're building in the Perl source tree, and
   # a library spec could be resolved via a logical name, we go to some trouble
-  # to insure that the copy in the local tree is used, rather than one to
+  # to ensure that the copy in the local tree is used, rather than one to
   # which a system-wide logical may point.
   if ($self->perl_src) {
     my($lib,$locspec,$type);
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/Windows.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/Windows.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/Windows.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/Windows.pm	2009-03-11 20:12:36.000000000 +0100
@@ -7,9 +7,10 @@
 use File::Spec;
 
 use ExtUtils::CBuilder::Base;
+use IO::File;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 sub new {
@@ -33,61 +34,24 @@
 }
 
 sub split_like_shell {
-  # As it turns out, Windows command-parsing is very different from
-  # Unix command-parsing.  Double-quotes mean different things,
-  # backslashes don't necessarily mean escapes, and so on.  So we
-  # can't use Text::ParseWords::shellwords() to break a command string
-  # into words.  The algorithm below was bashed out by Randy and Ken
-  # (mostly Randy), and there are a lot of regression tests, so we
-  # should feel free to adjust if desired.
-  
+  # Since Windows will pass the whole command string (not an argument
+  # array) to the target program and make the program parse it itself,
+  # we don't actually need to do any processing here.
   (my $self, local $_) = @_;
   
   return @$_ if defined() && UNIVERSAL::isa($_, 'ARRAY');
-  
-  my @argv;
-  return @argv unless defined() && length();
-  
-  my $arg = '';
-  my( $i, $quote_mode ) = ( 0, 0 );
-  
-  while ( $i < length() ) {
-    
-    my $ch      = substr( $_, $i  , 1 );
-    my $next_ch = substr( $_, $i+1, 1 );
-    
-    if ( $ch eq '\\' && $next_ch eq '"' ) {
-      $arg .= '"';
-      $i++;
-    } elsif ( $ch eq '\\' && $next_ch eq '\\' ) {
-      $arg .= '\\';
-      $i++;
-    } elsif ( $ch eq '"' && $next_ch eq '"' && $quote_mode ) {
-      $quote_mode = !$quote_mode;
-      $arg .= '"';
-      $i++;
-    } elsif ( $ch eq '"' && $next_ch eq '"' && !$quote_mode &&
-	      ( $i + 2 == length()  ||
-		substr( $_, $i + 2, 1 ) eq ' ' )
-	    ) { # for cases like: a"" => [ 'a' ]
-      push( @argv, $arg );
-      $arg = '';
-      $i += 2;
-    } elsif ( $ch eq '"' ) {
-      $quote_mode = !$quote_mode;
-    } elsif ( $ch eq ' ' && !$quote_mode ) {
-      push( @argv, $arg ) if $arg;
-      $arg = '';
-      ++$i while substr( $_, $i + 1, 1 ) eq ' ';
-    } else {
-      $arg .= $ch;
-    }
-    
-    $i++;
-  }
-  
-  push( @argv, $arg ) if defined( $arg ) && length( $arg );
-  return @argv;
+  return unless defined() && length();
+  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 {
@@ -119,7 +83,7 @@
     cflags      => [
                      $self->split_like_shell($cf->{ccflags}),
                      $self->split_like_shell($cf->{cccdlflags}),
-                     $self->split_like_shell($cf->{extra_compiler_flags}),
+                     $self->split_like_shell($args{extra_compiler_flags}),
                    ],
     optimize    => [ $self->split_like_shell($cf->{optimize})    ],
     defines     => \@defines,
@@ -329,18 +293,16 @@
   $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;
@@ -402,10 +364,10 @@
 
   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(
@@ -414,8 +376,6 @@
                 def_file implib map_file)            } )
   );
 
-  close SCRIPT;
-
   push @{$spec{lddlflags}}, '@"' . $script . '"';
 
   return %spec;
@@ -459,7 +419,7 @@
 
   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
@@ -467,15 +427,13 @@
   # 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;
@@ -525,29 +483,25 @@
   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    . '"';
 
@@ -669,32 +623,30 @@
 
   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 -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/aix.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/aix.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/aix.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/aix.pm	2009-03-11 20:12:36.000000000 +0100
@@ -5,7 +5,7 @@
 use File::Spec;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub need_prelink { 1 }
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/cygwin.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/cygwin.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/cygwin.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/cygwin.pm	2009-03-11 20:12:36.000000000 +0100
@@ -5,7 +5,7 @@
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub link_executable {
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/darwin.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/darwin.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/darwin.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/darwin.pm	2009-03-11 20:12:36.000000000 +0100
@@ -4,7 +4,7 @@
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub compile {
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/dec_osf.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/dec_osf.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/dec_osf.pm	2009-03-11 20:12:36.000000000 +0100
@@ -6,7 +6,7 @@
 
 use vars qw($VERSION @ISA);
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
-$VERSION = '0.21';
+$VERSION = '0.24';
 
 sub link_executable {
   my $self = shift;
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/os2.pm perl-5.10.0/lib/ExtUtils/CBuilder/Platform/os2.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/Platform/os2.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/Platform/os2.pm	2009-03-11 20:12:36.000000000 +0100
@@ -4,7 +4,7 @@
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub need_prelink { 1 }
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder/t/01-basic.t perl-5.10.0/lib/ExtUtils/CBuilder/t/01-basic.t
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder/t/01-basic.t	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder/t/01-basic.t	2009-03-11 20:08:15.000000000 +0100
@@ -53,6 +53,16 @@
 }
 
 my @words = $b->split_like_shell(' foo bar');
-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'
+);
diff -urN perl-5.10.0.orig/lib/ExtUtils/CBuilder.pm perl-5.10.0/lib/ExtUtils/CBuilder.pm
--- perl-5.10.0.orig/lib/ExtUtils/CBuilder.pm	2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/ExtUtils/CBuilder.pm	2009-03-11 20:12:36.000000000 +0100
@@ -5,7 +5,7 @@
 use File::Basename ();
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 $VERSION = eval $VERSION;
 
 # Okay, this is the brute-force method of finding out what kind of
@@ -36,6 +36,8 @@
 		 sunos     Unix
 		 cygwin    Unix
 		 os2       Unix
+		 gnu       Unix
+		 gnukfreebsd Unix
 		 
 		 dos       Windows
 		 MSWin32   Windows