From: Karen Etheridge Date: Sat, 16 Aug 2014 22:10:00 +0000 (-0700) Subject: copy meta munging from JSON-MaybeXS X-Git-Tag: v1.000005~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=74a7df2b7a7a4209d4f40b052e9e354e3a167e1b;p=p5sagit%2FSafe-Isa.git copy meta munging from JSON-MaybeXS --- diff --git a/Makefile.PL b/Makefile.PL index 8a00724..4b66b8e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,19 +4,11 @@ use 5.008001; use ExtUtils::MakeMaker; (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; -WriteMakefile( +my %WriteMakefileArgs = ( NAME => 'Safe::Isa', VERSION_FROM => 'lib/Safe/Isa.pm', - MIN_PERL_VERSION => '5.006', - - PREREQ_PM => { - 'Exporter' => '5.57', - 'Scalar::Util' => 0, - }, - - -f 'META.yml' ? () : ( - META_MERGE => { + META_MERGE => { 'meta-spec' => { version => 2 }, dynamic_config => 0, @@ -32,8 +24,68 @@ WriteMakefile( web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Safe-Isa', }, }, + }, + + META_ADD => { + prereqs => { + configure => { + requires => { + 'ExtUtils::MakeMaker' => '0', + }, + }, + runtime => { + requires => { + 'Exporter' => '5.57', + 'Scalar::Util' => 0, + perl => '5.006', + }, + }, }, - ), + }, realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] }, ); + +my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; + +for (qw(configure build test runtime)) { + my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES'; + next unless exists $WriteMakefileArgs{META_ADD}{prereqs}{$_} + or exists $WriteMakefileArgs{$key}; + my $r = $WriteMakefileArgs{$key} = { + %{$WriteMakefileArgs{META_ADD}{prereqs}{$_}{requires} || {}}, + %{delete $WriteMakefileArgs{$key} || {}}, + }; + defined $r->{$_} or delete $r->{$_} for keys %$r; +} + +# dynamic prereqs get added here. + +$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}} +} if $eumm_version < 6.63_03; + +$WriteMakefileArgs{PREREQ_PM} = { + %{$WriteMakefileArgs{PREREQ_PM}}, + %{delete $WriteMakefileArgs{BUILD_REQUIRES}} +} if $eumm_version < 6.55_01; + +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);