e73a9e364ffb1e3e9eb40645c5c70278cea55c44
[p5sagit/Class-C3-Componentised.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use 5.006002;
4
5 my %META = (
6   name => 'Class-C3-Componentised',
7   license => 'perl_5',
8   prereqs => {
9     configure => { requires => {
10       'ExtUtils::MakeMaker'   => 0,
11     } },
12     build => { requires => {
13     } },
14     test => {
15       requires => {
16         'Test::Exception' => '0.31',
17         'Test::More'      => '0.96',
18       },
19     },
20     runtime => {
21       requires => {
22         'perl'              => '5.006002',
23         'MRO::Compat'       => '0.09',
24         'Class::Inspector'  => '1.23',
25         # we don't actually need Class::C3. MRO::Compat loads it on 5.8. On 5.10
26         # it isn't needed. However, some existing code relies on us loading
27         # Class::C3. We don't want to break it just yet. Therefore we depend
28         # directly on Class::C3 as well.
29         'Class::C3'         => '0.20',
30       },
31     },
32     develop => {
33       requires => {
34         'Test::Pod' => '1.14',
35         'Test::Pod::Coverage' => '1.04',
36       },
37     },
38   },
39   resources => {
40     repository => {
41       url => 'git://git.shadowcat.co.uk/p5sagit/Class-C3-Componentised.git',
42       web => 'https://github.com/p5sagit/Class-C3-Componentised',
43       type => 'git',
44     },
45     bugtracker => {
46       web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Class-C3-Componentised',
47       mailto => 'bug-Class-C3-Componentised@rt.cpan.org',
48     },
49     license => [ 'http://dev.perl.org/licenses/' ],
50   },
51   no_index => {
52     directory => [ 't', 'xt' ]
53   },
54 );
55
56 my %MM_ARGS = ();
57
58 ## BOILERPLATE ###############################################################
59 require ExtUtils::MakeMaker;
60 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
61
62 # have to do this since old EUMM dev releases miss the eval $VERSION line
63 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
64 my $mymeta        = $eumm_version >= 6.57_02;
65 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
66
67 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
68 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
69 $META{license} = [ $META{license} ]
70   if $META{license} && !ref $META{license};
71 $MM_ARGS{LICENSE} = $META{license}[0]
72   if $META{license} && $eumm_version >= 6.30;
73 $MM_ARGS{NO_MYMETA} = 1
74   if $mymeta_broken;
75 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
76   unless -f 'META.yml';
77 $MM_ARGS{PL_FILES} ||= {};
78 $MM_ARGS{NORECURS} = 1
79   if not exists $MM_ARGS{NORECURS};
80
81 for (qw(configure build test runtime)) {
82   my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
83   my $r = $MM_ARGS{$key} = {
84     %{$META{prereqs}{$_}{requires} || {}},
85     %{delete $MM_ARGS{$key} || {}},
86   };
87   defined $r->{$_} or delete $r->{$_} for keys %$r;
88 }
89
90 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
91
92 delete $MM_ARGS{MIN_PERL_VERSION}
93   if $eumm_version < 6.47_01;
94 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
95   if $eumm_version < 6.63_03;
96 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
97   if $eumm_version < 6.55_01;
98 delete $MM_ARGS{CONFIGURE_REQUIRES}
99   if $eumm_version < 6.51_03;
100
101 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
102 ## END BOILERPLATE ###########################################################