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