Release commit for 1.004004
[p5sagit/JSON-MaybeXS.git] / Makefile.PL
CommitLineData
44459f01 1use strict;
2use warnings FATAL => 'all';
23db00ab 3use 5.006;
4use lib 'inc';
5use ExtUtils::HasCompiler qw(can_compile_loadable_object);
44459f01 6use ExtUtils::MakeMaker;
bd6b85ee 7
23db00ab 8my %META = (
9 name => 'JSON-MaybeXS',
10 license => 'perl_5',
11 dynamic_config => 1,
12 prereqs => {
13 configure => {
14 requires => {
15 'ExtUtils::MakeMaker' => '0',
bd6b85ee 16 },
17 },
23db00ab 18 runtime => {
19 requires => {
20 'Scalar::Util' => '0',
21 'Carp' => '0',
22 'JSON::PP' => '2.27300',
23 # we may also add a runtime prereq for Cpanel::JSON::XS, on the
24 # installer's machine
25 perl => '5.006',
037386f7 26 },
23db00ab 27 recommends => { 'Cpanel::JSON::XS' => '2.3310' },
28 },
29 test => {
30 requires => {
31 'Test::More' => '0.88',
17528b04 32 'Test::Needs' => '0.002006',
037386f7 33 },
34 },
8b945fac 35 },
23db00ab 36 resources => {
37 # GitHub mirrors from Shadowcat. We list it so we can get pull requests.
38 # The canonical repo is:
39 # r/o: git://git.shadowcat.co.uk/p5sagit/JSON-MaybeXS.git
40 # r/w: p5sagit@git.shadowcat.co.uk:JSON-MaybeXS.git
41 # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/JSON-MaybeXS.git
42 repository => {
43 url => 'https://github.com/p5sagit/JSON-MaybeXS.git',
44 web => 'https://github.com/p5sagit/JSON-MaybeXS',
45 type => 'git',
46 },
47 bugtracker => {
48 mailto => 'bug-JSON-MaybeXS@rt.cpan.org',
49 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=JSON-MaybeXS',
50 },
51 license => [ 'http://dev.perl.org/licenses/' ],
52 },
53 x_contributors => [ # manually added, from git shortlog -e -s -n
54 'Clinton Gormley <develop@traveljury.com>',
55 'Graham Knop <haarg@haarg.org>',
56 'John SJ Anderson <genehack@genehack.org>',
57 'Karen Etheridge <ether@cpan.org>',
58 'Kieren Diment <diment@gmail.com>',
59 'Matt S Trout <mst@shadowcat.co.uk>',
60 ],
61 keywords => [ qw(json serializer serialiser data) ],
62 no_index => {
63 directory => [ 't', 'xt' ]
64 },
44459f01 65);
66
23db00ab 67my %MM_ARGS = ();
68
9f650aa9 69## DYNAMIC PREREQS ###########################################################
70
da4118c0 71if (! parse_args()->{PUREPERL_ONLY} && can_compile_loadable_object(quiet => 1)) {
72 $MM_ARGS{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310';
db16ce21 73}
14a1801c 74
23db00ab 75use Text::ParseWords;
6f3c496c 76
77sub parse_args {
78 # copied from EUMM
6f3c496c 79 ExtUtils::MakeMaker::parse_args(
80 my $tmp = {},
81 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
82 @ARGV,
83 );
84 return $tmp->{ARGS} || {};
85}
86
23db00ab 87## BOILERPLATE ###############################################################
88require ExtUtils::MakeMaker;
89(do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
44459f01 90
23db00ab 91# have to do this since old EUMM dev releases miss the eval $VERSION line
92my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
93my $mymeta = $eumm_version >= 6.57_02;
94my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
95
96($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
97($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
98$META{license} = [ $META{license} ]
99 if $META{license} && !ref $META{license};
100$MM_ARGS{LICENSE} = $META{license}[0]
101 if $META{license} && $eumm_version >= 6.30;
102$MM_ARGS{NO_MYMETA} = 1
103 if $mymeta_broken;
104$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
105 unless -f 'META.yml';
9e8934ea 106$MM_ARGS{PL_FILES} ||= {};
107$MM_ARGS{NORECURS} = 1
108 if not exists $MM_ARGS{NORECURS};
44459f01 109
23db00ab 110for (qw(configure build test runtime)) {
111 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
112 my $r = $MM_ARGS{$key} = {
113 %{$META{prereqs}{$_}{requires} || {}},
114 %{delete $MM_ARGS{$key} || {}},
115 };
116 defined $r->{$_} or delete $r->{$_} for keys %$r;
44459f01 117}
118
23db00ab 119$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
44459f01 120
23db00ab 121delete $MM_ARGS{MIN_PERL_VERSION}
122 if $eumm_version < 6.47_01;
123$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
124 if $eumm_version < 6.63_03;
125$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
126 if $eumm_version < 6.55_01;
127delete $MM_ARGS{CONFIGURE_REQUIRES}
128 if $eumm_version < 6.51_03;
44459f01 129
23db00ab 130ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
131## END BOILERPLATE ###########################################################