switch to Pod::Coverage::TrustMe
[p5sagit/strictures.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use 5.006;
4 use lib 'inc';
5 use ExtUtils::HasCompiler 'can_compile_loadable_object';
6
7 my $have_compiler
8   = ! parse_args()->{PUREPERL_ONLY}
9   && can_compile_loadable_object(quiet => 1);
10
11 my %extra_prereqs = (
12   indirect => 0,
13   multidimensional => 0,
14   'bareword::filehandles' => 0,
15 );
16
17 my %META = (
18   name => 'strictures',
19   license => 'perl_5',
20   dynamic_config => 1,
21   prereqs => {
22     configure => { requires => { } },
23     build => { requires => { } },
24     test => { requires => {
25       'Test::More' => 0,
26     } },
27     runtime => {
28       requires => {
29         perl => '5.006',
30       },
31       suggests => {
32         %extra_prereqs,
33       },
34     },
35     develop => { requires => {
36       'Test::Pod' => 0,
37       'Test::Pod::Coverage::TrustMe' => 0,
38       %extra_prereqs,
39     } },
40   },
41   resources => {
42     # GitHub mirrors from Shadowcat. We list it so we can get pull requests.
43     # The canonical repo is:
44     # r/o: git://git.shadowcat.co.uk/p5sagit/strictures.git
45     # r/w: p5sagit@git.shadowcat.co.uk:strictures.git
46     # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git
47     repository => {
48       url => 'https://github.com/p5sagit/strictures.git',
49       web => 'https://github.com/p5sagit/strictures',
50       type => 'git',
51     },
52     bugtracker => {
53       mailto => 'bug-strictures@rt.cpan.org',
54       web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=strictures',
55     },
56     license => [ 'http://dev.perl.org/licenses/' ],
57   },
58   no_index => {
59     directory => [ 't', 'xt', 'inc' ]
60   },
61   x_authority => 'cpan:MSTROUT',
62   x_contributors => [ # manually added, from git shortlog -e -s -n
63     'Graham Knop <haarg@haarg.org>',
64     'Karen Etheridge <ether@cpan.org>',
65     'Matt S Trout <mst@shadowcat.co.uk>',
66     'Peter Rabbitson <ribasushi@cpan.org>',
67     'Christian Walde <walde.christian@googlemail.com>',
68     'Diab Jerius <djerius@cfa.harvard.edu>',
69   ],
70 );
71
72 my %MM_ARGS = (
73   PREREQ_PM => {
74     ("$]" >= 5.008004 && $have_compiler ? %extra_prereqs : () )
75   },
76 );
77
78 sub parse_args {
79   # copied from EUMM
80   require ExtUtils::MakeMaker;
81   require Text::ParseWords;
82   ExtUtils::MakeMaker::parse_args(
83     my $tmp = {},
84     Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
85     @ARGV,
86   );
87   return $tmp->{ARGS} || {};
88 }
89
90 ## BOILERPLATE ###############################################################
91 require ExtUtils::MakeMaker;
92 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
93
94 # have to do this since old EUMM dev releases miss the eval $VERSION line
95 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
96 my $mymeta        = $eumm_version >= 6.57_02;
97 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
98
99 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
100 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
101 $META{license} = [ $META{license} ]
102   if $META{license} && !ref $META{license};
103 $MM_ARGS{LICENSE} = $META{license}[0]
104   if $META{license} && $eumm_version >= 6.30;
105 $MM_ARGS{NO_MYMETA} = 1
106   if $mymeta_broken;
107 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
108   unless -f 'META.yml';
109
110 for (qw(configure build test runtime)) {
111   my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
112   my $r = $MM_ARGS{$key} = {
113     %{$META{prereqs}{$_}{requires} || {}},
114     %{delete $MM_ARGS{$key} || {}},
115   };
116   defined $r->{$_} or delete $r->{$_} for keys %$r;
117 }
118
119 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
120
121 delete $MM_ARGS{MIN_PERL_VERSION}
122   if $eumm_version < 6.47_01;
123 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
124   if $eumm_version < 6.63_03;
125 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
126   if $eumm_version < 6.55_01;
127 delete $MM_ARGS{CONFIGURE_REQUIRES}
128   if $eumm_version < 6.51_03;
129
130 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
131 ## END BOILERPLATE ###########################################################