On Fri, Dec 12, 2008 at 07:10:58PM -0800, James Wright wrote:
> What is the recommended procedure for perl-based ports that need newer 
> versions of core modules, e.g. ExtUtils::CBuilder?
>

Update them, test, test, test and eventually get them committed.
I'm already looking at some of those as new cpan modules have the
tendency to require the most recent version of their dependencies.

ExtUtils::CBuilder is already at 0.24 in my tree but i haven't sent it
out yet for testing.  Diff below.

The recommended procedure thus is: apply the diff, build perl, run the
tests, install and test as much as is possible (base, ports and
whatever could be affected by it).  That's at least what i am doing and
it has worked out in the past.

Kind regards,
Simon


Index: lib/ExtUtils/CBuilder.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 CBuilder.pm
--- lib/ExtUtils/CBuilder.pm    29 Sep 2008 17:18:32 -0000      1.1.1.1
+++ lib/ExtUtils/CBuilder.pm    13 Dec 2008 09:57:12 -0000
@@ -5,7 +5,7 @@ use File::Path ();
 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 @@ my %OSTYPES = qw(
                 sunos     Unix
                 cygwin    Unix
                 os2       Unix
+                gnu       Unix
+                gnukfreebsd Unix
                 
                 dos       Windows
                 MSWin32   Windows
Index: lib/ExtUtils/CBuilder/Base.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Base.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Base.pm
--- lib/ExtUtils/CBuilder/Base.pm       29 Sep 2008 17:18:33 -0000      1.1.1.1
+++ lib/ExtUtils/CBuilder/Base.pm       13 Dec 2008 09:57:12 -0000
@@ -6,9 +6,10 @@ use File::Basename;
 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 @@ 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);
Index: lib/ExtUtils/CBuilder/Changes
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Changes,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Changes
--- lib/ExtUtils/CBuilder/Changes       29 Sep 2008 17:18:33 -0000      1.1.1.1
+++ lib/ExtUtils/CBuilder/Changes       13 Dec 2008 09:57:12 -0000
@@ -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.
 
Index: lib/ExtUtils/CBuilder/Platform/Unix.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Unix.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Unix.pm
--- lib/ExtUtils/CBuilder/Platform/Unix.pm      29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/Unix.pm      13 Dec 2008 09:57:12 -0000
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Base;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 sub link_executable {
Index: lib/ExtUtils/CBuilder/Platform/VMS.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 VMS.pm
--- lib/ExtUtils/CBuilder/Platform/VMS.pm       29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/VMS.pm       13 Dec 2008 09:57:12 -0000
@@ -4,7 +4,7 @@ use strict;
 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 @@ sub _liblist_ext {
   # 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);
Index: lib/ExtUtils/CBuilder/Platform/Windows.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Windows.pm
--- lib/ExtUtils/CBuilder/Platform/Windows.pm   29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/Windows.pm   13 Dec 2008 09:57:12 -0000
@@ -7,9 +7,10 @@ use File::Basename;
 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 _compiler_type {
 }
 
 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 @@ sub compile {
     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 @@ 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;
@@ -402,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(
@@ -414,8 +376,6 @@ sub write_linker_script {
                 def_file implib map_file)            } )
   );
 
-  close SCRIPT;
-
   push @{$spec{lddlflags}}, '@"' . $script . '"';
 
   return %spec;
@@ -459,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
@@ -467,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;
@@ -525,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    . '"';
 
@@ -669,31 +623,29 @@ 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 . '"';
 
Index: lib/ExtUtils/CBuilder/Platform/aix.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/aix.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 aix.pm
--- lib/ExtUtils/CBuilder/Platform/aix.pm       29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/aix.pm       13 Dec 2008 09:57:12 -0000
@@ -5,7 +5,7 @@ use ExtUtils::CBuilder::Platform::Unix;
 use File::Spec;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub need_prelink { 1 }
Index: lib/ExtUtils/CBuilder/Platform/cygwin.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/cygwin.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 cygwin.pm
--- lib/ExtUtils/CBuilder/Platform/cygwin.pm    29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/cygwin.pm    13 Dec 2008 09:57:12 -0000
@@ -5,7 +5,7 @@ use File::Spec;
 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 {
Index: lib/ExtUtils/CBuilder/Platform/darwin.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/darwin.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 darwin.pm
--- lib/ExtUtils/CBuilder/Platform/darwin.pm    29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/darwin.pm    13 Dec 2008 09:57:12 -0000
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.21';
+$VERSION = '0.24';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub compile {
Index: lib/ExtUtils/CBuilder/Platform/dec_osf.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/dec_osf.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 dec_osf.pm
--- lib/ExtUtils/CBuilder/Platform/dec_osf.pm   29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/dec_osf.pm   13 Dec 2008 09:57:12 -0000
@@ -6,7 +6,7 @@ use File::Spec;
 
 use vars qw($VERSION @ISA);
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
-$VERSION = '0.21';
+$VERSION = '0.24';
 
 sub link_executable {
   my $self = shift;
Index: lib/ExtUtils/CBuilder/Platform/os2.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/Platform/os2.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 os2.pm
--- lib/ExtUtils/CBuilder/Platform/os2.pm       29 Sep 2008 17:18:33 -0000      
1.1.1.1
+++ lib/ExtUtils/CBuilder/Platform/os2.pm       13 Dec 2008 09:57:12 -0000
@@ -4,7 +4,7 @@ use strict;
 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 }
Index: lib/ExtUtils/CBuilder/t/01-basic.t
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/ExtUtils/CBuilder/t/01-basic.t,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 01-basic.t
--- lib/ExtUtils/CBuilder/t/01-basic.t  29 Sep 2008 17:18:33 -0000      1.1.1.1
+++ lib/ExtUtils/CBuilder/t/01-basic.t  13 Dec 2008 09:57:12 -0000
@@ -53,6 +53,16 @@ for ($source_file, $object_file, $lib_fi
 }
 
 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'
+);

Reply via email to