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 /:/, $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 $BUILD_REQUIRES = {
62 'ExtUtils::MakeMaker' => 0,
69 my $tometa = ' >> $(DISTVNAME)/META.yml;';
70 my $build_req = 'echo "build_requires:" ' . $tometa;
71 foreach my $mod ( sort { lc $a cmp lc $b } keys %$BUILD_REQUIRES ) {
72 my $ver = $BUILD_REQUIRES->{$mod};
73 $build_req .= sprintf 'echo " %-30s %s" %s', "$mod:", $ver, $tometa;
78 my $supp = 'lib/Test/Valgrind/Suppressions';
79 open my $tpl, '<', $supp . '.tpl' or die "open($supp.tpl): $!";
80 open my $out, '>', $supp . '.pm' or die "open($supp.pm): $!";
82 s/(VG_PATH\s*=>\s*)undef/$1'$vg'/g;
88 $supp = 'Test/Valgrind/perlTestValgrind.supp';
91 NAME => 'Test::Valgrind',
92 AUTHOR => 'Vincent Pit <perl@profvince.com>',
94 VERSION_FROM => 'lib/Test/Valgrind.pm',
95 ABSTRACT_FROM => 'lib/Test/Valgrind.pm',
97 './Gensupp.PL' => 'blib/archpub/' . $supp,
98 './FixInstall.PL' => 'Makefile.bak',
102 'lib/Test/Valgrind.pm'
103 => '$(INST_LIB)/Test/Valgrind.pm',
104 'lib/Test/Valgrind/Suppressions.pm'
105 => 'blib/archpub/Test/Valgrind/Suppressions.pm',
112 'Perl::Destruct::Level' => 0,
116 PREOP => "touch lib/$supp; "
117 . 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README; '
119 COMPRESS => 'gzip -9f', SUFFIX => 'gz',
121 clean => { FILES => "Test-Valgrind-* lib/$supp Makefile.bak *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" },
123 1 while unlink 'lib/' . $supp;
130 $(CP) lib/Test/Valgrind/Suppressions.{tpl,pm}
131 $(TOUCH) lib/Test/Valgrind/perlTestValgrind.supp