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,
76 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
77 homepage => "http://search.cpan.org/dist/$dist/",
78 license => 'http://dev.perl.org/licenses/',
79 repository => "http://git.profvince.com/perl/modules/$dist.git",
83 my $supp = 'lib/Test/Valgrind/Suppressions';
84 open my $tpl, '<', $supp . '.tpl' or die "open($supp.tpl): $!";
85 open my $out, '>', $supp . '.pm' or die "open($supp.pm): $!";
87 s/(VG_PATH\s*=>\s*)undef/$1'$vg'/g;
93 $supp = 'Test/Valgrind/perlTestValgrind.supp';
96 NAME => 'Test::Valgrind',
97 AUTHOR => 'Vincent Pit <perl@profvince.com>',
99 VERSION_FROM => 'lib/Test/Valgrind.pm',
100 ABSTRACT_FROM => 'lib/Test/Valgrind.pm',
102 './Gensupp.PL' => 'blib/archpub/' . $supp,
103 './FixInstall.PL' => 'Makefile.bak',
107 'lib/Test/Valgrind.pm'
108 => '$(INST_LIB)/Test/Valgrind.pm',
109 'lib/Test/Valgrind/Suppressions.pm'
110 => 'blib/archpub/Test/Valgrind/Suppressions.pm',
118 'Perl::Destruct::Level' => 0,
119 'Test::Builder' => 0,
121 MIN_PERL_VERSION => 5.006,
122 META_MERGE => \%META,
124 PREOP => "touch lib/$supp; "
125 . 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README',
126 COMPRESS => 'gzip -9f', SUFFIX => 'gz',
129 FILES => "$dist-* lib/$supp Makefile.bak *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
132 1 while unlink 'lib/' . $supp;
137 my $dist = shift->SUPER::dist_core(@_);
138 $dist =~ s/^(\s*dist\s*:+\s*)/$1testvg_dist /m;
139 return <<DISTCORE . $dist;
141 \$(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}
148 my $test = shift->SUPER::test(@_);
149 my ($target) = $test =~ /^\s*(test\s*:+)/m;
150 return "$target Makefile.bak blib/archpub/$supp\n$test";
156 \$(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}