Port to Module::Install::CheckConflicts.
[catagits/Catalyst-Runtime.git] / Makefile.PL
1 use inc::Module::Install 0.87;
2
3 perl_version '5.008001';
4
5 name 'Catalyst-Runtime';
6 all_from 'lib/Catalyst/Runtime.pm';
7
8 requires 'namespace::autoclean';
9 requires 'namespace::clean';
10 requires 'B::Hooks::EndOfScope' => '0.08';
11 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801';
12 requires 'Class::MOP' => '0.83';
13 requires 'Moose' => '0.78';
14 requires 'MooseX::MethodAttributes::Inheritable' => '0.12';
15 requires 'Carp';
16 requires 'Class::C3::Adopt::NEXT' => '0.07';
17 requires 'CGI::Simple::Cookie';
18 requires 'Data::Dump';
19 requires 'File::Modified';
20 requires 'HTML::Entities';
21 requires 'HTTP::Body'    => '1.04'; # makes uploadtmp work
22 requires 'HTTP::Headers' => '1.64';
23 requires 'HTTP::Request';
24 requires 'HTTP::Response';
25 requires 'HTTP::Request::AsCGI' => '0.8';
26 requires 'LWP::UserAgent';
27 requires 'Module::Pluggable' => '3.01';
28 requires 'Path::Class' => '0.09';
29 requires 'Scalar::Util';
30 requires 'Sub::Exporter';
31 requires 'Text::SimpleTable' => '0.03';
32 requires 'Time::HiRes';
33 requires 'Tree::Simple' => '1.15';
34 requires 'Tree::Simple::Visitor::FindByPath';
35 requires 'URI' => '1.35';
36 requires 'Task::Weaken';
37 requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
38 requires 'MRO::Compat';
39 requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
40
41 recommends 'B::Hooks::OP::Check::StashChange';
42
43 test_requires 'Class::Data::Inheritable';
44 test_requires 'Test::Exception';
45
46 # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
47 if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.35_05')) {
48     test_requires('Test::Aggregate', '0.35_05');
49     test_requires('Test::Simple', '0.88');
50 }
51 else {
52     tests join q{ },
53         grep { $_ ne 't/aggregate.t' }
54         map  { glob } qw[t/*.t t/aggregate/*.t];
55 }
56
57 my @force_build_requires_if_author = qw(
58   Test::NoTabs
59   Test::Pod
60   Test::Pod::Coverage
61   Pod::Coverage
62 );
63
64 if ($Module::Install::AUTHOR) {
65     foreach my $module (@force_build_requires_if_author) {
66         build_requires $module;
67     }
68     darwin_check_no_resource_forks();
69 }
70
71 install_script glob('script/*.pl');
72 auto_install;
73 WriteAll;
74
75 if ($Module::Install::AUTHOR) {
76
77   # Strip out the author only build_requires from META.yml
78   # Need to do this _after_ WriteAll else it looses track of them
79   strip_author_only_build_requires(@force_build_requires_if_author, 'Test::Aggregate');
80
81   Meta->{values}{resources} = [
82     [ 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst' ],
83     [ 'IRC'         => 'irc://irc.perl.org/#catalyst' ],
84     [ 'license',    => 'http://dev.perl.org/licenses/' ],
85     [ 'homepage',   => 'http://dev.catalyst.perl.org/'],
86     [ 'repository', => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/' ],
87   ];
88
89   Meta->write;
90 }
91
92 print <<"EOF";
93
94  Important:
95
96     This library is for running Catalyst applications.
97
98     For development and use of catalyst.pl and myapp_create.pl, make sure
99     you also install the development tools package Catalyst::Devel.
100
101         perl -MCPANPLUS -e 'install Catalyst::Devel' # or
102         perl -MCPAN -e 'install Catalyst::Devel'
103
104     To get some commonly used plugins, as well as the TT view and DBIC 
105     model, install Task::Catalyst in the same way.
106
107  Have fun!
108 EOF
109
110 # NOTE - This is the version number of the _incompatible_ code,
111 #        not the version number of the fixed version.
112 my %conflicts = (
113     'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
114     'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
115                                        # should have been a core fix.
116     'Catalyst::Plugin::Unicode::Encoding' => '0.2',
117     'Catalyst::Authentication::Credential::HTTP' => '1.009',
118     'Catalyst::Plugin::Session::Store::File' => '0.16',
119     'Catalyst::Plugin::Session' => '0.21',
120     'Catalyst::Plugin::Session::State::Cookie' => '0.10',
121     'Catalyst::Plugin::Session::Store::FastMmap' => '0.09',
122     'Catalyst::Controller::AllowDisable' => '0.03',
123     'Reaction' => '0.001999',
124     'Catalyst::Plugin::Upload::Image::Magick' => '0.03',
125     'Catalyst::Plugin::ConfigLoader'   => '0.22', # Older versions work but
126                                                   # throw Data::Visitor warns
127     'Catalyst::Devel'                  => '0.09',
128     'Catalyst::Plugin::SmartURI'       => '0.032',
129     'CatalystX::CRUD'                  => '0.37',
130     'Catalyst::Action::RenderView'     => '0.07',
131     'Catalyst::Plugin::DebugCookie'    => '0.999002',
132     'Catalyst::Plugin::Authentication' => '0.100091',
133     'CatalystX::Imports'               => '0.03',
134     'Catalyst::Plugin::HashedCookies'  => '1.03',
135     'Catalyst::Action::REST'           => '0.67',
136     'CatalystX::CRUD'                  => '0.42',
137     'CatalystX::CRUD::Model::RDBO'     => '0.20',
138 );
139 check_conflicts(%conflicts);
140
141 # End of script, helper functions below.
142
143 sub darwin_check_no_resource_forks {
144     if ($^O eq 'darwin') {
145         my $osx_ver = `/usr/bin/sw_vers -productVersion`;
146         chomp $osx_ver;
147
148         # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
149         # On 10.5 (Leopard) it wants COPYFILE_DISABLE
150         my $attr = $osx_ver eq '10.5' ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
151
152         makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
153                                           qq{ echo "You must set the ENV variable $attr to true,"; }.
154                                           ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
155         }
156 }
157
158 sub strip_author_only_build_requires {
159     my @build_requires_to_strip = @_;
160     Meta->{values}{build_requires} = [ grep {
161       my $ok = 1;
162       foreach my $module (@build_requires_to_strip) {
163         if ($_->[0] =~ /$module/) {
164           $ok = 0;
165           last;
166         }
167       }
168       $ok;
169     } @{Meta->{values}{build_requires}} ];
170 }