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