From: Karen Etheridge Date: Wed, 23 Apr 2014 06:02:26 +0000 (-0700) Subject: dynamically adjust prereqs based on if JSON::XS is already installed X-Git-Tag: v1.002000~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b945fac609fdb37fd9bfb54ce5fcd6ab8c10ac5;p=p5sagit%2FJSON-MaybeXS.git dynamically adjust prereqs based on if JSON::XS is already installed --- diff --git a/Changes b/Changes index 6d418ba..a92b7ff 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,8 @@ + + - Now also supports JSON::XS, when available: Cpanel::JSON::XS will only be + installed when there is no XS backend already installed; Cpanel::JSON::XS + will be used over JSON::XS when both are installed. + 1.001000 - 2013-12-11 - Add a constructor for people who want to forget how silly the JSON API is diff --git a/Makefile.PL b/Makefile.PL index 18e3709..e1bfb3a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,17 +9,28 @@ my %BUILD_DEPS = ( 'Test::More' => '0.88' ); +# we require Cpanel::JSON::XS, except if JSON::XS is already installed we only +# reocmmend it. +my $require_cpanel_json_xs = can_xs() && !eval { require JSON::XS; 1; }; + WriteMakefile( NAME => 'JSON::MaybeXS', VERSION_FROM => 'lib/JSON/MaybeXS.pm', PREREQ_PM => { 'JSON::PP' => '2.27202', - (can_xs() + ($require_cpanel_json_xs ? ('Cpanel::JSON::XS' => '2.3310') : ()), %BUILD_DEPS, }, BUILD_REQUIRES => \%BUILD_DEPS, + META_MERGE => { + 'meta-spec' => { version => 2 }, + dynamic_config => 1, + ($require_cpanel_json_xs + ? () + : (prereqs => { runtime => { recommends => { 'Cpanel::JSON::XS' => '2.3310' } } })), + }, ); # can we locate a (the) C compiler