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