]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - FixInstall.PL
Test real-life leaks with some XS
[perl/modules/Test-Valgrind.git] / FixInstall.PL
diff --git a/FixInstall.PL b/FixInstall.PL
new file mode 100755 (executable)
index 0000000..958f1f9
--- /dev/null
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+
+use File::Copy qw/copy/;
+
+my ($bak) = @ARGV;
+exit 1 unless defined $bak;
+
+my $mk = './Makefile';
+exit 1 unless defined $mk and -e $mk and -r _ and -w _;
+
+select STDERR;
+
+print "Fixing Makefile install targets\n";
+
+if (-e $bak && (stat $bak)[9] >= (stat $mk)[9]) { # mtime
+ print "Makefile is old\n";
+ copy($bak, $mk);
+} else {
+ print "Makefile is new\n";
+ copy($mk, $bak);
+}
+
+open my $in,  '<', $bak or die "open(<$bak): $!";
+open my $out, '>', $mk  or die "open(>$mk): $!";
+while (<$in>) {
+ s!^(\s*)\$\(INST_ARCHLIB\)\s+(\$\(DESTINSTALL(?:ARCHLIB|SITEARCH|VENDORARCH)\))\s*\\\s*!$1blib/archpub $2/\$(FULLEXT) \\\n!g;
+ print $out $_;
+}
+close $out;
+close $in;
+
+utime time, time, $bak; # Update mtime