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