X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=3771f8a8982ee1a8c4396401b9970d54ec71dc98;hb=29153068c976a3dacb2d9440a2ab1f5286a299d1;hp=0769a633b05faffa29c1a83fd6b07c2c1a39fb8c;hpb=321c9c2e54cc07be0547910f1483d5a6ca715af2;p=p5sagit%2FSafe-Isa.git diff --git a/Makefile.PL b/Makefile.PL index 0769a63..3771f8a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,21 +2,13 @@ use strict; use warnings FATAL => 'all'; use 5.008001; use ExtUtils::MakeMaker; -(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; +(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,6 +24,72 @@ WriteMakefile( web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Safe-Isa', }, }, + }, + + META_ADD => { + 'meta-spec' => { version => 2 }, + prereqs => { + configure => { + requires => { + 'ExtUtils::MakeMaker' => '0', + }, + }, + runtime => { + requires => { + 'Exporter' => '5.57', + 'Scalar::Util' => 0, + perl => '5.006', + }, + }, + test => { + requires => { + 'Test::More' => '0', + }, + }, }, - ), + }, ); + +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);