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