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