Release commit for 2.000004
[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   prereqs => {
21     configure => { requires => { } },
22     build => { requires => { } },
23     test => { requires => {
24       'Test::More' => 0,
25     } },
26     runtime => {
27       requires => {
28         perl => '5.006',
29       },
30       suggests => {
31         %extra_prereqs,
32       },
33     },
34     develop => { requires => {
35       'Test::Pod' => 0,
36       'Test::Pod::Coverage' => 0,
37       'Pod::Coverage::CountParents' => 0,
38       %extra_prereqs,
39     } },
40   },
41   resources => {
42     # r/w: p5sagit@git.shadowcat.co.uk:strictures.git
43     repository => {
44       url => 'git://git.shadowcat.co.uk/p5sagit/strictures.git',
45       web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git',
46       type => 'git',
47     },
48     bugtracker => {
49       mailto => 'bug-strictures@rt.cpan.org',
50       web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=strictures',
51     },
52     license => [ 'http://dev.perl.org/licenses/' ],
53   },
54   no_index => {
55     directory => [ 't', 'xt', 'inc' ]
56   },
57   x_authority => 'cpan:MSTROUT',
58 );
59
60 my %MM_ARGS = (
61   PREREQ_PM => {
62     ($] >= 5.008004 && $have_compiler ? %extra_prereqs : () )
63   },
64 );
65
66 sub parse_args {
67   # copied from EUMM
68   require ExtUtils::MakeMaker;
69   require Text::ParseWords;
70   ExtUtils::MakeMaker::parse_args(
71     my $tmp = {},
72     Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
73     @ARGV,
74   );
75   return $tmp->{ARGS} || {};
76 }
77
78 ## BOILERPLATE ###############################################################
79 require ExtUtils::MakeMaker;
80 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
81
82 # have to do this since old EUMM dev releases miss the eval $VERSION line
83 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
84 my $mymeta        = $eumm_version >= 6.57_02;
85 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
86
87 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
88 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
89 $META{license} = [ $META{license} ]
90   if $META{license} && !ref $META{license};
91 $MM_ARGS{LICENSE} = $META{license}[0]
92   if $META{license} && $eumm_version >= 6.30;
93 $MM_ARGS{NO_MYMETA} = 1
94   if $mymeta_broken;
95 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
96   unless -f 'META.yml';
97
98 for (qw(configure build test runtime)) {
99   my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
100   my $r = $MM_ARGS{$key} = {
101     %{$META{prereqs}{$_}{requires} || {}},
102     %{delete $MM_ARGS{$key} || {}},
103   };
104   defined $r->{$_} or delete $r->{$_} for keys %$r;
105 }
106
107 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
108
109 delete $MM_ARGS{MIN_PERL_VERSION}
110   if $eumm_version < 6.47_01;
111 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
112   if $eumm_version < 6.63_03;
113 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
114   if $eumm_version < 6.55_01;
115 delete $MM_ARGS{CONFIGURE_REQUIRES}
116   if $eumm_version < 6.51_03;
117
118 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
119 ## END BOILERPLATE ###########################################################