tighten up entries
[p5sagit/JSON-MaybeXS.git] / Makefile.PL
index 81d1a51..402d4c8 100644 (file)
@@ -11,9 +11,10 @@ my %WriteMakefileArgs = (
     'meta-spec' => { version => 2 },
     dynamic_config => 1,
     resources => {
+    # r/w: p5sagit@git.shadowcat.co.uk:JSON-MaybeXS.git
       repository => {
-        url => 'https://github.com/karenetheridge/JSON-MaybeXS.git',
-        web => 'https://github.com/karenetheridge/JSON-MaybeXS',
+        url => 'git://git.shadowcat.co.uk/p5sagit/JSON-MaybeXS.git',
+        web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/JSON-MaybeXS.git',
         type => 'git',
       },
       bugtracker => {
@@ -21,6 +22,13 @@ my %WriteMakefileArgs = (
         web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=JSON-MaybeXS',
       },
     },
+    x_contributors => { # manually added, from git shortlog -e -s
+      'Clinton Gormley <develop@traveljury.com>',
+      'Graham Knop <haarg@haarg.org>',
+      'Karen Etheridge <ether@cpan.org>',
+      'Kieren Diment <diment@gmail.com>',
+      'Matt S Trout <mst@shadowcat.co.uk>',
+    },
   },
 
   META_ADD => {
@@ -35,6 +43,8 @@ my %WriteMakefileArgs = (
       },
       runtime => {
         requires => {
+          'Scalar::Util' => '0',
+          'Carp' => '0',
           'JSON::PP' => '2.27202',
           # we may also add a runtime prereq for Cpanel::JSON::XS, on the
           # installer's machine
@@ -50,8 +60,6 @@ my %WriteMakefileArgs = (
       },
     },
   },
-
-  realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] },
 );
 
 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
@@ -72,7 +80,22 @@ for (qw(configure build test runtime)) {
 # we require Cpanel::JSON::XS, except if JSON::XS is already installed.
 # (we also always recommend Cpanel::JSON::XS, just to make sure.)
 $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'} = '2.3310'
-    if can_xs() && !eval { require JSON::XS; 1; };
+    if not parse_args()->{PUREPERL_ONLY}
+        and ((eval { require Cpanel::JSON::XS; 1 } and not eval { Cpanel::JSON::XS->VERSION('2.3310'); 1 })
+            or (not eval { require JSON::XS; 1; } and can_xs()));
+
+# avoid "JSON::XS::Boolean::* redefined" warnings caused by incompatibilities
+# between JSON::XS 2.x and 3.0 --
+# if JSON::XS is installed and < 3.0
+# and Cpanel::JSON::JSON is (or is about to be) >= 3.0,
+# then update JSON::XS to eliminate the incompatibility
+$WriteMakefileArgs{PREREQ_PM}{'JSON::XS'} = '3.00'
+    if not parse_args()->{PUREPERL_ONLY}
+        and eval { require JSON::XS; 1 } and not eval { JSON::XS->VERSION('3.0'); 1 }
+        and (eval { require Cpanel::JSON::XS; Cpanel::JSON::XS->VERSION('3.0'); 1 }
+            # we presume here that if we are installing Cpanel::JSON::XS, we
+            # are installing the latest version
+            or exists $WriteMakefileArgs{PREREQ_PM}{'Cpanel::JSON::XS'});
 
 $WriteMakefileArgs{MIN_PERL_VERSION} = delete $WriteMakefileArgs{PREREQ_PM}{perl} || 0;
 
@@ -103,6 +126,19 @@ delete $WriteMakefileArgs{LICENSE}
 
 WriteMakefile(%WriteMakefileArgs);
 
+
+sub parse_args {
+  # copied from EUMM
+  require ExtUtils::MakeMaker;
+  require Text::ParseWords;
+  ExtUtils::MakeMaker::parse_args(
+    my $tmp = {},
+    Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
+    @ARGV,
+  );
+  return $tmp->{ARGS} || {};
+}
+
 # can we locate a (the) C compiler
 sub can_cc {
   my @chunks = split(/ /, $Config::Config{cc}) or return;