fix bump-version to use the right filename(s), handle decimal versions
[p5sagit/strictures.git] / Makefile.PL
CommitLineData
eae006ee 1use strict;
2use warnings FATAL => 'all';
2c87c763 3use 5.006;
394c3a46 4
2c87c763 5my $have_compiler
6 = ! parse_args()->{PUREPERL_ONLY}
7 && eval { require ExtUtils::CBuilder; 1 }
8 && ExtUtils::CBuilder->new->have_compiler;
eae006ee 9
27826cd1 10my %extra_prereqs = (
11 indirect => 0,
12 multidimensional => 0,
13 'bareword::filehandles' => 0,
14);
ae3262c9 15
2c87c763 16my %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
53my %MM_ARGS = (
54 PREREQ_PM => {
55 ($] >= 5.008004 && $have_compiler ? %extra_prereqs : () )
56 },
c4a93abc 57 realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] },
2c87c763 58);
59
ae3262c9 60sub parse_args {
61 # copied from EUMM
2c87c763 62 require ExtUtils::MakeMaker;
63 require Text::ParseWords;
ae3262c9 64 ExtUtils::MakeMaker::parse_args(
65 my $tmp = {},
66 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
67 @ARGV,
68 );
69 return $tmp->{ARGS} || {};
70}
71
2c87c763 72##############################################################################
73require ExtUtils::MakeMaker;
74(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
27826cd1 75
2c87c763 76# have to do this since old EUMM dev releases miss the eval $VERSION line
77my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
78my $mymeta = $eumm_version >= 6.57_02;
79my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
de111885 80
2c87c763 81($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
82($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
83$MM_ARGS{LICENSE} = $META{license}
84 if $eumm_version >= 6.30;
85$MM_ARGS{NO_MYMETA} = 1
86 if $mymeta_broken;
87$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
88 unless -f 'META.yml';
77f9ff76 89
2c87c763 90for (qw(configure build test runtime)) {
91 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
92 my $r = $MM_ARGS{$key} = {
93 %{$META{prereqs}{$_}{requires}},
94 %{delete $MM_ARGS{$key} || {}},
95 };
96 defined $r->{$_} or delete $r->{$_} for keys %$r;
97}
dfdfcbae 98
2c87c763 99$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
5468e090 100
2c87c763 101delete $MM_ARGS{MIN_PERL_VERSION}
102 if $eumm_version < 6.47_01;
103$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
104 if $eumm_version < 6.63_03;
105$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
106 if $eumm_version < 6.55_01;
107delete $MM_ARGS{CONFIGURE_REQUIRES}
108 if $eumm_version < 6.51_03;
109
110ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);