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
'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
+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
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';
use strict;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
use File::Spec;
require ExtUtils::Liblist::Kid;
# Broken out of MakeMaker from version 4.11
use strict;
-our $VERSION = 6.54;
+our $VERSION = 6.55_01;
use Config;
use Cwd 'cwd';
use strict;
use ExtUtils::MakeMaker::Config;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
require ExtUtils::Liblist;
require ExtUtils::MakeMaker;
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);
package ExtUtils::MM_Any;
use strict;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
use Carp;
use File::Spec;
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')
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},
configure_requires => $configure_requires,
- build_requires => {
- 'ExtUtils::MakeMaker' => 0
- },
+ build_requires => $build_requires,
no_index => {
directory => [qw(t inc)]
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
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
require ExtUtils::MM_Win32;
our @ISA = qw( ExtUtils::MM_Unix );
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
=head1 NAME
use strict;
-our $VERSION = 6.54;
+our $VERSION = 6.55_01;
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
our @ISA = qw( ExtUtils::MM_Unix );
}
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
=head1 NAME
use strict;
-our $VERSION = 6.54;
+our $VERSION = 6.55_01;
sub new {
die <<'UNSUPPORTED';
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);
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;
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);
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);
# 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);
use File::Basename;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
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);
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`
# 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;
}
use strict;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
require ExtUtils::MM_Win32;
our @ISA = qw(ExtUtils::MM_Win32);
use strict;
require ExtUtils::MM;
-our $VERSION = 6.54;
+our $VERSION = 6.55_01;
our @ISA = qw(ExtUtils::MM);
{
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{_}{};
PMLIBDIRS => 'ARRAY',
PMLIBPARENTDIRS => 'ARRAY',
PREREQ_PM => 'HASH',
+ BUILD_REQUIRES => 'HASH',
CONFIGURE_REQUIRES => 'HASH',
SKIP => 'ARRAY',
TYPEMAPS => 'ARRAY',
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
$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;
check_manifest();
}
- $self = {} unless (defined $self);
-
check_hints($self);
# Translate X.Y.Z to X.00Y00Z
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;
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";
#
# 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;
}
+# 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;
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
$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:
use strict;
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
use Config ();
# 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');
our @ISA = qw(Exporter);
our @EXPORT = qw(&Mksymlists);
-our $VERSION = '6.54';
+our $VERSION = '6.55_01';
sub Mksymlists {
my(%spec) = @_;
--- /dev/null
+#!/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();
+
}
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';
};
{
},
],'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';
+}
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
use strict;
use warnings;
-our $VERSION = 6.54;
+our $VERSION = 6.55_01;
use Cwd;
use File::Spec;
HARNESS_OPTIONS
HARNESS_VERBOSE
PREFIX
- LIB
MAKEFLAGS
);
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`;