introduction of conflicts checking for Moo
[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
e3aa160d 9my %BUILD_DEPS = ();
10
11my %TEST_DEPS = (
bb6d1b87 12 'Test::More' => 0.96,
13 'Test::Fatal' => 0.003,
14);
15
16my %RUN_DEPS = (
cc1d7a92 17 'Class::Method::Modifiers' => 1.10,
4a7640d1 18 'strictures' => 1.004003,
8f7cf9cf 19 'Module::Runtime' => 0.012,
1159c8c2 20 'Role::Tiny' => 1.002004,
c3e9ea21 21 'Devel::GlobalDestruction' => 0.11,
bb6d1b87 22);
23
24# have to do this since old EUMM dev releases miss the eval $VERSION line
25my $mymeta_works = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.5707 };
26my $mymeta = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.5702 };
27
e3aa160d 28my $has_test_requires = do { no warnings; $ExtUtils::MakeMaker::VERSION >= 6.63_03 };
29
30if (not $has_test_requires)
31{
32 %BUILD_DEPS = (%BUILD_DEPS, %TEST_DEPS);
33 %TEST_DEPS = ();
34}
35
627063f7 36my %extra_info = (
37 resources => {
072d158f 38 repository => 'git://git.shadowcat.co.uk/gitmo/Moo.git',
39 IRC => 'irc://irc.perl.org/#moose',
40 bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Moo',
41 license => 'http://dev.perl.org/licenses/',
627063f7 42 }
43);
44
6d71fae7 45WriteMakefile(
46 NAME => 'Moo',
47 VERSION_FROM => 'lib/Moo.pm',
4b46a4be 48 CONFIGURE_REQUIRES => {
49 'Dist::CheckConflicts' => '0.02',
50 },
bb6d1b87 51 PREREQ_PM => {
52 %RUN_DEPS,
53 ($] >= 5.010 ? () : ('MRO::Compat' => 0)),
54 ($mymeta_works ? () : (%BUILD_DEPS)),
4b46a4be 55 'Dist::CheckConflicts' => '0.02',
bb6d1b87 56 },
57 ($mymeta_works
58 ? ( # BUILD_REQUIRES makes MYMETA right, requires stops META being wrong
59 BUILD_REQUIRES => \%BUILD_DEPS,
e3aa160d 60 $has_test_requires ? ( TEST_REQUIRES => \%TEST_DEPS ) : (),
627063f7 61 META_ADD => { requires => \%RUN_DEPS, %extra_info }
bb6d1b87 62 )
63 : ( # META_ADD both to get META right - only Makefile written
64 META_ADD => {
65 requires => \%RUN_DEPS,
66 build_requires => \%BUILD_DEPS,
e3aa160d 67 test_requires => \%TEST_DEPS,
627063f7 68 %extra_info,
bb6d1b87 69 }
70 )
71 ),
eb6fa3d7 72 META_MERGE => {
73 no_index => {
74 directory => [ 'xt' ]
75 }
76 },
bb6d1b87 77 ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()),
6d71fae7 78 LICENSE => 'perl',
4b46a4be 79 'EXE_FILES' => [
80 'bin/moo-outdated',
81 ],
6d71fae7 82);
e3aa160d 83
4b46a4be 84
85# copied from Moose-2.0801/Makefile.PL
86sub check_conflicts {
87 if ( eval { require 'lib/Moo/Conflicts.pm'; 1; } ) {
88 if ( eval { Moo::Conflicts->check_conflicts; 1 } ) {
89 return;
90 }
91 else {
92 my $err = $@;
93 $err =~ s/^/ /mg;
94 warn "***\n$err***\n";
95 }
96 }
97 else {
98 print <<'EOF';
99***
100 Your toolchain doesn't support configure_requires, so
101 Dist::CheckConflicts hasn't been installed yet. You should check for
102 conflicting modules manually using the 'moo-outdated' script that is
103 installed with this distribution once the installation finishes.
104***
105EOF
106 }
107
108 # More or less copied from Module::Build
109 return if $ENV{PERL_MM_USE_DEFAULT};
110 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
111
112 sleep 4;
113}
114