In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/390bf1719e311510ccb1523a89fc238b620350bf?hp=17231eb4bb0a67521fc6517ef00f9756378a7a88>

- Log -----------------------------------------------------------------
commit 390bf1719e311510ccb1523a89fc238b620350bf
Author: Max Maischein <[email protected]>
Date:   Sat Dec 11 15:21:11 2010 +0100

    Windows compatibility fixes for running expand-macro.pl:
    
    a) Close filehandle to try.i so we can erase it
    b) The build process wants to be run from bleadperl/Win32

M       Porting/expand-macro.pl

commit 2c949eae4460585a9e81e28e21547c21a679201a
Author: Max Maischein <[email protected]>
Date:   Sat Dec 11 15:20:13 2010 +0100

    Make Porting/expand-macro.pl use $Config{make} instead of hardcoded `make`

M       Porting/expand-macro.pl
-----------------------------------------------------------------------

Summary of changes:
 Porting/expand-macro.pl |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Porting/expand-macro.pl b/Porting/expand-macro.pl
index df2b002..6b33f74 100755
--- a/Porting/expand-macro.pl
+++ b/Porting/expand-macro.pl
@@ -3,6 +3,7 @@ use strict;
 
 use Pod::Usage;
 use Getopt::Std;
+use Config;
 $Getopt::Std::STANDARD_HELP_VERSION = 1;
 
 my $trysource = "try.c";
@@ -50,6 +51,13 @@ while (<>) {
 }
 die "$macro not found\n" unless defined $header;
 
+if ($^O =~ /MSWin(32|64)/) {
+    # The Win32 (and Win64) build process expects to be run from
+    # bleadperl/Win32
+    chdir "Win32"
+       or die "Couldn't chdir to win32: $!";
+};
+
 open my $out, '>', $trysource or die "Can't open $trysource: $!";
 
 my $sentinel = "$macro expands to";
@@ -80,8 +88,10 @@ EOF
 
 close $out or die "Can't close $trysource: $!";
 
-print "doing: make $tryout\n" if $opt{v};
-system "make $tryout" and die;
+print "doing: $Config{make} $tryout\n" if $opt{v};
+my $cmd = "$Config{make} $tryout";
+system( $cmd ) == 0
+    or die "Couldn't launch [$cmd]: $! / $?";
 
 # if user wants 'indent' formatting ..
 my $out_fh;
@@ -104,15 +114,17 @@ if ($opt{f} || $opt{F}) {
     $out_fh = \*STDOUT;
 }
 
-open my $fh, '<', $tryout or die "Can't open $tryout: $!";
+{
+    open my $fh, '<', $tryout or die "Can't open $tryout: $!";
 
-while (<$fh>) {
-    print $out_fh $_ if /$sentinel/o .. 1;
-}
+    while (<$fh>) {
+       print $out_fh $_ if /$sentinel/o .. 1;
+    }
+};
 
 unless ($opt{k}) {
     foreach($trysource, $tryout) {
-       die "Can't unlink $_" unless unlink $_;
+       die "Can't unlink $_: $!" unless unlink $_;
     }
 }
 

--
Perl5 Master Repository

Reply via email to