include ExtUtils::HasCompiler in dist as intended
[gitmo/Class-C3.git] / Makefile.PL
CommitLineData
e861fe16 1use strict;
9ab3d5c3 2use warnings FATAL => 'all';
e3c0c9d3 3use 5.006;
38787c29 4use lib 'inc';
5use ExtUtils::HasCompiler qw(can_compile_loadable_object);
e3c0c9d3 6
9ab3d5c3 7my %META = (
8 name => 'Class-C3',
9 license => 'perl_5',
10 prereqs => {
11 configure => { requires => {
12 'ExtUtils::MakeMaker' => 0,
9ab3d5c3 13 } },
14 build => { requires => {
15 } },
16 test => {
17 requires => {
18 'Test::More' => '0.47',
19 },
20 },
21 runtime => {
22 requires => {
23 'Algorithm::C3' => '0.07',
24 'Scalar::Util' => '0',
25 'perl' => 5.006,
26 },
27 },
28 develop => {
29 requires => { map { $_ => 0 } qw(
30 indirect multidimensional bareword::filehandles
31 Moose Mouse namespace::clean namespace::autoclean
32 MooseX::Types::Common::Numeric
33 Type::Tiny
34 ) },
35 },
36 },
e3c0c9d3 37 resources => {
9ab3d5c3 38 repository => {
39 url => 'git://git.shadowcat.co.uk/gitmo/Class-C3.git',
40 web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/Class-C3.git',
41 type => 'git',
42 },
43 bugtracker => {
44 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Class-C3',
45 mailto => 'bug-Class-C3@rt.cpan.org',
46 },
47 homepage => 'https://metacpan.org/release/Class-C3',
48 license => [ 'http://dev.perl.org/licenses/' ],
49 },
50 no_index => {
38787c29 51 directory => [ 't', 'xt', 'opt', 'inc' ]
e3c0c9d3 52 },
53);
56215427 54
9ab3d5c3 55my %MM_ARGS = (
56 TEST_REQUIRES => {
57 ( $] < 5.009_005 and is_smoker() )
58 ? ( 'Devel::Hide' => 0 ) : ()
e3c0c9d3 59 },
9ab3d5c3 60 PREREQ_PM => {
38787c29 61 ( $] < 5.009_005 and can_compile_loadable_object(quiet => 1) )
9ab3d5c3 62 ? ( 'Class::C3::XS' => '0.13' ) : ()
63 },
64);
56215427 65
e861fe16 66sub is_smoker {
67 return ( $ENV{AUTOMATED_TESTING} && ! $ENV{PERL5_CPANM_IS_RUNNING} && ! $ENV{RELEASE_TESTING} )
68}
e63446b0 69
70## BOILERPLATE ###############################################################
71require ExtUtils::MakeMaker;
72(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
73
74# have to do this since old EUMM dev releases miss the eval $VERSION line
75my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
76my $mymeta = $eumm_version >= 6.57_02;
77my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
78
79($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
80($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
81$META{license} = [ $META{license} ]
82 if $META{license} && !ref $META{license};
83$MM_ARGS{LICENSE} = $META{license}[0]
84 if $META{license} && $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';
89
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}
98
99$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
100
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);
111## END BOILERPLATE ###########################################################