From: Graham Knop Date: Tue, 12 Aug 2014 07:21:03 +0000 (-0400) Subject: clean up boilerplate X-Git-Tag: v1.002005~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=88f5410d1c9c6342d8baac0b9024c395756a857a;p=p5sagit%2FImport-Into.git clean up boilerplate --- diff --git a/Makefile.PL b/Makefile.PL index 9a918a6..7761e09 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,88 +1,86 @@ use strict; use warnings FATAL => 'all'; -use ExtUtils::MakeMaker; -(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; - -my %WriteMakefileArgs = ( - NAME => 'Import::Into', - VERSION_FROM => 'lib/Import/Into.pm', - PREREQ_PM => { }, - LICENSE => 'perl', - META_MERGE => { - 'meta-spec' => { version => 2 }, - dynamic_config => 0, - resources => { - # r/w: p5sagit@git.shadowcat.co.uk:Import-Into.git - repository => { - url => 'git://git.shadowcat.co.uk/p5sagit/Import-Into.git', - web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git', - type => 'git', - }, - bugtracker => { - mailto => 'bug-Import-Into@rt.cpan.org', - web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into', - }, +my %META = ( + name => 'Import-Into', + license => 'perl_5', + dynamic_config => 0, + resources => { + # r/w: p5sagit@git.shadowcat.co.uk:Import-Into.git + repository => { + url => 'git://git.shadowcat.co.uk/p5sagit/Import-Into.git', + web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Import-Into.git', + type => 'git', + }, + bugtracker => { + mailto => 'bug-Import-Into@rt.cpan.org', + web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Import-Into', }, }, - - META_ADD => { - 'meta-spec' => { version => 2 }, - prereqs => { - configure => { - requires => { - 'ExtUtils::MakeMaker' => 0, - }, + prereqs => { + configure => { + requires => { + 'ExtUtils::MakeMaker' => 0, }, - runtime => { - requires => { - 'strict' => '0', - 'warnings' => '0', - 'Module::Runtime' => '0', - 'perl' => '5.006', - }, + }, + runtime => { + requires => { + 'strict' => '0', + 'warnings' => '0', + 'Module::Runtime' => '0', + 'perl' => '5.006', }, - test => { - requires => { - 'Exporter' => '0', - 'base' => '0', - 'Test::More' => '0', - }, + }, + test => { + requires => { + 'Exporter' => '0', + 'base' => '0', + 'Test::More' => '0', }, }, }, +); +my %MM_ARGS = ( realclean => { FILES => [ 'Distar/', 'MANIFEST*' ] }, ); +############################################################################## +require ExtUtils::MakeMaker; +(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; + +# have to do this since old EUMM dev releases miss the eval $VERSION line my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; +my $mymeta = $eumm_version >= 6.57_02; +my $mymeta_broken = $mymeta && $eumm_version < 6.57_07; + +($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g; +($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g; +$MM_ARGS{LICENSE} = $META{license} + if $eumm_version >= 6.30; +$MM_ARGS{NO_MYMETA} = 1 + if $mymeta_broken; +$MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META } + unless -f 'META.yml'; 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} || {}}, + my $r = $MM_ARGS{$key} = { + %{$META{prereqs}{$_}{requires} || {}}, + %{delete $MM_ARGS{$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; +$MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0; -delete $WriteMakefileArgs{CONFIGURE_REQUIRES} +delete $MM_ARGS{MIN_PERL_VERSION} + if $eumm_version < 6.47_01; +$MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}} + if $eumm_version < 6.63_03; +$MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}} + if $eumm_version < 6.55_01; +delete $MM_ARGS{CONFIGURE_REQUIRES} if $eumm_version < 6.51_03; -WriteMakefile(%WriteMakefileArgs); +ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);