]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blob - Makefile.PL
Importing Test-Valgrind-0.01.tar.gz
[perl/modules/Test-Valgrind.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use ExtUtils::MakeMaker;
4
5 my $has_vg = 0;
6 print 'Checking for valgrind >= 3.1.0 in PATH... ';
7 for (split /:/, $ENV{PATH}) {
8  my $vg = $_ . '/valgrind';
9  if (-x $vg) {
10   my $ver = qx/$vg --version/;
11   if ($ver =~ s/^valgrind-//) {
12    $ver = join '', map chr, split /\./, $ver;
13    if ($ver ge v3.1.0) {
14     print "yes, $vg\n";
15     $has_vg = 1;
16     last;
17    }
18   }
19  }
20 }
21 if (!$has_vg) {
22  print "no\n";
23  die 'OS unsupported';
24 }
25
26 my $BUILD_REQUIRES = {
27  'ExtUtils::MakeMaker' => 0,
28  'Test::More'          => 0
29 };
30
31 sub build_req {
32  my $tometa = ' >> $(DISTVNAME)/META.yml;';
33  my $build_req = 'echo "build_requires:" ' . $tometa;
34  foreach my $mod ( sort { lc $a cmp lc $b } keys %$BUILD_REQUIRES ) {
35   my $ver = $BUILD_REQUIRES->{$mod};
36   $build_req .= sprintf 'echo "    %-30s %s" %s', "$mod:", $ver, $tometa;
37  }
38  return $build_req;
39 }
40
41 my $supp = 'Test/Valgrind/perlTestValgrind.supp';
42
43 WriteMakefile(
44     NAME          => 'Test::Valgrind',
45     AUTHOR        => 'Vincent Pit <perl@profvince.com>',
46     LICENSE       => 'perl',
47     VERSION_FROM  => 'lib/Test/Valgrind.pm',
48     ABSTRACT_FROM => 'lib/Test/Valgrind.pm',
49     PL_FILES      => { './Gensupp.PL' => 'lib/' . $supp },
50     PM            => {
51         'lib/Test/Valgrind.pm'
52         => '$(INST_LIB)/Test/Valgrind.pm',
53         'lib/Test/Valgrind/Suppressions.pm'
54         => '$(INST_ARCHLIB)/Test/Valgrind/Suppressions.pm',
55         'lib/' . $supp => '$(INST_ARCHLIB)/' . $supp,
56     },
57     PREREQ_PM     => {
58         'Carp'       => 0,
59         'Exporter'   => 0,
60         'POSIX'      => 0,
61         'Test::More' => 0,
62     },
63     dist          => {
64         PREOP      => 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README; '
65                       . build_req,
66         COMPRESS   => 'gzip -9f', SUFFIX => 'gz',
67     },
68     clean         => { FILES => "Test-Valgrind-* lib/$supp *.gcov *.gcda *.gcno cover_db" },
69 );
70 1 while unlink 'lib/' . $supp;
71