boilerplate-ify Makefile.PL
[p5sagit/Package-Variant.git] / Makefile.PL
CommitLineData
eacc208a 1use strict;
2use warnings FATAL => 'all';
eacc208a 3
6f32ee73 4my %META = (
5 name => 'Package-Variant',
6 prereqs => {
7 test => { requires => {
8 'Test::Fatal' => 0,
9 }, },
10 runtime => { requires => {
11 'perl' => 5.006,
12 'strictures' => 1,
13 'Carp' => 0,
14 'Import::Into' => 1,
15 'Module::Runtime' => '0.013',
16 }, },
485d5893 17 },
6f32ee73 18 dynamic_config => 0,
19 resources => {
20 # r/w: p5sagit@git.shadowcat.co.uk:Package-Variant.git
21 repository => {
22 url => 'git://git.shadowcat.co.uk/p5sagit/Package-Variant.git',
23 web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Package-Variant.git',
24 type => 'git',
25 },
26 bugtracker => {
27 mailto => 'bug-Package-Variant@rt.cpan.org',
28 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Package-Variant',
49cc3b7c 29 },
30 },
6f32ee73 31 no_index => { directory => [ 't', 'xt', ], package => [ 'string' ] },
eacc208a 32);
6f32ee73 33
34my %MM_ARGS = ();
35
36##############################################################################
37require ExtUtils::MakeMaker;
38(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
39
40# have to do this since old EUMM dev releases miss the eval $VERSION line
41my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
42my $mymeta = $eumm_version >= 6.57_02;
43my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
44
45($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
46($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
47$MM_ARGS{LICENSE} = $META{license}
48 if $eumm_version >= 6.30;
49$MM_ARGS{NO_MYMETA} = 1
50 if $mymeta_broken;
51$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
52 unless -f 'META.yml';
53
54for (qw(configure build test runtime)) {
55 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
56 my $r = $MM_ARGS{$key} = {
57 %{$META{prereqs}{$_}{requires} || {}},
58 %{delete $MM_ARGS{$key} || {}},
59 };
60 defined $r->{$_} or delete $r->{$_} for keys %$r;
61}
62
63$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
64
65delete $MM_ARGS{MIN_PERL_VERSION}
66 if $eumm_version < 6.47_01;
67$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
68 if $eumm_version < 6.63_03;
69$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
70 if $eumm_version < 6.55_01;
71delete $MM_ARGS{CONFIGURE_REQUIRES}
72 if $eumm_version < 6.51_03;
73
74ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);