a86586737462e0abaf4e6479c35bad0171b4dd93
[gitmo/Moo.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use 5.008001;
4 use ExtUtils::MakeMaker;
5 (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
6
7 my %BUILD_DEPS = ();
8
9 my %TEST_DEPS = (
10   'Test::More' => 0.96,
11   'Test::Fatal' => 0.003,
12 );
13
14 my %RUN_DEPS = (
15   'Class::Method::Modifiers' => 1.10,
16   'strictures' => 1.004003,
17   'Module::Runtime' => 0.012,
18   'Role::Tiny' => 1.002004,
19   'Devel::GlobalDestruction' => 0.11,
20 );
21
22 # have to do this since old EUMM dev releases miss the eval $VERSION line
23 my $mymeta_works = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.5707 };
24 my $mymeta = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.5702 };
25
26 my $has_test_requires = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.63_03 };
27
28 if (not $has_test_requires)
29 {
30     %BUILD_DEPS = (%BUILD_DEPS, %TEST_DEPS);
31     %TEST_DEPS = ();
32 }
33
34 my %extra_info = (
35   resources => {
36     repository => 'git://git.shadowcat.co.uk/gitmo/Moo.git',
37     IRC => 'irc://irc.perl.org/#moose',
38     bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Moo',
39     license => 'http://dev.perl.org/licenses/',
40   }
41 );
42
43 WriteMakefile(
44   NAME => 'Moo',
45   VERSION_FROM => 'lib/Moo.pm',
46   PREREQ_PM => {
47     %RUN_DEPS,
48     ($] >= 5.010 ? () : ('MRO::Compat' => 0)),
49     ($mymeta_works ? () : (%BUILD_DEPS)),
50   },
51   ($mymeta_works
52     ? ( # BUILD_REQUIRES makes MYMETA right, requires stops META being wrong
53         BUILD_REQUIRES => \%BUILD_DEPS,
54         $has_test_requires ? ( TEST_REQUIRES => \%TEST_DEPS ) : (),
55         META_ADD => { requires => \%RUN_DEPS, %extra_info }
56       )
57     : ( # META_ADD both to get META right - only Makefile written
58         META_ADD => {
59           requires => \%RUN_DEPS,
60           build_requires => \%BUILD_DEPS,
61           test_requires => \%TEST_DEPS,
62           %extra_info,
63         }
64       )
65   ),
66   META_MERGE => {
67     no_index => {
68       directory => [ 'xt' ]
69     }
70   },
71   ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()),
72   LICENSE => 'perl',
73 );
74