Commit | Line | Data |
eae006ee |
1 | use strict; |
2 | use warnings FATAL => 'all'; |
2c87c763 |
3 | use 5.006; |
394c3a46 |
4 | |
2c87c763 |
5 | my $have_compiler |
6 | = ! parse_args()->{PUREPERL_ONLY} |
7 | && eval { require ExtUtils::CBuilder; 1 } |
8 | && ExtUtils::CBuilder->new->have_compiler; |
eae006ee |
9 | |
27826cd1 |
10 | my %extra_prereqs = ( |
11 | indirect => 0, |
12 | multidimensional => 0, |
13 | 'bareword::filehandles' => 0, |
14 | ); |
ae3262c9 |
15 | |
2c87c763 |
16 | my %META = ( |
17 | name => 'strictures', |
18 | license => 'perl_5', |
19 | prereqs => { |
20 | configure => { requires => { } }, |
21 | build => { requires => { } }, |
22 | test => { requires => { |
23 | 'Test::More' => 0, |
24 | } }, |
25 | runtime => { |
c4ddf87f |
26 | requires => { |
27 | perl => '5.006', |
28 | }, |
2c87c763 |
29 | recommends => { |
30 | %extra_prereqs, |
31 | }, |
32 | }, |
33 | develop => { requires => { |
34 | %extra_prereqs, |
35 | } }, |
36 | }, |
37 | resources => { |
38 | # r/w: p5sagit@git.shadowcat.co.uk:strictures.git |
39 | repository => { |
40 | url => 'git://git.shadowcat.co.uk/p5sagit/strictures.git', |
41 | web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/strictures.git', |
42 | type => 'git', |
43 | }, |
44 | bugtracker => { |
45 | mailto => 'bug-strictures@rt.cpan.org', |
46 | web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=strictures', |
47 | }, |
48 | license => [ 'http://dev.perl.org/licenses/' ], |
49 | }, |
50 | no_index => { |
51 | directory => [ 't', 'xt' ] |
52 | }, |
53 | ); |
54 | |
55 | my %MM_ARGS = ( |
56 | PREREQ_PM => { |
57 | ($] >= 5.008004 && $have_compiler ? %extra_prereqs : () ) |
58 | }, |
c4a93abc |
59 | realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] }, |
2c87c763 |
60 | ); |
61 | |
ae3262c9 |
62 | sub parse_args { |
63 | # copied from EUMM |
2c87c763 |
64 | require ExtUtils::MakeMaker; |
65 | require Text::ParseWords; |
ae3262c9 |
66 | ExtUtils::MakeMaker::parse_args( |
67 | my $tmp = {}, |
68 | Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''), |
69 | @ARGV, |
70 | ); |
71 | return $tmp->{ARGS} || {}; |
72 | } |
73 | |
18f7122e |
74 | ## BOILERPLATE ############################################################### |
2c87c763 |
75 | require ExtUtils::MakeMaker; |
76 | (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; |
27826cd1 |
77 | |
2c87c763 |
78 | # have to do this since old EUMM dev releases miss the eval $VERSION line |
79 | my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; |
80 | my $mymeta = $eumm_version >= 6.57_02; |
81 | my $mymeta_broken = $mymeta && $eumm_version < 6.57_07; |
de111885 |
82 | |
2c87c763 |
83 | ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g; |
84 | ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g; |
18f7122e |
85 | $META{license} = [ $META{license} ] |
86 | if $META{license} && !ref $META{license}; |
87 | $MM_ARGS{LICENSE} = $META{license}[0] |
88 | if $META{license} && $eumm_version >= 6.30; |
2c87c763 |
89 | $MM_ARGS{NO_MYMETA} = 1 |
90 | if $mymeta_broken; |
91 | $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META } |
92 | unless -f 'META.yml'; |
77f9ff76 |
93 | |
2c87c763 |
94 | for (qw(configure build test runtime)) { |
95 | my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES'; |
96 | my $r = $MM_ARGS{$key} = { |
2ef98edd |
97 | %{$META{prereqs}{$_}{requires} || {}}, |
2c87c763 |
98 | %{delete $MM_ARGS{$key} || {}}, |
99 | }; |
100 | defined $r->{$_} or delete $r->{$_} for keys %$r; |
101 | } |
dfdfcbae |
102 | |
2c87c763 |
103 | $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0; |
5468e090 |
104 | |
2c87c763 |
105 | delete $MM_ARGS{MIN_PERL_VERSION} |
106 | if $eumm_version < 6.47_01; |
107 | $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}} |
108 | if $eumm_version < 6.63_03; |
109 | $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}} |
110 | if $eumm_version < 6.55_01; |
111 | delete $MM_ARGS{CONFIGURE_REQUIRES} |
112 | if $eumm_version < 6.51_03; |
113 | |
114 | ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS); |
18f7122e |
115 | ## END BOILERPLATE ########################################################### |