1use strict;
2use warnings FATAL => 'all';
3use 5.008;
4
5my %META = (
6  name => 'Plack-Middleware-CrossOrigin',
7  license => 'perl_5',
8  prereqs => {
9    configure => { requires => { } },
10    build => { requires => { } },
11    test => { requires => {
12      'Plack::App::File'  => 0,
13      'Plack::Builder'    => 0,
14      'Plack::Request'    => 0,
15      'Plack::Test'       => 0,
16      'Socket'            => 0,
17      'Test::More'        => '0.88',
18    } },
19    runtime => { requires => {
20      'Plack::Middleware'     => 0,
21      'Plack::Util'           => 0,
22      'Plack::Util::Accessor' => 0,
23      'parent'                => 0,
24      'perl'                  => '5.008',
25    } },
26    develop => { requires => {
27      'Pod::Coverage::TrustPod' => 0,
28      'Test::Pod'               => '1.41',
29      'Test::Pod::Coverage'     => '1.08',
30    } },
31  },
32  resources => {
33    repository => {
34      url => 'https://github.com/haarg/Plack-Middleware-CrossOrigin.git',
35      web => 'https://github.com/haarg/Plack-Middleware-CrossOrigin',
36      type => 'git',
37    },
38    bugtracker => {
39      web => 'https://github.com/haarg/Plack-Middleware-CrossOrigin/issues',
40    },
41    license => [ 'http://dev.perl.org/licenses/' ],
42  },
43  no_index => {
44    directory => [ 't', 'xt' ]
45  },
46);
47
48my %MM_ARGS = ();
49
50## BOILERPLATE ###############################################################
51require ExtUtils::MakeMaker;
52(do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
53
54# have to do this since old EUMM dev releases miss the eval $VERSION line
55my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
56my $mymeta        = $eumm_version >= 6.57_02;
57my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
58
59($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
60($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
61$META{license} = [ $META{license} ]
62  if $META{license} && !ref $META{license};
63$MM_ARGS{LICENSE} = $META{license}[0]
64  if $META{license} && $eumm_version >= 6.30;
65$MM_ARGS{NO_MYMETA} = 1
66  if $mymeta_broken;
67$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
68  unless -f 'META.yml';
69$MM_ARGS{PL_FILES} ||= {};
70$MM_ARGS{NORECURS} = 1
71  if not exists $MM_ARGS{NORECURS};
72
73for (qw(configure build test runtime)) {
74  my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
75  my $r = $MM_ARGS{$key} = {
76    %{$META{prereqs}{$_}{requires} || {}},
77    %{delete $MM_ARGS{$key} || {}},
78  };
79  defined $r->{$_} or delete $r->{$_} for keys %$r;
80}
81
82$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
83
84delete $MM_ARGS{MIN_PERL_VERSION}
85  if $eumm_version < 6.47_01;
86$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
87  if $eumm_version < 6.63_03;
88$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
89  if $eumm_version < 6.55_01;
90delete $MM_ARGS{CONFIGURE_REQUIRES}
91  if $eumm_version < 6.51_03;
92
93ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
94## END BOILERPLATE ###########################################################
95