]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blob - FixInstall.PL
Output what we got when t/30-bad.t fails
[perl/modules/Test-Valgrind.git] / FixInstall.PL
1 use strict;
2 use warnings;
3
4 use File::Copy qw/copy/;
5
6 my ($bak) = @ARGV;
7 exit 1 unless defined $bak;
8
9 my $mk = './Makefile';
10 exit 1 unless defined $mk and -e $mk and -r _ and -w _;
11
12 select STDERR;
13
14 print "Fixing Makefile install targets\n";
15
16 if (-e $bak && (stat $bak)[9] >= (stat $mk)[9]) { # mtime
17  print "Makefile is old\n";
18  copy($bak, $mk);
19 } else {
20  print "Makefile is new\n";
21  copy($mk, $bak);
22 }
23
24 open my $in,  '<', $bak or die "open(<$bak): $!";
25 open my $out, '>', $mk  or die "open(>$mk): $!";
26 while (<$in>) {
27  s!^(\s*)\$\(INST_ARCHLIB\)\s+(\$\(DESTINSTALL(?:ARCHLIB|SITEARCH|VENDORARCH)\))\s*\\\s*!$1blib/archpub $2 \\\n!g;
28  print $out $_;
29 }
30 close $out;
31 close $in;
32
33 utime time, time, $bak; # Update mtime