5 use ExtUtils::MakeMaker;
8 eval { require Config };
9 die 'OS unsupported' if $@;
10 Config->import(qw/%Config/);
11 eval { require File::Spec };
12 die 'OS unsupported' if $@;
16 print 'Checking for valgrind >= 3.1.0 in PATH... ';
17 for (split /$Config{path_sep}/, $ENV{PATH}) {
20 my $ver = qx/$_ --version/;
21 if ($ver =~ s/^valgrind-//) {
22 $ver = join '', map chr, split /\./, $ver;
36 # Inspired from Module::Install::Can
37 print "Checking for a valid C compiler in the PATH... ";
38 my @ccs = ($Config{cc});
39 unshift @ccs, $ENV{CC} if $ENV{CC};
43 for my $dir (split /$Config{path_sep}/, $ENV{PATH}) {
44 my $abs = File::Spec->catfile($dir, $c);
45 if (-x $abs or MM->maybe_command($abs)) {
53 my $xs = 'Valgrind.xs';
54 (my $c = $xs) =~ s/\.xs$/.c/;
61 my $dist = 'Test-Valgrind';
64 configure_requires => {
66 'ExtUtils::MakeMaker' => 0,
70 'ExtUtils::MakeMaker' => 0,
79 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
80 homepage => "http://search.cpan.org/dist/$dist/",
81 license => 'http://dev.perl.org/licenses/',
82 repository => "http://git.profvince.com/perl/modules/$dist.git",
86 my $supp = 'lib/Test/Valgrind/Suppressions';
87 open my $tpl, '<', $supp . '.tpl' or die "open($supp.tpl): $!";
88 open my $out, '>', $supp . '.pm' or die "open($supp.pm): $!";
90 s/(VG_PATH\s*=>\s*)undef/$1'$vg'/g;
96 $supp = 'Test/Valgrind/perlTestValgrind.supp';
99 NAME => 'Test::Valgrind',
100 AUTHOR => 'Vincent Pit <perl@profvince.com>',
102 VERSION_FROM => 'lib/Test/Valgrind.pm',
103 ABSTRACT_FROM => 'lib/Test/Valgrind.pm',
105 './Gensupp.PL' => 'blib/archpub/' . $supp,
106 './FixInstall.PL' => 'Makefile.bak',
110 'lib/Test/Valgrind.pm'
111 => '$(INST_LIB)/Test/Valgrind.pm',
112 'lib/Test/Valgrind/Suppressions.pm'
113 => 'blib/archpub/Test/Valgrind/Suppressions.pm',
121 'Perl::Destruct::Level' => 0,
122 'Test::Builder' => 0,
124 MIN_PERL_VERSION => 5.006,
125 META_MERGE => \%META,
127 PREOP => "touch lib/$supp; "
128 . 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README',
129 COMPRESS => 'gzip -9f', SUFFIX => 'gz',
132 FILES => "$dist-* lib/$supp Makefile.bak *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
135 1 while unlink 'lib/' . $supp;
140 my $dist = shift->SUPER::dist_core(@_);
141 $dist =~ s/^(\s*dist\s*:+\s*)/$1testvg_dist /m;
142 return <<DISTCORE . $dist;
144 \$(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}
151 my $test = shift->SUPER::test(@_);
152 my ($target) = $test =~ /^\s*(test\s*:+)/m;
153 return "$target Makefile.bak blib/archpub/$supp\n$test";
159 \$(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}