]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - Makefile.PL
Reset suppressions and template on make clean
[perl/modules/Test-Valgrind.git] / Makefile.PL
index 62522ed70ce9a569008359466ec6adbced371ca4..228fd1b4c5293651dd58e69c3ff57649b9059ed9 100644 (file)
@@ -1,24 +1,26 @@
+use 5.006;
+
 use strict;
 use warnings;
 use ExtUtils::MakeMaker;
 
-my $has_vg = 0;
+my $vg;
 print 'Checking for valgrind >= 3.1.0 in PATH... ';
 for (split /:/, $ENV{PATH}) {
my $vg = $_ . '/valgrind';
- if (-x $vg) {
-  my $ver = qx/$vg --version/;
$_ .= '/valgrind';
+ if (-x) {
+  my $ver = qx/$_ --version/;
   if ($ver =~ s/^valgrind-//) {
    $ver = join '', map chr, split /\./, $ver;
    if ($ver ge v3.1.0) {
-    print "yes, $vg\n";
-    $has_vg = 1;
+    print "yes, $_\n";
+    $vg = $_;
     last;
    }
   }
  }
 }
-if (!$has_vg) {
+if (!$vg) {
  print "no\n";
  die 'OS unsupported';
 }
@@ -38,7 +40,17 @@ sub build_req {
  return $build_req;
 }
 
-my $supp = 'Test/Valgrind/perlTestValgrind.supp';
+my $supp = 'lib/Test/Valgrind/Suppressions';
+open my $tpl, '<', $supp . '.tpl' or die "open($supp.tpl): $!";
+open my $out, '>', $supp . '.pm'  or die "open($supp.pm): $!";
+while (<$tpl>) {
+ s/(VG_PATH\s*=>\s*)undef/$1'$vg'/g;
+ print $out $_;
+}
+close $out;
+close $tpl;
+
+$supp = 'Test/Valgrind/perlTestValgrind.supp';
 
 WriteMakefile(
     NAME          => 'Test::Valgrind',
@@ -55,10 +67,11 @@ WriteMakefile(
         'lib/' . $supp => '$(INST_ARCHLIB)/' . $supp,
     },
     PREREQ_PM     => {
-        'Carp'       => 0,
-        'Exporter'   => 0,
-        'POSIX'      => 0,
-        'Test::More' => 0,
+        'Carp'                  => 0,
+        'Exporter'              => 0,
+        'POSIX'                 => 0,
+        'Perl::Destruct::Level' => 0,
+        'Test::More'            => 0,
     },
     dist          => {
         PREOP      => 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README; '
@@ -69,3 +82,12 @@ WriteMakefile(
 );
 1 while unlink 'lib/' . $supp;
 
+package MY;
+
+sub postamble {
+ <<POSTAMBLE;
+clean ::
+\t\$(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}
+\t\$(TOUCH) lib/Test/Valgrind/perlTestValgrind.supp
+POSTAMBLE
+}