2 use warnings FATAL => 'all';
5 use ExtUtils::HasCompiler qw(can_compile_loadable_object);
6 use ExtUtils::MakeMaker;
9 name => 'JSON-MaybeXS',
15 'ExtUtils::MakeMaker' => '0',
20 'Scalar::Util' => '0',
22 'JSON::PP' => '2.27300',
23 # we may also add a runtime prereq for Cpanel::JSON::XS, on the
27 recommends => { 'Cpanel::JSON::XS' => '2.3310' },
31 'Test::More' => '0.88',
36 # GitHub mirrors from Shadowcat. We list it so we can get pull requests.
37 # The canonical repo is:
38 # r/o: git://git.shadowcat.co.uk/p5sagit/JSON-MaybeXS.git
39 # r/w: p5sagit@git.shadowcat.co.uk:JSON-MaybeXS.git
40 # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/JSON-MaybeXS.git
42 url => 'https://github.com/p5sagit/JSON-MaybeXS.git',
43 web => 'https://github.com/p5sagit/JSON-MaybeXS',
47 mailto => 'bug-JSON-MaybeXS@rt.cpan.org',
48 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=JSON-MaybeXS',
50 license => [ 'http://dev.perl.org/licenses/' ],
52 x_contributors => [ # manually added, from git shortlog -e -s -n
53 'Clinton Gormley <develop@traveljury.com>',
54 'Graham Knop <haarg@haarg.org>',
55 'John SJ Anderson <genehack@genehack.org>',
56 'Karen Etheridge <ether@cpan.org>',
57 'Kieren Diment <diment@gmail.com>',
58 'Matt S Trout <mst@shadowcat.co.uk>',
60 keywords => [ qw(json serializer serialiser data) ],
62 directory => [ 't', 'xt' ]
68 ## DYNAMIC PREREQS ###########################################################
70 if (! parse_args()->{PUREPERL_ONLY} && can_compile_loadable_object(quiet => 1)) {
71 $MM_ARGS{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310';
78 ExtUtils::MakeMaker::parse_args(
80 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
83 return $tmp->{ARGS} || {};
86 ## BOILERPLATE ###############################################################
87 require ExtUtils::MakeMaker;
88 (do './maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
90 # have to do this since old EUMM dev releases miss the eval $VERSION line
91 my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
92 my $mymeta = $eumm_version >= 6.57_02;
93 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
95 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
96 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
97 $META{license} = [ $META{license} ]
98 if $META{license} && !ref $META{license};
99 $MM_ARGS{LICENSE} = $META{license}[0]
100 if $META{license} && $eumm_version >= 6.30;
101 $MM_ARGS{NO_MYMETA} = 1
103 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
104 unless -f 'META.yml';
105 $MM_ARGS{PL_FILES} ||= {};
106 $MM_ARGS{NORECURS} = 1
107 if not exists $MM_ARGS{NORECURS};
109 for (qw(configure build test runtime)) {
110 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
111 my $r = $MM_ARGS{$key} = {
112 %{$META{prereqs}{$_}{requires} || {}},
113 %{delete $MM_ARGS{$key} || {}},
115 defined $r->{$_} or delete $r->{$_} for keys %$r;
118 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
120 delete $MM_ARGS{MIN_PERL_VERSION}
121 if $eumm_version < 6.47_01;
122 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
123 if $eumm_version < 6.63_03;
124 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
125 if $eumm_version < 6.55_01;
126 delete $MM_ARGS{CONFIGURE_REQUIRES}
127 if $eumm_version < 6.51_03;
129 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
130 ## END BOILERPLATE ###########################################################