diff options
author | David Mitchell <davem@iabyn.com> | 2009-07-16 10:53:04 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2009-07-16 10:53:04 +0100 |
commit | b6d6132c1554383190492215dd1da143d1d564ef (patch) | |
tree | 0443a528c7d6efb2564fa76f5287c37aaeda0247 /lib/ExtUtils | |
parent | d9ac7b6b660cff1409a0aa305d95403874c8725a (diff) | |
download | perl-b6d6132c1554383190492215dd1da143d1d564ef.tar.gz |
ExtUtils::MakeMaker 6.55_01
Diffstat (limited to 'lib/ExtUtils')
30 files changed, 317 insertions, 71 deletions
diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes index bacd4453d2..591f95892e 100644 --- a/lib/ExtUtils/Changes +++ b/lib/ExtUtils/Changes @@ -1,3 +1,16 @@ +6.55_01 Tue Jul 14 15:53:30 PDT 2009 + Test Fixes + * The tests got a bit overzealous and removed the LIB environment variable + while is necessary for some compilers to work. [rt.cpan.org 47722] + (Jan Dubois) + * Another fix for arch_check() on Windows changing how we normalize + long and short filenames. [rt.cpan.org 47723] (Jan Dubois) + + New Features + * BUILD_REQUIRES is added, similar to PREREQ_PM but for modules which + are necessary to build, but not run, your module. (Alexandr Ciornii) + + 6.54 Tue Jul 7 16:48:22 PDT 2009 Test Fixes * Added perl core boilerplate code to a few new tests which were missing diff --git a/lib/ExtUtils/Command/MM.pm b/lib/ExtUtils/Command/MM.pm index 8748d79574..bebddd8c53 100644 --- a/lib/ExtUtils/Command/MM.pm +++ b/lib/ExtUtils/Command/MM.pm @@ -10,7 +10,7 @@ our @ISA = qw(Exporter); our @EXPORT = qw(test_harness pod2man perllocal_install uninstall warn_if_old_packlist); -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; my $Is_VMS = $^O eq 'VMS'; diff --git a/lib/ExtUtils/Liblist.pm b/lib/ExtUtils/Liblist.pm index ae33db55ce..6d911176b2 100644 --- a/lib/ExtUtils/Liblist.pm +++ b/lib/ExtUtils/Liblist.pm @@ -2,7 +2,7 @@ package ExtUtils::Liblist; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; use File::Spec; require ExtUtils::Liblist::Kid; diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index 730b4d0885..88826c2589 100644 --- a/lib/ExtUtils/Liblist/Kid.pm +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -9,7 +9,7 @@ use 5.006; # Broken out of MakeMaker from version 4.11 use strict; -our $VERSION = 6.54; +our $VERSION = 6.55_01; use Config; use Cwd 'cwd'; diff --git a/lib/ExtUtils/MM.pm b/lib/ExtUtils/MM.pm index d3ff87519f..fc75501ea5 100644 --- a/lib/ExtUtils/MM.pm +++ b/lib/ExtUtils/MM.pm @@ -3,7 +3,7 @@ package ExtUtils::MM; use strict; use ExtUtils::MakeMaker::Config; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::Liblist; require ExtUtils::MakeMaker; diff --git a/lib/ExtUtils/MM_AIX.pm b/lib/ExtUtils/MM_AIX.pm index dcfb1713c0..10e4fd4388 100644 --- a/lib/ExtUtils/MM_AIX.pm +++ b/lib/ExtUtils/MM_AIX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_AIX; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index ce723b5d9d..0af50e136e 100644 --- a/lib/ExtUtils/MM_Any.pm +++ b/lib/ExtUtils/MM_Any.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_Any; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; use Carp; use File::Spec; @@ -74,7 +74,7 @@ Windows, VMS, OS/2, etc...) and the rest are sub families. Some examples: Cygwin98 ('Unix', 'Cygwin', 'Cygwin9x') - Windows NT ('Win32', 'WinNT') + Windows ('Win32') Win98 ('Win32', 'Win9x') Linux ('Unix', 'Linux') MacOS X ('Unix', 'Darwin', 'MacOS', 'MacOS X') @@ -838,14 +838,24 @@ sub metafile_data { meta-spec ); + # Check the original args so we can tell between the user setting it + # to an empty hash and it just being initialized. my $configure_requires; - if( $self->{CONFIGURE_REQUIRES} and ref($self->{CONFIGURE_REQUIRES}) eq 'HASH' ) { + if( $self->{ARGS}{CONFIGURE_REQUIRES} ) { $configure_requires = $self->{CONFIGURE_REQUIRES}; } else { $configure_requires = { 'ExtUtils::MakeMaker' => 0, }; } + my $build_requires; + if( $self->{ARGS}{BUILD_REQUIRES} ) { + $build_requires = $self->{BUILD_REQUIRES}; + } else { + $build_requires = { + 'ExtUtils::MakeMaker' => 0, + }; + } my %meta = ( name => $self->{DISTNAME}, @@ -856,9 +866,7 @@ sub metafile_data { configure_requires => $configure_requires, - build_requires => { - 'ExtUtils::MakeMaker' => 0 - }, + build_requires => $build_requires, no_index => { directory => [qw(t inc)] @@ -2236,6 +2244,81 @@ sub platform_constants { return ''; } +=begin private + +=head3 _PREREQ_PRINT + + $self->_PREREQ_PRINT; + +Implements PREREQ_PRINT. + +Refactored out of MakeMaker->new(). + +=end private + +=cut + +sub _PREREQ_PRINT { + my $self = shift; + + require Data::Dumper; + my @what = ('PREREQ_PM'); + push @what, 'MIN_PERL_VERSION' if $self->{MIN_PERL_VERSION}; + push @what, 'BUILD_REQUIRES' if $self->{BUILD_REQUIRES}; + print Data::Dumper->Dump([@{$self}{@what}], \@what); + exit 0; +} + + +=begin private + +=head3 _PRINT_PREREQ + + $mm->_PRINT_PREREQ; + +Implements PRINT_PREREQ, a slightly different version of PREREQ_PRINT +added by Redhat to, I think, support generating RPMs from Perl modules. + +Refactored out of MakeMaker->new(). + +=end private + +=cut + +sub _PRINT_PREREQ { + my $self = shift; + + my $prereqs= $self->_all_prereqs; + my @prereq = map { [$_, $prereqs->{$_}] } keys %$prereqs; + + if ( $self->{MIN_PERL_VERSION} ) { + push @prereq, ['perl' => $self->{MIN_PERL_VERSION}]; + } + + print join(" ", map { "perl($_->[0])>=$_->[1] " } + sort { $a->[0] cmp $b->[0] } @prereq), "\n"; + exit 0; +} + + +=begin private + +=head3 _all_prereqs + + my $prereqs = $self->_all_prereqs; + +Returns a hash ref of both PREREQ_PM and BUILD_REQUIRES. + +=end private + +=cut + +sub _all_prereqs { + my $self = shift; + + return { %{$self->{PREREQ_PM}}, %{$self->{BUILD_REQUIRES}} }; +} + =head1 AUTHOR diff --git a/lib/ExtUtils/MM_BeOS.pm b/lib/ExtUtils/MM_BeOS.pm index 3c8978a7bf..a85831a020 100644 --- a/lib/ExtUtils/MM_BeOS.pm +++ b/lib/ExtUtils/MM_BeOS.pm @@ -26,7 +26,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; =item os_flavor diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm index 79894e2059..4618929b70 100644 --- a/lib/ExtUtils/MM_Cygwin.pm +++ b/lib/ExtUtils/MM_Cygwin.pm @@ -9,7 +9,7 @@ require ExtUtils::MM_Unix; require ExtUtils::MM_Win32; our @ISA = qw( ExtUtils::MM_Unix ); -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; =head1 NAME diff --git a/lib/ExtUtils/MM_DOS.pm b/lib/ExtUtils/MM_DOS.pm index fd7f28ebcc..24eec2f4e2 100644 --- a/lib/ExtUtils/MM_DOS.pm +++ b/lib/ExtUtils/MM_DOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_DOS; use strict; -our $VERSION = 6.54; +our $VERSION = 6.55_01; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_Darwin.pm b/lib/ExtUtils/MM_Darwin.pm index 39d469e1d2..62baeffb31 100644 --- a/lib/ExtUtils/MM_Darwin.pm +++ b/lib/ExtUtils/MM_Darwin.pm @@ -7,7 +7,7 @@ BEGIN { our @ISA = qw( ExtUtils::MM_Unix ); } -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; =head1 NAME diff --git a/lib/ExtUtils/MM_MacOS.pm b/lib/ExtUtils/MM_MacOS.pm index 54b656e1f7..e134723ed5 100644 --- a/lib/ExtUtils/MM_MacOS.pm +++ b/lib/ExtUtils/MM_MacOS.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_MacOS; use strict; -our $VERSION = 6.54; +our $VERSION = 6.55_01; sub new { die <<'UNSUPPORTED'; diff --git a/lib/ExtUtils/MM_NW5.pm b/lib/ExtUtils/MM_NW5.pm index 536959a1b2..9a40968f32 100644 --- a/lib/ExtUtils/MM_NW5.pm +++ b/lib/ExtUtils/MM_NW5.pm @@ -22,7 +22,7 @@ use strict; use ExtUtils::MakeMaker::Config; use File::Basename; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index 183c8b403c..658d4eaf0d 100644 --- a/lib/ExtUtils/MM_OS2.pm +++ b/lib/ExtUtils/MM_OS2.pm @@ -5,7 +5,7 @@ use strict; use ExtUtils::MakeMaker qw(neatvalue); use File::Spec; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_QNX.pm b/lib/ExtUtils/MM_QNX.pm index 190e3cab0a..af9879224c 100644 --- a/lib/ExtUtils/MM_QNX.pm +++ b/lib/ExtUtils/MM_QNX.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_QNX; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_UWIN.pm b/lib/ExtUtils/MM_UWIN.pm index f5c2f5091f..bec378e09c 100644 --- a/lib/ExtUtils/MM_UWIN.pm +++ b/lib/ExtUtils/MM_UWIN.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_UWIN; use strict; -our $VERSION = 6.54; +our $VERSION = 6.55_01; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 81dc41b766..32f1272e4d 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -15,7 +15,7 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue); # If we make $VERSION an our variable parse_version() breaks use vars qw($VERSION); -$VERSION = '6.54'; +$VERSION = '6.55_01'; require ExtUtils::MM_Any; our @ISA = qw(ExtUtils::MM_Any); diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 96b8a97986..79267ca026 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -15,7 +15,7 @@ BEGIN { use File::Basename; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Any; require ExtUtils::MM_Unix; diff --git a/lib/ExtUtils/MM_VOS.pm b/lib/ExtUtils/MM_VOS.pm index b09b954be7..e056e2a4e2 100644 --- a/lib/ExtUtils/MM_VOS.pm +++ b/lib/ExtUtils/MM_VOS.pm @@ -1,7 +1,7 @@ package ExtUtils::MM_VOS; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Unix; our @ISA = qw(ExtUtils::MM_Unix); diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index bd5f15b273..86a1199b83 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -27,7 +27,7 @@ use ExtUtils::MakeMaker qw( neatvalue ); require ExtUtils::MM_Any; require ExtUtils::MM_Unix; our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -417,9 +417,16 @@ sub arch_check { # Win32 is an XS module, minperl won't have it. # arch_check() is not critical, so just fake it. return 1 unless $self->can_load_xs; + return $self->SUPER::arch_check( map { $self->_normalize_path_name($_) } @_); +} + +sub _normalize_path_name { + my $self = shift; + my $file = shift; require Win32; - return $self->SUPER::arch_check( map { lc Win32::GetShortPathName($_) } @_); + my $short = Win32::GetShortPathName($file); + return defined $short ? lc $short : lc $file; } diff --git a/lib/ExtUtils/MM_Win95.pm b/lib/ExtUtils/MM_Win95.pm index fc1be2415a..7fd9639276 100644 --- a/lib/ExtUtils/MM_Win95.pm +++ b/lib/ExtUtils/MM_Win95.pm @@ -2,7 +2,7 @@ package ExtUtils::MM_Win95; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require ExtUtils::MM_Win32; our @ISA = qw(ExtUtils::MM_Win32); diff --git a/lib/ExtUtils/MY.pm b/lib/ExtUtils/MY.pm index e38e404d02..6e65d78db4 100644 --- a/lib/ExtUtils/MY.pm +++ b/lib/ExtUtils/MY.pm @@ -3,7 +3,7 @@ package ExtUtils::MY; use strict; require ExtUtils::MM; -our $VERSION = 6.54; +our $VERSION = 6.55_01; our @ISA = qw(ExtUtils::MM); { diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 9b021e1a79..beac1b540d 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -18,7 +18,7 @@ our @Overridable; my @Prepend_parent; my %Recognized_Att_Keys; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; # Emulate something resembling CVS $Revision$ (our $Revision = $VERSION) =~ s{_}{}; @@ -88,6 +88,7 @@ my %Special_Sigs = ( PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', + BUILD_REQUIRES => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', @@ -255,7 +256,7 @@ sub full_setup { INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS LICENSE LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET - META_ADD META_MERGE MIN_PERL_VERSION CONFIGURE_REQUIRES + META_ADD META_MERGE MIN_PERL_VERSION BUILD_REQUIRES CONFIGURE_REQUIRES MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NORECURS NO_VC OBJECT OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE PERL_SRC PERM_DIR PERM_RW PERM_RWX @@ -389,25 +390,22 @@ sub new { $self->{ARGS}{$k} = $self->{$k}; } + $self = {} unless defined $self; + + $self->{PREREQ_PM} ||= {}; + $self->{BUILD_REQUIRES} ||= {}; + + # Temporarily bless it into MM so it can be used as an + # object. It will be blessed into a temp package later. + bless $self, "MM"; + if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { - require Data::Dumper; - my @what = ('PREREQ_PM'); - push @what, 'MIN_PERL_VERSION' if $self->{MIN_PERL_VERSION}; - print Data::Dumper->Dump([@{$self}{@what}], \@what); - exit 0; + $self->_PREREQ_PRINT; } # PRINT_PREREQ is RedHatism. if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { - my @prereq = - map { [$_, $self->{PREREQ_PM}{$_}] } keys %{$self->{PREREQ_PM}}; - if ( $self->{MIN_PERL_VERSION} ) { - push @prereq, ['perl' => $self->{MIN_PERL_VERSION}]; - } - - print join(" ", map { "perl($_->[0])>=$_->[1] " } - sort { $a->[0] cmp $b->[0] } @prereq), "\n"; - exit 0; + $self->_PRINT_PREREQ; } print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose; @@ -415,8 +413,6 @@ sub new { check_manifest(); } - $self = {} unless (defined $self); - check_hints($self); # Translate X.Y.Z to X.00Y00Z @@ -456,7 +452,10 @@ END my(%initial_att) = %$self; # record initial attributes my(%unsatisfied) = (); - foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) { + my $prereqs = $self->_all_prereqs; + foreach my $prereq (sort keys %$prereqs) { + my $required_version = $prereqs->{$prereq}; + my $installed_file = MM->_installed_file_for_module($prereq); my $pr_version = 0; $pr_version = MM->parse_version($installed_file) if $installed_file; @@ -467,20 +466,21 @@ END if (!$installed_file) { warn sprintf "Warning: prerequisite %s %s not found.\n", - $prereq, $self->{PREREQ_PM}{$prereq} + $prereq, $required_version unless $self->{PREREQ_FATAL}; + $unsatisfied{$prereq} = 'not installed'; - } elsif ($pr_version < $self->{PREREQ_PM}->{$prereq} ){ + } + elsif ($pr_version < $required_version ){ warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n", - $prereq, $self->{PREREQ_PM}{$prereq}, - ($pr_version || 'unknown version') + $prereq, $required_version, ($pr_version || 'unknown version') unless $self->{PREREQ_FATAL}; - $unsatisfied{$prereq} = $self->{PREREQ_PM}->{$prereq} ? - $self->{PREREQ_PM}->{$prereq} : 'unknown version' ; + + $unsatisfied{$prereq} = $required_version ? $required_version : 'unknown version' ; } } - - if (%unsatisfied && $self->{PREREQ_FATAL}){ + + if (%unsatisfied && $self->{PREREQ_FATAL}){ my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"} sort { $a cmp $b } keys %unsatisfied; die <<"END"; @@ -605,18 +605,9 @@ END # # MakeMaker ARGV: $argv # -# MakeMaker Parameters: END - foreach my $key (sort keys %initial_att){ - next if $key eq 'ARGS'; - - my($v) = neatvalue($initial_att{$key}); - $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; - $v =~ tr/\n/ /s; - push @{$self->{RESULT}}, "# $key => $v"; - } - undef %initial_att; # free memory + push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att); if (defined $self->{CONFIGURE}) { push @{$self->{RESULT}}, <<END; @@ -747,6 +738,34 @@ sub _installed_file_for_module { } +# Extracted from MakeMaker->new so we can test it +sub _MakeMaker_Parameters_section { + my $self = shift; + my $att = shift; + + my @result = <<'END'; + # MakeMaker Parameters: +END + + # CPAN.pm takes prereqs from this field in 'Makefile' + # and does not know about BUILD_REQUIRES + if( $att->{PREREQ_PM} || $att->{BUILD_REQUIRES} ) { + %{$att->{'PREREQ_PM'}} = (%{$att->{'PREREQ_PM'}||{}}, %{$att->{'BUILD_REQUIRES'}||{}}); + } + + foreach my $key (sort keys %$att){ + next if $key eq 'ARGS'; + + my($v) = neatvalue($att->{$key}); + $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; + $v =~ tr/\n/ /s; + push @result, "# $key => $v"; + } + + return @result; +} + + sub check_manifest { print STDOUT "Checking if your kit is complete...\n"; require ExtUtils::Manifest; @@ -1459,6 +1478,14 @@ architecture. For example: builds a PPD package that references a binary of the C<Agent> package, located in the C<x86> directory relative to the PPD itself. +=item BUILD_REQUIRES + +A hash of modules that are needed to build your module but not run it. + +This will go into the C<build_requires> field of your F<META.yml>. + +The format is the same as PREREQ_PM. + =item C Ref to array of *.c file names. Initialised from a directory scan @@ -2243,6 +2270,8 @@ added to the output as an additional line of the form: $MIN_PERL_VERSION = '5.008001'; +If BUILD_REQUIRES is not empty, it will be dumped as $BUILD_REQUIRES hasref. + =item PRINT_PREREQ RedHatism for C<PREREQ_PRINT>. The output format is different, though: diff --git a/lib/ExtUtils/MakeMaker/Config.pm b/lib/ExtUtils/MakeMaker/Config.pm index 5b58ab3886..24f48b4e35 100644 --- a/lib/ExtUtils/MakeMaker/Config.pm +++ b/lib/ExtUtils/MakeMaker/Config.pm @@ -2,7 +2,7 @@ package ExtUtils::MakeMaker::Config; use strict; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; use Config (); diff --git a/lib/ExtUtils/Mkbootstrap.pm b/lib/ExtUtils/Mkbootstrap.pm index 37e24047d4..c7f8fe73a0 100644 --- a/lib/ExtUtils/Mkbootstrap.pm +++ b/lib/ExtUtils/Mkbootstrap.pm @@ -3,7 +3,7 @@ package ExtUtils::Mkbootstrap; # There's just too much Dynaloader incest here to turn on strict vars. use strict 'refs'; -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; require Exporter; our @ISA = ('Exporter'); diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index ce57289e2d..a1a7c920aa 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -10,7 +10,7 @@ use Config; our @ISA = qw(Exporter); our @EXPORT = qw(&Mksymlists); -our $VERSION = '6.54'; +our $VERSION = '6.55_01'; sub Mksymlists { my(%spec) = @_; diff --git a/lib/ExtUtils/t/MakeMaker_Parameters.t b/lib/ExtUtils/t/MakeMaker_Parameters.t new file mode 100644 index 0000000000..734a1bc245 --- /dev/null +++ b/lib/ExtUtils/t/MakeMaker_Parameters.t @@ -0,0 +1,74 @@ +#!/usr/bin/perl -w + +# Things like the CPAN shell rely on the "MakeMaker Parameters" section of the +# Makefile to learn a module's dependencies so we'd damn well better test it. + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't' if -d 't'; + @INC = ('../lib', 'lib'); + } + else { + unshift @INC, 't/lib'; + } +} + +use strict; +use warnings; + +use ExtUtils::MakeMaker; +use Test::More; + +my $mm = bless {}, "MM"; + +sub extract_params { + my $text = join "\n", @_; + + $text =~ s{^\s* \# \s+ MakeMaker\ Parameters: \s*\n}{}x; + $text =~ s{^#}{}gms; + $text =~ s{\n}{,\n}g; + + no strict 'subs'; + return { eval "$text" }; +} + +sub test_round_trip { + my $args = shift; + my $want = @_ ? shift : $args; + + my $have = extract_params($mm->_MakeMaker_Parameters_section($args)); + + local $Test::Builder::Level = $Test::Builder::Level + 1; + is_deeply $have, $want or diag explain $have, "\n", $want; +} + +is join("", $mm->_MakeMaker_Parameters_section()), <<'EXPECT', "nothing"; + # MakeMaker Parameters: +EXPECT + +test_round_trip({ NAME => "Foo" }); +test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 0 } }); +test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 1.23 } }); + +# Test the special case for BUILD_REQUIRES +{ + my $have = { + NAME => "Foo", + PREREQ_PM => { "Foo::Bar" => 1.23 }, + BUILD_REQUIRES => { "Baz" => 0.12 }, + }; + + my $want = { + NAME => "Foo", + PREREQ_PM => { + "Foo::Bar" => 1.23, + "Baz" => 0.12, + }, + BUILD_REQUIRES => { "Baz" => 0.12 }, + }; + + test_round_trip( $have, $want ); +} + +done_testing(); + diff --git a/lib/ExtUtils/t/metafile_data.t b/lib/ExtUtils/t/metafile_data.t index ddb986b2c6..29d271cfce 100644 --- a/lib/ExtUtils/t/metafile_data.t +++ b/lib/ExtUtils/t/metafile_data.t @@ -9,14 +9,14 @@ BEGIN { } use strict; -use Test::More tests => 6; +use Test::More tests => 7; use Data::Dumper; require ExtUtils::MM_Any; my $new_mm = sub { - return bless {@_}, 'ExtUtils::MM_Any'; + return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any'; }; { @@ -273,3 +273,43 @@ my $new_mm = sub { }, ],'CONFIGURE_REQUIRES'; } + +# Test BUILD_REQUIRES +{ + my $mm = $new_mm->( + DISTNAME => 'Foo-Bar', + VERSION => 1.23, + BUILD_REQUIRES => { + "Fake::Module1" => 1.01, + }, + PM => { + "Foo::Bar" => 'lib/Foo/Bar.pm', + }, + ); + + is_deeply [$mm->metafile_data], [ + name => 'Foo-Bar', + version => 1.23, + abstract => undef, + author => [], + license => 'unknown', + distribution_type => 'module', + + configure_requires => { + 'ExtUtils::MakeMaker' => 0, + }, + build_requires => { + 'Fake::Module1' => 1.01, + }, + + no_index => { + directory => [qw(t inc)], + }, + + generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION", + 'meta-spec' => { + url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', + version => 1.4 + }, + ],'CONFIGURE_REQUIRES'; +} diff --git a/lib/ExtUtils/t/min_perl_version.t b/lib/ExtUtils/t/min_perl_version.t index 7e44570b0f..9dc6088bf3 100644 --- a/lib/ExtUtils/t/min_perl_version.t +++ b/lib/ExtUtils/t/min_perl_version.t @@ -130,7 +130,7 @@ END skip 'not going to evaluate rubbish', 3 if !$prereq_out_sane; package _Prereq::Print::WithMPV; ## no critic - use vars qw($PREREQ_PM $MIN_PERL_VERSION $ERR); + our($PREREQ_PM, $BUILD_REQUIRES, $MIN_PERL_VERSION, $ERR); $ERR = ''; eval { eval $prereq_out; ## no critic diff --git a/lib/ExtUtils/testlib.pm b/lib/ExtUtils/testlib.pm index 0af41d2975..e11fd32434 100644 --- a/lib/ExtUtils/testlib.pm +++ b/lib/ExtUtils/testlib.pm @@ -3,7 +3,7 @@ package ExtUtils::testlib; use strict; use warnings; -our $VERSION = 6.54; +our $VERSION = 6.55_01; use Cwd; use File::Spec; |