From b6d6132c1554383190492215dd1da143d1d564ef Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Thu, 16 Jul 2009 10:53:04 +0100 Subject: [PATCH] ExtUtils::MakeMaker 6.55_01 --- MANIFEST | 1 + Porting/Maintainers.pl | 3 +- lib/ExtUtils/Changes | 13 +++++ lib/ExtUtils/Command/MM.pm | 2 +- lib/ExtUtils/Liblist.pm | 2 +- lib/ExtUtils/Liblist/Kid.pm | 2 +- lib/ExtUtils/MM.pm | 2 +- lib/ExtUtils/MM_AIX.pm | 2 +- lib/ExtUtils/MM_Any.pm | 95 +++++++++++++++++++++++++++++-- lib/ExtUtils/MM_BeOS.pm | 2 +- lib/ExtUtils/MM_Cygwin.pm | 2 +- lib/ExtUtils/MM_DOS.pm | 2 +- lib/ExtUtils/MM_Darwin.pm | 2 +- lib/ExtUtils/MM_MacOS.pm | 2 +- lib/ExtUtils/MM_NW5.pm | 2 +- lib/ExtUtils/MM_OS2.pm | 2 +- lib/ExtUtils/MM_QNX.pm | 2 +- lib/ExtUtils/MM_UWIN.pm | 2 +- lib/ExtUtils/MM_Unix.pm | 2 +- lib/ExtUtils/MM_VMS.pm | 2 +- lib/ExtUtils/MM_VOS.pm | 2 +- lib/ExtUtils/MM_Win32.pm | 11 +++- lib/ExtUtils/MM_Win95.pm | 2 +- lib/ExtUtils/MY.pm | 2 +- lib/ExtUtils/MakeMaker.pm | 103 ++++++++++++++++++++++------------ lib/ExtUtils/MakeMaker/Config.pm | 2 +- lib/ExtUtils/Mkbootstrap.pm | 2 +- lib/ExtUtils/Mksymlists.pm | 2 +- lib/ExtUtils/t/MakeMaker_Parameters.t | 74 ++++++++++++++++++++++++ lib/ExtUtils/t/metafile_data.t | 44 ++++++++++++++- lib/ExtUtils/t/min_perl_version.t | 2 +- lib/ExtUtils/testlib.pm | 2 +- t/lib/MakeMaker/Test/Utils.pm | 6 +- 33 files changed, 323 insertions(+), 75 deletions(-) create mode 100644 lib/ExtUtils/t/MakeMaker_Parameters.t diff --git a/MANIFEST b/MANIFEST index 1e5872e..9b2e198 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2247,6 +2247,7 @@ lib/ExtUtils/t/INST.t Check MakeMaker INST_* macros lib/ExtUtils/t/is_of_type.t Test for ExtUtils::MakeMaker lib/ExtUtils/t/Liblist.t See if ExtUtils::Liblist works lib/ExtUtils/t/make.t See if make detection works +lib/ExtUtils/t/MakeMaker_Parameters.t test "MakeMaker Parameters" section lib/ExtUtils/t/maketext_filter.t See if maketext_filter works lib/ExtUtils/t/Manifest.t See if ExtUtils::Manifest works lib/ExtUtils/t/metafile_data.t See if META.yml handling works diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index ec7ee29..dba107e 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -694,13 +694,14 @@ package Maintainers; 'ExtUtils::MakeMaker' => { 'MAINTAINER' => 'mschwern', - 'DISTRIBUTION' => 'MSCHWERN/ExtUtils-MakeMaker-6.54.tar.gz', + 'DISTRIBUTION' => 'MSCHWERN/ExtUtils-MakeMaker-6.55_01.tar.gz', # note that t/lib/TieOut.pm is included in # more than one distro 'FILES' => q[lib/ExtUtils/{Liblist,MakeMaker,Mkbootstrap,Mksymlists,MM*,MY,testlib}.pm lib/ExtUtils/{Command,Liblist,MakeMaker} lib/ExtUtils/t/{[0-9FLV-Zabdf-z]*,IN*,Mkbootstrap,MM_*,PL_FILES,cd,config}.t lib/ExtUtils/t/testdata/ + lib/ExtUtils/t/MakeMaker_Parameters.t lib/ExtUtils/Changes lib/ExtUtils/{NOTES,PATCHING,README,TODO} lib/ExtUtils/instmodsh diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes index bacd445..591f958 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 8748d79..bebddd8 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 ae33db5..6d91117 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 730b4d0..88826c2 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 d3ff875..fc75501 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 dcfb171..10e4fd4 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 ce723b5..0af50e1 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 3c8978a..a85831a 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 79894e2..4618929 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 fd7f28e..24eec2f 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 39d469e..62baeff 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 54b656e..e134723 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 536959a..9a40968 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 183c8b4..658d4ea 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 190e3ca..af98792 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 f5c2f50..bec378e 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 81dc41b..32f1272 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 96b8a97..79267ca 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 b09b954..e056e2a 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 bd5f15b..86a1199 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 fc1be24..7fd9639 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 e38e404..6e65d78 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 9b021e1..beac1b5 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}}, <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 package, located in the C 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 field of your F. + +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. The output format is different, though: diff --git a/lib/ExtUtils/MakeMaker/Config.pm b/lib/ExtUtils/MakeMaker/Config.pm index 5b58ab3..24f48b4 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 37e2404..c7f8fe7 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 ce57289..a1a7c92 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 0000000..734a1bc --- /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 ddb986b..29d271c 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 7e44570..9dc6088 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 0af41d2..e11fd32 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; diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index 1fb4174..7e5d5fc 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -29,7 +29,6 @@ our @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup HARNESS_OPTIONS HARNESS_VERBOSE PREFIX - LIB MAKEFLAGS ); @@ -291,9 +290,10 @@ sub run { use ExtUtils::MM; - # Unix can handle 2>&1 and OS/2 from 5.005_54 up. + # Unix, modern Windows and OS/2 from 5.005_54 up can handle can handle 2>&1 # This makes our failure diagnostics nicer to read. - if( MM->os_flavor_is('Unix') or + if( MM->os_flavor_is('Unix') or + (MM->os_flavor_is('Win32') and !MM->os_flavor_is('Win9x')) or ($] > 5.00554 and MM->os_flavor_is('OS/2')) ) { return `$cmd 2>&1`; -- 2.7.4