convert to Distar
[catagits/Catalyst-Devel.git] / Makefile.PL
1 use strict;
2 use warnings FATAL => 'all';
3 use 5.006;
4
5 my %META = (
6   name => 'Catalyst-Devel',
7   license => 'perl_5',
8   prereqs => {
9     configure => { requires => {
10       'ExtUtils::MakeMaker'     => 0,
11       'File::ShareDir::Install' => 0,
12     } },
13     test => {
14       requires => {
15         'Test::More'  => '0.94',
16         'Test::Fatal' => '0.003',
17       },
18     },
19     runtime => {
20       requires => {
21         'Moose'                                   => 0,
22         'MooseX::Emulate::Class::Accessor::Fast'  => 0,
23         'File::ShareDir'                          => 0,
24         'namespace::clean'                        => 0,
25         'namespace::autoclean'                    => 0,
26         'Catalyst'                                => '5.90001',
27         'Catalyst::Action::RenderView'            => '0.10',
28         'Catalyst::Plugin::Static::Simple'        => '0.28',
29         'Catalyst::Plugin::ConfigLoader'          => '0.30',
30         'Config::General'                         => '2.42',
31         'File::ChangeNotify'                      => '0.07',
32         'File::Copy::Recursive'                   => 0,
33         'Path::Class'                             => '0.09',
34         'Template'                                => '2.14',
35         'Module::Install'                         => '1.02',
36       },
37     },
38     develop => {
39       requires => {
40         'Proc::Background'    => 0,
41         'Test::Pod'           => 0,
42         'Test::Pod::Coverage' => 0,
43       },
44     },
45   },
46   resources => {
47     repository => {
48       url => 'git://git.shadowcat.co.uk/catagits/Catalyst-Devel.git',
49       web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalyst-Devel.git',
50       type => 'git',
51     },
52     x_IRC => 'irc://irc.perl.org/#catalyst',
53     x_MailingList => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst',
54     homepage => 'http://dev.catalyst.perl.org/',
55     bugtracker => {
56       web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Devel',
57       mailto => 'bug-Catalyst-Devel@rt.cpan.org',
58     },
59     license => [ 'http://dev.perl.org/licenses/' ],
60   },
61   no_index => {
62     directory => [ 't', 'xt' ]
63   },
64   x_authority => 'cpan:MSTROUT',
65 );
66
67 {
68   package MY;
69   use File::ShareDir::Install qw(install_share postamble);
70   install_share 'share';
71 }
72
73 my %MM_ARGS = (
74   PREREQ_PM => {
75     # kill warning from older versions of Class::C3
76     ( ("$]" >= 5.009_005 && eval { require Class::C3 } && !eval { Class::C3->VERSION(0.20) }) ? (
77       'Class::C3' => '0.20',
78     ) : () ),
79   },
80 );
81
82 if (!$ENV{CATALYST_DEVEL_NO_510_CHECK}) {
83     require IPC::Open3;
84     require File::Spec;
85     open my $in, '<', File::Spec->devnull;
86     my $pid = IPC::Open3::open3($in, my $out, undef, $^X, '-It/lib', '-MUnknownError', '-e1');
87     my $output = do { local $/; <$out> };
88
89     waitpid $pid, 0;
90
91     if ($output =~ /^Unknown error/m) {
92         warn <<EOE;
93 ############################### WARNING #################################
94 #                                                                       #
95 # You are using perl 5.10.0 with the "Unknown error" bug. This can make #
96 # developing Catalyst applications much more painful, as it will come   #
97 # up with no details every time you have a syntax error in a Controller.#
98 #                                                                       #
99 # For more information see:                                             #
100 #                                                                       #
101 #  * http://rt.perl.org/rt3/Public/Bug/Display.html?id=49472            #
102 #                                                                       #
103 # It is highly recommended that you use a different version of perl or  #
104 # compile a patched version for Catalyst development.                   #
105 #                                                                       #
106 # To skip this check, set the CATALYST_DEVEL_NO_510_CHECK environment   #
107 # variable.                                                             #
108 #                                                                       #
109 #########################################################################
110
111 EOE
112         require ExtUtils::MakeMaker;
113         my $ans = ExtUtils::MakeMaker::prompt('Do you want to continue?', 'no');
114         exit 0 unless $ans =~ /^y(es)?\z/i;
115     }
116 }
117
118
119 ## BOILERPLATE ###############################################################
120 require ExtUtils::MakeMaker;
121 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
122
123 # have to do this since old EUMM dev releases miss the eval $VERSION line
124 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
125 my $mymeta        = $eumm_version >= 6.57_02;
126 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
127
128 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
129 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
130 $META{license} = [ $META{license} ]
131   if $META{license} && !ref $META{license};
132 $MM_ARGS{LICENSE} = $META{license}[0]
133   if $META{license} && $eumm_version >= 6.30;
134 $MM_ARGS{NO_MYMETA} = 1
135   if $mymeta_broken;
136 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
137   unless -f 'META.yml';
138 $MM_ARGS{PL_FILES} ||= {};
139 $MM_ARGS{NORECURS} = 1
140   if not exists $MM_ARGS{NORECURS};
141
142 for (qw(configure build test runtime)) {
143   my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
144   my $r = $MM_ARGS{$key} = {
145     %{$META{prereqs}{$_}{requires} || {}},
146     %{delete $MM_ARGS{$key} || {}},
147   };
148   defined $r->{$_} or delete $r->{$_} for keys %$r;
149 }
150
151 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
152
153 delete $MM_ARGS{MIN_PERL_VERSION}
154   if $eumm_version < 6.47_01;
155 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
156   if $eumm_version < 6.63_03;
157 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
158   if $eumm_version < 6.55_01;
159 delete $MM_ARGS{CONFIGURE_REQUIRES}
160   if $eumm_version < 6.51_03;
161
162 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
163 ## END BOILERPLATE ###########################################################