-BEGIN {require 5.004;}
-
package ExtUtils::MakeMaker;
-$VERSION = "5.55_02";
+BEGIN {require 5.005_03;}
+
+$VERSION = "6.03";
$Version_OK = "5.49"; # Makefiles older than $Version_OK will die
# (Will be checked from MakeMaker version 4.13 onwards)
-($Revision = substr(q$Revision: 1.33 $, 10)) =~ s/\s+$//;
+($Revision = substr(q$Revision: 1.63 $, 10)) =~ s/\s+$//;
require Exporter;
use Config;
require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker
# will give them MM.
+require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect
+ # loading ExtUtils::MakeMaker will give them MY.
+ # This will go when Embed is it's own CPAN module.
+
sub WriteMakefile {
Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
require ExtUtils::MY;
my %att = @_;
+
+ _verify_att(\%att);
+
my $mm = MM->new(\%att);
$mm->flush;
return $mm;
}
+
+# Basic signatures of the attributes WriteMakefile takes. Each is the
+# reference type. Empty value indicate it takes a non-reference
+# scalar.
+my %Att_Sigs =
+(
+ ABSTRACT => '',
+ ABSTRACT_FROM => '',
+ AUTHOR => '',
+ BINARY_LOCATION => '',
+ C => 'array',
+ CCFLAGS => '',
+ CONFIG => 'array',
+ CONFIGURE => 'code',
+ DEFINE => '',
+ DIR => 'array',
+ DISTNAME => '',
+ DL_FUNCS => 'hash',
+ DL_VARS => 'array',
+ EXCLUDE_EXT => 'array',
+ EXE_FILES => 'array',
+ FIRST_MAKEFILE => '',
+ FULLPERL => '',
+ FULLPERLRUN => '',
+ FULLPERLRUNINST => '',
+ FUNCLIST => 'array',
+ H => 'array',
+ IMPORTS => 'hash',
+ INC => '',
+ INCLUDE_EXT => 'array',
+ INSTALLARCHLIB => '',
+ INSTALLBIN => '',
+ INSTALLDIRS => '',
+ INSTALLMAN1DIR => '',
+ INSTALLMAN3DIR => '',
+ INSTALLPRIVLIB => '',
+ INSTALLSCRIPT => '',
+ INSTALLSITEARCH => '',
+ INSTALLSITEBIN => '',
+ INSTALLSITELIB => '',
+ INSTALLSITEMAN1DIR => '',
+ INSTALLSITEMAN3DIR => '',
+ INSTALLVENDORARCH => '',
+ INSTALLVENDORBIN => '',
+ INSTALLVENDORLIB => '',
+ INSTALLVENDORMAN1DIR => '',
+ INSTALLVENDORMAN3DIR => '',
+ INST_ARCHLIB => '',
+ INST_BIN => '',
+ INST_LIB => '',
+ INST_MAN1DIR => '',
+ INST_MAN3DIR => '',
+ INST_SCRIPT => '',
+ _KEEP_AFTER_FLUSH => '',
+ LDDLFLAGS => '',
+ LDFROM => '',
+ LIB => '',
+ LIBPERL_A => '',
+ LIBS => ['array',''],
+ LINKTYPE => '',
+ MAKEAPERL => '',
+ MAKEFILE => '',
+ MAN1PODS => 'hash',
+ MAN3PODS => 'hash',
+ MAP_TARGET => '',
+ MYEXTLIB => '',
+ NAME => '',
+ NEEDS_LINKING => '',
+ NOECHO => '',
+ NORECURS => '',
+ NO_VC => '',
+ OBJECT => '',
+ OPTIMIZE => '',
+ PERL => '',
+ PERL_CORE => '',
+ PERLMAINCC => '',
+ PERL_ARCHLIB => '',
+ PERL_LIB => '',
+ PERL_MALLOC_OK => '',
+ PERLRUN => '',
+ PERLRUNINST => '',
+ PERL_SRC => '',
+ PERM_RW => '',
+ PERM_RWX => '',
+ PL_FILES => 'hash',
+ PM => 'hash',
+ PMLIBDIRS => 'array',
+ PM_FILTER => '',
+ POLLUTE => '',
+ PPM_INSTALL_EXEC => '',
+ PPM_INSTALL_SCRIPT => '',
+ PREFIX => '',
+ PREREQ_FATAL => '',
+ PREREQ_PM => 'hash',
+ PREREQ_PRINT => '',
+ PRINT_PREREQ => '',
+ SITEPREFIX => '',
+ SKIP => 'array',
+ TYPEMAPS => 'array',
+ VENDORPREFIX => '',
+ VERBINST => '',
+ VERSION => '',
+ VERSION_FROM => '',
+ XS => 'hash',
+ XSOPT => '',
+ XSPROTOARG => '',
+ XS_VERSION => '',
+
+ clean => 'hash',
+ depend => 'hash',
+ dist => 'hash',
+ dynamic_lib=> 'hash',
+ linkext => 'hash',
+ macro => 'hash',
+ realclean => 'hash',
+ test => 'hash',
+ tool_autosplit => 'hash',
+);
+
+
+sub _verify_att {
+ my($att) = @_;
+
+ while( my($key, $val) = each %$att ) {
+ my $sig = $Att_Sigs{$key};
+ unless( defined $sig ) {
+ warn "WARNING: $key is not a known parameter.\n";
+ next;
+ }
+
+ my @sigs = ref $sig ? @$sig : $sig;
+ my $given = lc ref $val;
+ unless( grep $given eq $_, @sigs ) {
+ my $takes = join " or ", map { $_ ne '' ? "$_ reference"
+ : "string/number"
+ } @sigs;
+ my $has = $given ne '' ? "$given reference"
+ : "string/number";
+ warn "WARNING: $key takes a $takes not a $has.\n".
+ " Please inform the author.\n";
+ }
+ }
+}
+
sub prompt ($;$) {
my($mess,$def)=@_;
$ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe?
sub eval_in_subdirs {
my($self) = @_;
use Cwd qw(cwd abs_path);
- my $pwd = cwd();
+ my $pwd = cwd() || die "Can't figure out your cwd!";
+
local @INC = map eval {abs_path($_) if -e} || $_, @INC;
push @INC, '.'; # '.' has to always be at the end of @INC
# } else {
# warn "WARNING from evaluation of $dir/Makefile.PL: $@";
# }
- warn "WARNING from evaluation of $dir/Makefile.PL: $@";
+ die "ERROR from evaluation of $dir/Makefile.PL: $@";
}
}
EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE
FULLPERL FULLPERLRUN FULLPERLRUNINST
FUNCLIST H IMPORTS
- INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS
- INSTALLMAN1DIR
- INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
- INSTALLSITELIB INST_ARCHLIB INST_BIN INST_LIB
- INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIB LIBPERL_A LIBS
+ INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR
+ INSTALLDIRS
+ PREFIX SITEPREFIX VENDORPREFIX
+ INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
+ INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
+ INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
+ INSTALLMAN1DIR INSTALLMAN3DIR
+ INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR
+ INSTALLVENDORMAN1DIR INSTALLVENDORMAN3DIR
+ INSTALLSCRIPT
+ PERL_LIB PERL_ARCHLIB
+ SITELIBEXP SITEARCHEXP
+ INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS
LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB
PERL_MALLOC_OK
NAME NEEDS_LINKING NOECHO NORECURS NO_VC OBJECT OPTIMIZE PERL PERLMAINCC
- PERLRUN PERLRUNINST PERL_ARCHLIB PERL_CORE
- PERL_LIB PERL_SRC PERM_RW PERM_RWX
+ PERLRUN PERLRUNINST PERL_CORE
+ PERL_SRC PERM_RW PERM_RWX
PL_FILES PM PM_FILTER PMLIBDIRS POLLUTE PPM_INSTALL_EXEC
- PPM_INSTALL_SCRIPT PREFIX
- PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
+ PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
XS_VERSION clean depend dist dynamic_lib linkext macro realclean
tool_autosplit
unless $self->{PREREQ_FATAL};
$unsatisfied{$prereq} = 'not installed';
} elsif ($pr_version < $self->{PREREQ_PM}->{$prereq} ){
- warn "Warning: prerequisite %s %s not found. We have %s.\n",
+ warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n",
$prereq, $self->{PREREQ_PM}{$prereq},
($pr_version || 'unknown version')
unless $self->{PREREQ_FATAL};
rename $self->{MAKEFILE}, "$self->{MAKEFILE}.old"
or warn "rename $self->{MAKEFILE} $self->{MAKEFILE}.old: $!"
if -f $self->{MAKEFILE};
- open MF, '>', $self->{MAKEFILE} or die "open $self->{MAKEFILE} for write: $!";
+ open MF, '>'.$self->{MAKEFILE} or die "open $self->{MAKEFILE} for write: $!";
print MF <<'EOP';
all:
}
sub _run_hintfile {
- our $self;
+ no strict 'vars';
local($self) = shift; # make $self available to the hint file.
my($hint_file) = shift;
# still trying to reduce the list to some reasonable minimum --
# because I want to make it easier for the user. A.K.
- no warnings 'redefine';
+ local $SIG{__WARN__} = sub {
+ # can't use 'no warnings redefined', 5.6 only
+ warn @_ unless $_[0] =~ /^Subroutine .* redefined/
+ };
foreach my $method (@Overridable) {
# We cannot say "next" here. Nick might call MY->makeaperl
sub flush {
my $self = shift;
my($chunk);
-# use FileHandle ();
-# my $fh = new FileHandle;
local *FH;
print STDOUT "Writing $self->{MAKEFILE} for $self->{NAME}\n";
unlink($self->{MAKEFILE}, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : '');
-# $fh->open(">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!";
open(FH,">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!";
for $chunk (@{$self->{RESULT}}) {
-# print $fh "$chunk\n";
print FH "$chunk\n";
}
-# $fh->close;
close FH;
my($finalname) = $self->{MAKEFILE};
rename("MakeMaker.tmp", $finalname);
=head2 make test
MakeMaker checks for the existence of a file named F<test.pl> in the
-current directory and if it exists it adds commands to the test target
-of the generated Makefile that will execute the script with the proper
-set of perl C<-I> options.
+current directory and if it exists it execute the script with the
+proper set of perl C<-I> options.
MakeMaker also checks for any files matching glob("t/*.t"). It will
-add commands to the test target of the generated Makefile that execute
-all matching files via the L<Test::Harness> module with the C<-I>
-switches set correctly.
+execute all matching files in alphabetical order via the
+L<Test::Harness> module with the C<-I> switches set correctly.
+
+If you'd like to see the raw output of your tests, set the
+C<TEST_VERBOSE> variable to true.
+
+ make test TEST_VERBOSE=1
=head2 make testdb
test under the Perl debugger (see L<perldebug>). If the file
F<test.pl> exists in the current directory, it is used for the test.
-If you want to debug some other testfile, set C<TEST_FILE> variable
+If you want to debug some other testfile, set the C<TEST_FILE> variable
thusly:
make testdb TEST_FILE=t/mytest.t
By default the debugger is called using C<-d> option to perl. If you
-want to specify some other option, set C<TESTDB_SW> variable:
+want to specify some other option, set the C<TESTDB_SW> variable:
make testdb TESTDB_SW=-Dx
INSTALLDIRS according to the following table:
INSTALLDIRS set to
- perl site
+ perl site vendor
- INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH
- INST_LIB INSTALLPRIVLIB INSTALLSITELIB
- INST_BIN INSTALLBIN
- INST_SCRIPT INSTALLSCRIPT
- INST_MAN1DIR INSTALLMAN1DIR
- INST_MAN3DIR INSTALLMAN3DIR
+ PREFIX SITEPREFIX VENDORPREFIX
+ INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
+ INST_LIB INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
+ INST_BIN INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
+ INST_SCRIPT INSTALLSCRIPT INSTALLSCRIPT INSTALLSCRIPT
+ INST_MAN1DIR INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR
+ INST_MAN3DIR INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR
The INSTALL... macros in turn default to their %Config
($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
=head2 Using Attributes and Parameters
-The following attributes can be specified as arguments to WriteMakefile()
-or as NAME=VALUE pairs on the command line:
+The following attributes may be specified as arguments to WriteMakefile()
+or as NAME=VALUE pairs on the command line.
=over 2
=item IMPORTS
This attribute is used to specify names to be imported into the
-extension. It is only used on OS/2 and Win32.
+extension. Takes a hash ref.
+
+It is only used on OS/2 and Win32.
=item INC
=item INSTALLBIN
-Directory to install binary files (e.g. tkperl) into.
+Directory to install binary files (e.g. tkperl) into if
+INSTALLDIRS=perl.
=item INSTALLDIRS
-Determines which of the two sets of installation directories to
-choose: installprivlib and installarchlib versus installsitelib and
-installsitearch. The first pair is chosen with INSTALLDIRS=perl, the
-second with INSTALLDIRS=site. Default is site.
+Determines which of the sets of installation directories to choose:
+perl, site or vendor. Defaults to site.
=item INSTALLMAN1DIR
-This directory gets the man pages at 'make install' time. Defaults to
-$Config{installman1dir}.
-
-If set to 'none', no man 1 pages will be installed.
-
=item INSTALLMAN3DIR
-This directory gets the man pages at 'make install' time. Defaults to
-$Config{installman3dir}.
+These directories get the man pages at 'make install' time if
+INSTALLDIRS=perl. Defaults to $Config{installman*dir}.
-If set to 'none', no man 3 pages will be installed.
+If set to 'none', no man pages will be installed.
=item INSTALLPRIVLIB
Used by 'make install', which copies files from INST_LIB to this
directory if INSTALLDIRS is set to perl.
+Defaults to $Config{installprivlib}.
+
=item INSTALLSCRIPT
Used by 'make install' which copies files from INST_SCRIPT to this
Used by 'make install', which copies files from INST_ARCHLIB to this
directory if INSTALLDIRS is set to site (default).
+=item INSTALLSITEBIN
+
+Used by 'make install', which copies files from INST_BIN to this
+directory if INSTALLDIRS is set to site (default).
+
=item INSTALLSITELIB
Used by 'make install', which copies files from INST_LIB to this
directory if INSTALLDIRS is set to site (default).
+=item INSTALLSITEMAN1DIR
+
+=item INSTALLSITEMAN3DIR
+
+These directories get the man pages at 'make install' time if
+INSTALLDIRS=site (default). Defaults to
+$(SITEPREFIX)/man/man$(MAN*EXT).
+
+If set to 'none', no man pages will be installed.
+
+=item INSTALLVENDORARCH
+
+Used by 'make install', which copies files from INST_ARCHLIB to this
+directory if INSTALLDIRS is set to vendor.
+
+=item INSTALLVENDORBIN
+
+Used by 'make install', which copies files from INST_BIN to this
+directory if INSTALLDIRS is set to vendor.
+
+=item INSTALLVENDORLIB
+
+Used by 'make install', which copies files from INST_LIB to this
+directory if INSTALLDIRS is set to vendor.
+
+=item INSTALLVENDORMAN1DIR
+
+=item INSTALLVENDORMAN3DIR
+
+These directories get the man pages at 'make install' time if
+INSTALLDIRS=vendor. Defaults to $(VENDORPREFIX)/man/man$(MAN*EXT).
+
+If set to 'none', no man pages will be installed.
+
=item INST_ARCHLIB
Same as INST_LIB for architecture dependent files.
testing. make install will copy the files in INST_SCRIPT to
INSTALLSCRIPT.
+=item LDDLFLAGS
+
+Any special flags that might need to be passed to ld to create a
+shared library suitable for dynamic loading. It is up to the makefile
+to use it. (See L<Config/lddlflags>)
+
+Defaults to $Config{lddlflags}.
+
=item LDFROM
-defaults to "$(OBJECT)" and is used in the ld command to specify
+Defaults to "$(OBJECT)" and is used in the ld command to specify
what files to link/load from (also see dynamic_lib below for how to
specify ld flags)
If you specify LIB or any INSTALL* variables they will not be effected
by the PREFIX.
-=item PREREQ_PM
-
-Hashref: Names of modules that need to be available to run this
-extension (e.g. Fcntl for SDBM_File) are the keys of the hash and the
-desired version is the value. If the required version number is 0, we
-only check if any version is installed already.
+Defaults to $Config{installprefixexp}.
=item PREREQ_FATAL
It is I<extremely> rare to have to use C<PREREQ_FATAL> at all!
+=item PREREQ_PM
+
+Hashref: Names of modules that need to be available to run this
+extension (e.g. Fcntl for SDBM_File) are the keys of the hash and the
+desired version is the value. If the required version number is 0, we
+only check if any version is installed already.
+
=item PREREQ_PRINT
Bool. If this parameter is true, the prerequisites will be printed to
perl(A::B)>=Vers1 perl(C::D)>=Vers2 ...
+=item SITEPREFIX
+
+Like PREFIX, but only for the site install locations.
+
+Defaults to PREFIX (if set) or $Config{siteprefixexp}. Perls prior to
+5.6.0 didn't have an explicit siteprefix in the Config. In those
+cases $Config{installprefix} will be used.
+
=item SKIP
Arrayref. E.g. [qw(name1 name2)] skip (do not write) sections of the
precedence, even if it isn't listed in TYPEMAPS. The default system
typemap has lowest precedence.
+=item VENDORPREFIX
+
+Like PREFIX, but only for the vendor install locations.
+
+Defaults to PREFIX (if set) or $Config{vendorprefixexp}
+
+=item VERBINST
+
+If true, make install will be verbose
+
=item VERSION
Your version number for distributing the package. This defaults to
$VERSION = '1.00';
*VERSION = \'1.01';
- ( $VERSION ) = '$Revision: 1.33 $ ' =~ /\$Revision:\s+([^\s]+)/;
+ ( $VERSION ) = '$Revision: 1.63 $ ' =~ /\$Revision:\s+([^\s]+)/;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
our $VERSION = 1.2.3; # new for perl5.6.0
MAKE_FRAG
}
+=head2 The End Of Cargo Cult Programming
+
+WriteMakefile() now does some basic sanity checks on its parameters to
+protect against typos and malformatted values. This means some things
+which happened to work in the past will now throw warnings and
+possibly produce internal errors.
+
+Some of the most common mistakes:
+
+=over 2
+
+=item C<<MAN3PODS => ' '>>
+
+This is commonly used to supress the creation of man pages. MAN3PODS
+takes a hash ref not a string, but the above worked by accident in old
+versions of MakeMaker.
+
+The correct code is C<<MAN3PODS => { }>>.
+
+=back
+
=head2 Hintsfile support