X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Makefile.PL;h=4588d5b435f35ca3a621bb1dabb8958029c458e4;hb=ce3b70ae39a2403e9387ab28736597c4554bdc47;hp=993181d704a953ed35882fa9310510b8436152bd;hpb=f278a7fb2653409cf7a085f93a0fe6c3874ad646;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/Makefile.PL b/Makefile.PL index 993181d..4588d5b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,148 +12,102 @@ BEGIN { die 'OS unsupported' if $@; } -my $vg; -print 'Checking for valgrind >= 3.1.0 in PATH... '; -for (split /$Config{path_sep}/, $ENV{PATH}) { - $_ .= '/valgrind'; - if (-x) { - my $ver = qx/$_ --version/; - if ($ver =~ s/^valgrind-//) { - $ver = join '', map chr, split /\./, $ver; - if ($ver ge v3.1.0) { - print "$_\n"; - $vg = $_; - last; - } - } - } -} -if (!$vg) { - print "no\n"; - die 'OS unsupported'; -} - # Inspired from Module::Install::Can print "Checking for a valid C compiler in the PATH... "; my @ccs = ($Config{cc}); unshift @ccs, $ENV{CC} if $ENV{CC}; -my $cc; +my @path = File::Spec->path; +@ccs = map { + my $cc = $_; + File::Spec->file_name_is_absolute($cc) + ? $cc + : map File::Spec->catfile($_, $cc), @path +} @ccs; +my $has_cc; CC: -for my $c (@ccs) { - for my $dir (split /$Config{path_sep}/, $ENV{PATH}) { - my $abs = File::Spec->catfile($dir, $c); - if (-x $abs or MM->maybe_command($abs)) { - $cc = $c; - last CC; - } +for my $cc (@ccs) { + if (-x $cc or MM->maybe_command($cc)) { + $has_cc = $cc; + last CC; } } my (@C); -if ($cc) { +if ($has_cc) { my $xs = 'Valgrind.xs'; (my $c = $xs) =~ s/\.xs$/.c/; push @C, $c; - print $cc, "\n"; + print $has_cc, "\n"; } else { print "none\n"; } my $dist = 'Test-Valgrind'; +(my $name = $dist) =~ s{-}{::}g; + +(my $file = $dist) =~ s{-}{/}g; +$file = "lib/$file.pm"; + +my %PREREQ_PM = ( + 'Carp' => 0, + 'Digest::MD5' => 0, + 'Env::Sanctify' => 0, + 'File::HomeDir' => '0.86', + 'File::Path' => 0, + 'File::Spec' => 0, + 'File::Temp' => '0.14', # OO interface + 'Filter::Util::Call' => 0, + 'Fcntl' => 0, + 'List::Util' => 0, + 'POSIX' => 0, + 'Perl::Destruct::Level' => 0, + 'Scalar::Util' => 0, + 'Test::Builder' => 0, + 'Test::More' => 0, + 'XML::Twig' => 0, + 'base' => 0, + 'version' => 0, +); + my %META = ( configure_requires => { - 'Config' => 0, - 'ExtUtils::MakeMaker' => 0, 'File::Spec' => 0, + 'ExtUtils::MakeMaker' => 0, }, build_requires => { 'ExtUtils::MakeMaker' => 0, - 'File::Copy' => 0, 'Test::More' => 0, - 'XSLoader' => 0 + %PREREQ_PM, + }, + recommends => { + 'DynaLoader' => 0, + 'XSLoader' => 0, }, + dynamic_config => 1, resources => { bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist", homepage => "http://search.cpan.org/dist/$dist/", license => 'http://dev.perl.org/licenses/', - repository => "http://git.profvince.com/perl/modules/$dist.git", + repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git", }, ); -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', - AUTHOR => 'Vincent Pit ', - LICENSE => 'perl', - VERSION_FROM => 'lib/Test/Valgrind.pm', - ABSTRACT_FROM => 'lib/Test/Valgrind.pm', - PL_FILES => { - './Gensupp.PL' => 'blib/archpub/' . $supp, - './FixInstall.PL' => 'Makefile.bak', - }, - OPTIMIZE => '-g', - PM => { - 'lib/Test/Valgrind.pm' - => '$(INST_LIB)/Test/Valgrind.pm', - 'lib/Test/Valgrind/Suppressions.pm' - => 'blib/archpub/Test/Valgrind/Suppressions.pm', - }, - C => \@C, - PREREQ_PM => { - 'Carp' => 0, - 'Exporter' => 0, - 'Fcntl' => 0, - 'POSIX' => 0, - 'Perl::Destruct::Level' => 0, - 'Test::Builder' => 0, - }, - MIN_PERL_VERSION => 5.006, - META_MERGE => \%META, - dist => { - PREOP => "touch lib/$supp; " - . 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README', - COMPRESS => 'gzip -9f', SUFFIX => 'gz', - }, - clean => { - FILES => "$dist-* lib/$supp Makefile.bak *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" - }, + NAME => $name, + AUTHOR => 'Vincent Pit ', + LICENSE => 'perl', + VERSION_FROM => $file, + ABSTRACT_FROM => $file, + OPTIMIZE => '-g', + C => \@C, + PREREQ_PM => \%PREREQ_PM, + MIN_PERL_VERSION => 5.006, + META_MERGE => \%META, + dist => { + PREOP => "pod2text $file > \$(DISTVNAME)/README", + COMPRESS => 'gzip -9f', SUFFIX => 'gz', + }, + clean => { + FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" + }, ); -1 while unlink 'lib/' . $supp; - -package MY; - -sub dist_core { - my $dist = shift->SUPER::dist_core(@_); - $dist =~ s/^(\s*dist\s*:+\s*)/$1testvg_dist /m; - return <SUPER::test(@_); - my ($target) = $test =~ /^\s*(test\s*:+)/m; - return "$target Makefile.bak blib/archpub/$supp\n$test"; -} - -sub postamble { - return <