package ExtUtils::MakeMaker;
-$VERSION = "5.47";
+$VERSION = "5.48";
$Version_OK = "5.17"; # Makefiles older than $Version_OK will die
# (Will be checked from MakeMaker version 4.13 onwards)
($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//;
require Exporter;
use Config;
use Carp ();
-#use FileHandle ();
use vars qw(
-
@ISA @EXPORT @EXPORT_OK $AUTOLOAD
- $ISA_TTY $Is_Mac $Is_OS2 $Is_VMS $Revision
- $VERSION $Verbose $Version_OK %Config %Keep_after_flush
- %MM_Sections %Prepend_dot_dot %Recognized_Att_Keys
- @Get_from_Config @MM_Sections @Overridable @Parent
-
+ $ISA_TTY $Revision $VERSION $Verbose $Version_OK %Config
+ %Keep_after_flush %MM_Sections %Prepend_dot_dot
+ %Recognized_Att_Keys @Get_from_Config @MM_Sections @Overridable
+ @Parent $PACKNAME
);
-# use strict;
+use strict;
# &DynaLoader::mod2fname should be available to miniperl, thus
# should be a pseudo-builtin (cmp. os2.c).
#
# Now we can pull in the friends
#
-$Is_VMS = $^O eq 'VMS';
-$Is_OS2 = $^O eq 'os2';
-$Is_Mac = $^O eq 'MacOS';
-$Is_Win32 = $^O eq 'MSWin32';
-$Is_Cygwin= $^O eq 'cygwin';
-$Is_NetWare = $Config{'osname'} eq 'NetWare';
+my $Is_VMS = $^O eq 'VMS';
+my $Is_OS2 = $^O eq 'os2';
+my $Is_Mac = $^O eq 'MacOS';
+my $Is_Win32 = $^O eq 'MSWin32';
+my $Is_Cygwin = $^O eq 'cygwin';
+my $Is_NetWare = $Config{osname} eq 'NetWare';
+my $Is_BeOS = $^O =~ /beos/i; # XXX should this be that loose?
require ExtUtils::MM_Unix;
require ExtUtils::MM_MacOS;
}
if ($Is_NetWare) {
- $^O = 'NetWare';
- require ExtUtils::MM_NW5;
- $Is_Win32=0;
+ require ExtUtils::MM_NW5;
+ $Is_Win32 = 0;
}
if ($Is_Win32) {
require ExtUtils::MM_Win32;
if ($Is_Cygwin) {
require ExtUtils::MM_Cygwin;
}
+if ($Is_BeOS) {
+ require ExtUtils::MM_BeOS;
+}
full_setup();
my $ans;
local $|=1;
print "$mess $dispdef";
- if ($ISA_TTY) {
+ if ($ISA_TTY && !$ENV{PERL_MM_USE_DEFAULT}) {
chomp($ans = <STDIN>);
} else {
print "$def\n";
sub eval_in_subdirs {
my($self) = @_;
- my($dir);
use Cwd qw(cwd abs_path);
my $pwd = cwd();
local @INC = map eval {abs_path($_) if -e} || $_, @INC;
- foreach $dir (@{$self->{DIR}}){
+ foreach my $dir (@{$self->{DIR}}){
my($abs) = $self->catdir($pwd,$dir);
$self->eval_in_x($abs);
}
my($self,$dir) = @_;
package main;
chdir $dir or Carp::carp("Couldn't change to directory $dir: $!");
-# use FileHandle ();
-# my $fh = new FileHandle;
-# $fh->open("Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
- local *FH;
- open(FH,"Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
-# my $eval = join "", <$fh>;
- my $eval = join "", <FH>;
-# $fh->close;
- close FH;
- eval $eval;
+
+ eval { do './Makefile.PL' };
if ($@) {
# if ($@ =~ /prerequisites/) {
# die "MakeMaker WARNING: $@";
# package name for the classes into which the first object will be blessed
$PACKNAME = "PACK000";
- @Attrib_help = qw/
+ my @attrib_help = qw/
AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
PERLRUN PERLRUNINST PERL_ARCHLIB PERL_CORE
PERL_LIB PERL_SRC PERM_RW PERM_RWX
PL_FILES PM PM_FILTER PMLIBDIRS POLLUTE PPM_INSTALL_EXEC
- PPM_INSTALL_SCRIPT PREFIX PREREQ_FATAL
- PREREQ_PM SKIP TEST_LIBS TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
+ PPM_INSTALL_SCRIPT PREFIX
+ PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
+ SKIP TEST_LIBS TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
XS_VERSION clean depend dist dynamic_lib linkext macro realclean
tool_autosplit
MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC
exe_ext full_ar
);
- my $item;
- foreach $item (@Attrib_help){
+ foreach my $item (@attrib_help){
$Recognized_Att_Keys{$item} = 1;
}
- foreach $item (@Get_from_Config) {
+ foreach my $item (@Get_from_Config) {
$Recognized_Att_Keys{uc $item} = $Config{$item};
print "Attribute '\U$item\E' => '$Config{$item}'\n"
if ($Verbose >= 2);
my($class,$self) = @_;
my($key);
+ if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
+ require Data::Dumper;
+ print Data::Dumper->Dump([$self->{PREREQ_PM}], [qw(PREREQ_PM)]);
+ }
+
+ # PRINT_PREREQ is RedHatism.
+ if ("@ARGV" =~ /\bPRINT_PREREQ\b/) {
+ print join(" ", map { "perl($_)>=$self->{PREREQ_PM}->{$_} " } sort keys %{$self->{PREREQ_PM}}), "\n";
+ exit 0;
+ }
+
print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
if (-f "MANIFEST" && ! -f "Makefile"){
check_manifest();
my(%initial_att) = %$self; # record initial attributes
my(%unsatisfied) = ();
- my($prereq);
- foreach $prereq (sort keys %{$self->{PREREQ_PM}}) {
- my $eval = "require $prereq";
- eval $eval;
+ foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) {
+ eval "require $prereq";
if ($@) {
warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found.\n" unless $self->{PREREQ_FATAL};
my $newclass = ++$PACKNAME;
local @Parent = @Parent; # Protect against non-local exits
{
-# no strict;
+ no strict 'refs';
print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
mv_all_methods("MY",$newclass);
bless $self, $newclass;
# MakeMaker Parameters:
END
- foreach $key (sort keys %initial_att){
+ foreach my $key (sort keys %initial_att){
my($v) = neatvalue($initial_att{$key});
$v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v =~ tr/\n/ /s;
# MakeMaker 'CONFIGURE' Parameters:
END
if (scalar(keys %configure_att) > 0) {
- foreach $key (sort keys %configure_att){
+ foreach my $key (sort keys %configure_att){
my($v) = neatvalue($configure_att{$key});
$v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v =~ tr/\n/ /s;
$self->eval_in_subdirs if @{$self->{DIR}};
}
- my $section;
- foreach $section ( @MM_Sections ){
+ foreach my $section ( @MM_Sections ){
print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
my($skipit) = $self->skipcheck($section);
if ($skipit){
sub check_manifest {
print STDOUT "Checking if your kit is complete...\n";
require ExtUtils::Manifest;
- $ExtUtils::Manifest::Quiet=$ExtUtils::Manifest::Quiet=1; #avoid warning
- my(@missed)=ExtUtils::Manifest::manicheck();
- if (@missed){
+ # avoid warning
+ $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1;
+ my(@missed) = ExtUtils::Manifest::manicheck();
+ if (@missed) {
print STDOUT "Warning: the following files are missing in your kit:\n";
print "\t", join "\n\t", @missed;
print STDOUT "\n";
sub parse_args{
my($self, @args) = @_;
- foreach (@args){
- unless (m/(.*?)=(.*)/){
+ foreach (@args) {
+ unless (m/(.*?)=(.*)/) {
help(),exit 1 if m/^help$/;
++$Verbose if m/^verb/;
next;
}
my($name, $value) = ($1, $2);
- if ($value =~ m/^~(\w+)?/){ # tilde with optional username
+ if ($value =~ m/^~(\w+)?/) { # tilde with optional username
$value =~ s [^~(\w*)]
[$1 ?
((getpwnam($1))[7] || "~$1") :
if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') {
$self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}];
}
- my $mmkey;
- foreach $mmkey (sort keys %$self){
+
+ foreach my $mmkey (sort keys %$self){
print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n"
unless exists $Recognized_Att_Keys{$mmkey};
return unless -d "hints";
# First we look for the best hintsfile we have
- my(@goodhints);
my($hint)="${^O}_$Config{osvers}";
$hint =~ s/\./_/g;
$hint =~ s/_$//;
return unless -f "hints/$hint.pl"; # really there
# execute the hintsfile:
-# use FileHandle ();
-# my $fh = new FileHandle;
-# $fh->open("hints/$hint.pl");
- local *FH;
- open(FH,"hints/$hint.pl");
-# @goodhints = <$fh>;
- @goodhints = <FH>;
-# $fh->close;
- close FH;
print STDOUT "Processing hints file hints/$hint.pl\n";
- eval join('',@goodhints);
+ eval { do "hints/$hint.pl" };
print STDOUT $@ if $@;
}
sub mv_all_methods {
my($from,$to) = @_;
- my($method);
+ no strict 'refs';
my($symtab) = \%{"${from}::"};
-# no strict;
# Here you see the *current* list of methods that are overridable
# from Makefile.PL via MY:: subroutines. As of VERSION 5.07 I'm
# still trying to reduce the list to some reasonable minimum --
# because I want to make it easier for the user. A.K.
- foreach $method (@Overridable) {
+ foreach my $method (@Overridable) {
# We cannot say "next" here. Nick might call MY->makeaperl
# which isn't defined right now
my($t) = ref $v;
return "q[$v]" unless $t;
if ($t eq 'ARRAY') {
- my(@m, $elem, @neat);
+ my(@m, @neat);
push @m, "[";
- foreach $elem (@$v) {
+ foreach my $elem (@$v) {
push @neat, "q[$elem]";
}
push @m, join ", ", @neat;
my(@m);
if ($Verbose){
push @m, "\n# Full list of MakeMaker attribute values:";
- foreach $key (sort keys %$self){
+ foreach my $key (sort keys %$self){
next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
my($v) = neatvalue($self->{$key});
$v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
decided at the build time of your perl (unless you override one of
them, of course).
-=item PREREQ_FATAL
-
-Bool. If this parameter is true, failing to have the prequired modules
-(or the right versions thereof) will be fatal. perl Makefile.PL will die
-with the proper message.
-
=item PREREQ_PM
Hashref: Names of modules that need to be available to run this
desired version is the value. If the required version number is 0, we
only check if any version is installed already.
+=item PREREQ_FATAL
+
+Bool. If this parameter is true, failing to have the required modules
+(or the right versions thereof) will be fatal. perl Makefile.PL will die
+with the proper message.
+
+Note: see L<Test::Harness> for a shortcut for stopping tests early if
+you are missing dependencies.
+
+Do I<not> use this parameter for simple requirements, which could be resolved
+at a later time, e.g. after an unsuccessful B<make test> of your module.
+
+It is I<extremely> rare to have to use C<PREREQ_FATAL> at all!
+
+=item PREREQ_PRINT
+
+Bool. If this parameter is true, the prerequisites will be printed to
+stdout and MakeMaker will exit. The output format is
+
+$PREREQ_PM = {
+ 'A::B' => Vers1,
+ 'C::D' => Vers2,
+ ...
+ };
+
+=item PRINT_PREREQ
+
+RedHatism for C<PREREQ_PRINT>. The output format is different, though:
+
+ perl(A::B)>=Vers1 perl(C::D)>=Vers2 ...
+
=item SKIP
Arrayref. E.g. [qw(name1 name2)] skip (do not write) sections of the
C<WriteMakefile()>. The string is split on whitespace, and the result
is processed before any actual command line arguments are processed.
+=item PERL_MM_USE_DEFAULT
+
+If set to a true value then MakeMaker's prompt function will
+always return the default without waiting for user input.
+
=back
=head1 SEE ALSO