remove test dependency on Test::Without::Module (RT#115394)
[p5sagit/JSON-MaybeXS.git] / Makefile.PL
index 4291e18..a2e1a60 100644 (file)
@@ -1,6 +1,5 @@
 use strict;
 use warnings FATAL => 'all';
-use 5.008001;
 use ExtUtils::MakeMaker;
 (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml';
 
@@ -12,9 +11,14 @@ my %WriteMakefileArgs = (
     'meta-spec' => { version => 2 },
     dynamic_config => 1,
     resources => {
+      # GitHub mirrors from Shadowcat. We list it so we can get pull requests.
+      # The canonical repo is:
+      # r/o: git://git.shadowcat.co.uk/p5sagit/JSON-MaybeXS.git
+      # r/w: p5sagit@git.shadowcat.co.uk:JSON-MaybeXS.git
+      # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/JSON-MaybeXS.git
       repository => {
-        url => 'https://github.com/karenetheridge/JSON-MaybeXS.git',
-        web => 'https://github.com/karenetheridge/JSON-MaybeXS',
+        url => 'https://github.com/p5sagit/JSON-MaybeXS.git',
+        web => 'https://github.com/p5sagit/JSON-MaybeXS',
         type => 'git',
       },
       bugtracker => {
@@ -22,6 +26,15 @@ my %WriteMakefileArgs = (
         web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=JSON-MaybeXS',
       },
     },
+    x_contributors => [ # manually added, from git shortlog -e -s -n
+      'Clinton Gormley <develop@traveljury.com>',
+      'Graham Knop <haarg@haarg.org>',
+      'John SJ Anderson <genehack@genehack.org>',
+      'Karen Etheridge <ether@cpan.org>',
+      'Kieren Diment <diment@gmail.com>',
+      'Matt S Trout <mst@shadowcat.co.uk>',
+    ],
+    keywords => [ qw(json serializer serialiser data) ],
   },
 
   META_ADD => {
@@ -36,7 +49,9 @@ my %WriteMakefileArgs = (
       },
       runtime => {
         requires => {
-          'JSON::PP' => '2.27202',
+          'Scalar::Util' => '0',
+          'Carp' => '0',
+          'JSON::PP' => '2.27300',
           # we may also add a runtime prereq for Cpanel::JSON::XS, on the
           # installer's machine
           perl => '5.006',
@@ -45,14 +60,11 @@ my %WriteMakefileArgs = (
       },
       test => {
         requires => {
-          'Test::Without::Module' => '0.17',
           'Test::More' => '0.88',
         },
       },
     },
   },
-
-  realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] },
 );
 
 my $eumm_version  = eval $ExtUtils::MakeMaker::VERSION;
@@ -68,13 +80,28 @@ for (qw(configure build test runtime)) {
   defined $r->{$_} or delete $r->{$_} for keys %$r;
 }
 
-# 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; };
+# dynamic prereqs get added here.
+
+my $args = parse_args();
+
+if (not $args->{PUREPERL_ONLY}) {
+    # 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 eval { require Cpanel::JSON::XS; 1 }
+            or (not eval { require JSON::XS; 1; } and can_xs());
+
+    # JSON::XS 3 changed its boolean handling - update it
+    # if JSON::XS is installed and < 3.0
+    $WriteMakefileArgs{PREREQ_PM}{'JSON::XS'} = '3.00'
+        if eval { require JSON::XS; 1 } and not eval { JSON::XS->VERSION('3.0'); 1 };
+}
 
 $WriteMakefileArgs{MIN_PERL_VERSION} = delete $WriteMakefileArgs{PREREQ_PM}{perl} || 0;
 
+die 'attention developer: you need to do a sane meta merge here!'
+  if keys %{$WriteMakefileArgs{BUILD_REQUIRES}};
+
 $WriteMakefileArgs{BUILD_REQUIRES} = {
     %{$WriteMakefileArgs{BUILD_REQUIRES} || {}},
     %{delete $WriteMakefileArgs{TEST_REQUIRES}}
@@ -88,8 +115,30 @@ $WriteMakefileArgs{PREREQ_PM} = {
 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
   if $eumm_version < 6.51_03;
 
+delete $WriteMakefileArgs{MIN_PERL_VERSION}
+  if $eumm_version < 6.48;
+
+delete @WriteMakefileArgs{qw(META_ADD META_MERGE)}
+  if $eumm_version < 6.46;
+
+delete $WriteMakefileArgs{LICENSE}
+  if $eumm_version < 6.31;
+
 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;