test for mutual requires
[gitmo/Moo.git] / Makefile.PL
CommitLineData
6d71fae7 1use strict;
2use warnings FATAL => 'all';
2215d4b9 3use 5.008001;
6d71fae7 4use ExtUtils::MakeMaker;
4b46a4be 5
6check_conflicts();
253d7c99 7(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
6d71fae7 8
e3b0d764 9my %CONFIGURE_DEPS = (
10 'ExtUtils::MakeMaker' => 0,
11 'Dist::CheckConflicts' => '0.02',
12);
e3aa160d 13my %BUILD_DEPS = ();
14
15my %TEST_DEPS = (
bb6d1b87 16 'Test::More' => 0.96,
17 'Test::Fatal' => 0.003,
18);
19
20my %RUN_DEPS = (
cc1d7a92 21 'Class::Method::Modifiers' => 1.10,
4a7640d1 22 'strictures' => 1.004003,
8f7cf9cf 23 'Module::Runtime' => 0.012,
1159c8c2 24 'Role::Tiny' => 1.002004,
c3e9ea21 25 'Devel::GlobalDestruction' => 0.11,
e3b0d764 26 'Dist::CheckConflicts' => 0.02,
27);
28
29my %extra_info = (
30 'meta-spec' => { version => 2 },
31 resources => {
32 repository => {
33 url => 'git://git.shadowcat.co.uk/gitmo/Moo.git',
34 web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/Moo.git',
35 type => 'git',
36 },
37 x_IRC => 'irc://irc.perl.org/#moose',
38 bugtracker => {
39 web => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Moo',
40 mailto => 'bug-moo@rt.cpan.org',
41 },
42 license => [ 'http://dev.perl.org/licenses/' ],
43 },
44 prereqs => {
45 configure => { requires => { %CONFIGURE_DEPS } },
46 build => { requires => { %BUILD_DEPS } },
47 test => { requires => { %TEST_DEPS } },
48 runtime => { requires => { %RUN_DEPS, perl => '5.8.1' } },
49 },
bb6d1b87 50);
51
52# have to do this since old EUMM dev releases miss the eval $VERSION line
e3b0d764 53my $mymeta_works = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.57_07 };
54my $mymeta = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.57_02 };
bb6d1b87 55
e3aa160d 56my $has_test_requires = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.63_03 };
57
e3b0d764 58my $has_meta_v2 = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.57_10 };
e3aa160d 59
e3b0d764 60if (! $has_meta_v2) {
61 %extra_info = ();
62}
63if (not $has_test_requires) {
64 %BUILD_DEPS = (%BUILD_DEPS, %TEST_DEPS);
65 %TEST_DEPS = ();
66}
67if (not $mymeta_works) {
68 %RUN_DEPS = (%RUN_DEPS, %BUILD_DEPS);
69 %BUILD_DEPS = ();
70}
627063f7 71
6d71fae7 72WriteMakefile(
73 NAME => 'Moo',
74 VERSION_FROM => 'lib/Moo.pm',
e3b0d764 75 CONFIGURE_REQUIRES => \%CONFIGURE_DEPS,
bb6d1b87 76 PREREQ_PM => {
77 %RUN_DEPS,
78 ($] >= 5.010 ? () : ('MRO::Compat' => 0)),
bb6d1b87 79 },
e3b0d764 80 keys %BUILD_DEPS ? ( BUILD_REQUIRES => \%BUILD_DEPS ) : (),
81 keys %TEST_DEPS ? ( TEST_REQUIRES => \%TEST_DEPS ) : (),
82 META_ADD => \%extra_info,
eb6fa3d7 83 META_MERGE => {
84 no_index => {
85 directory => [ 'xt' ]
97e41aa9 86 },
df9d7431 87 Moo::Conflicts->can('conflicts') ? (
88 x_breaks => { Moo::Conflicts->conflicts }
89 ) : (),
eb6fa3d7 90 },
bb6d1b87 91 ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()),
6d71fae7 92 LICENSE => 'perl',
e3b0d764 93 EXE_FILES => [
4b46a4be 94 'bin/moo-outdated',
95 ],
6d71fae7 96);
e3aa160d 97
4b46a4be 98
99# copied from Moose-2.0801/Makefile.PL
100sub check_conflicts {
101 if ( eval { require 'lib/Moo/Conflicts.pm'; 1; } ) {
102 if ( eval { Moo::Conflicts->check_conflicts; 1 } ) {
103 return;
104 }
105 else {
106 my $err = $@;
107 $err =~ s/^/ /mg;
108 warn "***\n$err***\n";
109 }
110 }
111 else {
112 print <<'EOF';
113***
114 Your toolchain doesn't support configure_requires, so
115 Dist::CheckConflicts hasn't been installed yet. You should check for
116 conflicting modules manually using the 'moo-outdated' script that is
117 installed with this distribution once the installation finishes.
118***
119EOF
120 }
121
27073f7c 122 return if $ENV{AUTOMATED_TESTING} || $ENV{NONINTERACTIVE_TESTING};
123
4b46a4be 124 # More or less copied from Module::Build
125 return if $ENV{PERL_MM_USE_DEFAULT};
126 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
127
128 sleep 4;
129}
130