]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blob - Makefile.PL
Add two missing dependencies for the suppressions trainer
[perl/modules/Test-Valgrind.git] / Makefile.PL
1 use 5.006;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 my $has_version_pm;
8 BEGIN {
9  eval { require Config };
10  die 'OS unsupported' if $@;
11  Config->import(qw/%Config/);
12  eval { require File::Spec };
13  die 'OS unsupported' if $@;
14  $has_version_pm = eval "require version; 1" || 0;
15 }
16 use lib 'lib';
17
18 print 'Checking for valgrind ' . ('>= 3.1.0 ' x $has_version_pm) .'in PATH... ';
19 require Test::Valgrind::Session;
20 my $vg = eval q[
21  Test::Valgrind::Session->new((min_version => '3.1.0') x $has_version_pm)
22                         ->valgrind
23 ];
24 if ($vg) {
25  print "$vg\n";
26 } else {
27  print "no\n";
28  die 'OS unsupported';
29 }
30
31 # Inspired from Module::Install::Can
32 print "Checking for a valid C compiler in the PATH... ";
33 my @ccs = ($Config{cc});
34 unshift @ccs, $ENV{CC} if $ENV{CC};
35 my @path = File::Spec->path;
36 @ccs = map {
37  my $cc = $_;
38  File::Spec->file_name_is_absolute($cc)
39    ? $cc
40    : map File::Spec->catfile($_, $cc), @path
41 } @ccs;
42 my $has_cc;
43 CC:
44 for my $cc (@ccs) {
45  if (-x $cc or MM->maybe_command($cc)) {
46   $has_cc = $cc;
47   last CC;
48  }
49 }
50 my (@C);
51 if ($has_cc) {
52  my $xs = 'Valgrind.xs';
53  (my $c = $xs) =~ s/\.xs$/.c/;
54  push @C, $c;
55  print $has_cc, "\n";
56 } else {
57  print "none\n";
58 }
59
60 my %PREREQ_PM = (
61  'Carp'                  => 0,
62  'Digest::MD5'           => 0,
63  'Env::Sanctify'         => 0,
64  'File::HomeDir'         => '0.86',
65  'File::Path'            => 0,
66  'File::Spec'            => 0,
67  'File::Temp'            => '0.14', # OO interface
68  'Filter::Util::Call'    => 0,
69  'Fcntl'                 => 0,
70  'List::Util'            => 0,
71  'POSIX'                 => 0,
72  'Perl::Destruct::Level' => 0,
73  'Scalar::Util'          => 0,
74  'Test::Builder'         => 0,
75  'Test::More'            => 0,
76  'XML::Twig'             => 0,
77  'base'                  => 0,
78  'version'               => 0,
79 );
80
81 my $dist = 'Test-Valgrind';
82
83 my %META = (
84  configure_requires => {
85   'Carp'                => 0,
86   'Config'              => 0,
87   'ExtUtils::MakeMaker' => 0,
88   'Fcntl'               => 0,
89   'File::Spec'          => 0,
90   'POSIX'               => 0,
91   'Scalar::Util'        => 0,
92   'base'                => 0,
93   'version'             => 0,
94  },
95  build_requires => {
96   'ExtUtils::MakeMaker' => 0,
97   'Test::More'          => 0,
98   %PREREQ_PM,
99  },
100  recommends => {
101   'DynaLoader' => 0,
102   'XSLoader'   => 0,
103  },
104  resources => {
105   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
106   homepage   => "http://search.cpan.org/dist/$dist/",
107   license    => 'http://dev.perl.org/licenses/',
108   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
109  },
110 );
111
112 WriteMakefile(
113     NAME             => 'Test::Valgrind',
114     AUTHOR           => 'Vincent Pit <perl@profvince.com>',
115     LICENSE          => 'perl',
116     VERSION_FROM     => 'lib/Test/Valgrind.pm',
117     ABSTRACT_FROM    => 'lib/Test/Valgrind.pm',
118     OPTIMIZE         => '-g',
119     C                => \@C,
120     PREREQ_PM        => \%PREREQ_PM,
121     MIN_PERL_VERSION => 5.006,
122     META_MERGE       => \%META,
123     dist             => {
124         PREOP    => 'pod2text lib/Test/Valgrind.pm > $(DISTVNAME)/README',
125         COMPRESS => 'gzip -9f', SUFFIX => 'gz',
126     },
127     clean            => {
128         FILES => "$dist-* Makefile.bak *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
129     },
130 );