From: Karen Etheridge Date: Wed, 9 Jul 2014 16:13:14 +0000 (-0700) Subject: move prereqs to PREREQ_PM, *_REQUIRES conditional on EUMM version X-Git-Tag: v1.002004~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f84a529ea806b447c98aa12006b0abac98f2062a;p=p5sagit%2FImport-Into.git move prereqs to PREREQ_PM, *_REQUIRES conditional on EUMM version --- diff --git a/Changes b/Changes index 1364acc..f622dfd 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Import-Into + - fix prerequisite declarations for older toolchain + 1.002003 - 2014-07-09 - module loading is now done while importing, making it unnecessary to load them beforehand (RT#96995, Christian Walde) diff --git a/Makefile.PL b/Makefile.PL index f722619..95c4f76 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,12 +3,11 @@ use warnings FATAL => 'all'; use ExtUtils::MakeMaker; (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; -WriteMakefile( +my %WriteMakefileArgs = ( NAME => 'Import::Into', VERSION_FROM => 'lib/Import/Into.pm', PREREQ_PM => { }, LICENSE => 'perl', - MIN_PERL_VERSION => '5.006', META_MERGE => { 'meta-spec' => { version => 2 }, @@ -25,12 +24,16 @@ WriteMakefile( web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into', }, }, + }, + + META_ADD => { prereqs => { runtime => { requires => { 'strict' => '0', 'warnings' => '0', 'Module::Runtime' => '0', + 'perl' => '5.006', }, }, test => { @@ -45,3 +48,35 @@ WriteMakefile( 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; + +$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; + +WriteMakefile(%WriteMakefileArgs);