-package ExtUtils::MakeMaker::TieAtt;
-# this package will go away again, when we don't have modules around
-# anymore that import %att It ties an empty %att and records in which
-# object this %att was tied. FETCH and STORE return/store-to the
-# appropriate value from %$self
+BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatible with perl5.001m
-# the warndirectuse method warns if somebody calls MM->something. It
-# has nothing to do with the tie'd %att.
+package ExtUtils::MakeMaker;
-$Enough_limit = 5;
+$VERSION = "5.45";
+$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+$//;
-sub TIEHASH {
- bless { SECRETHASH => $_[1]};
-}
-sub FETCH {
- print "Warning (non-fatal): Importing of %att is depreciated [$_[1]]
- use \$self instead\n" unless ++$Enough>$Enough_limit;
- print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
- $_[0]->{SECRETHASH}->{$_[1]};
-}
-sub STORE {
- print "Warning (non-fatal): Importing of %att is depreciated [$_[1]][$_[2]]
- use \$self instead\n" unless ++$Enough>$Enough_limit;
- print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
- $_[0]->{SECRETHASH}->{$_[1]} = $_[2];
-}
+require Exporter;
+use Config;
+use Carp ();
+#use FileHandle ();
-sub FIRSTKEY {
- print "Warning (non-fatal): Importing of %att is depreciated [FIRSTKEY]
- use \$self instead\n" unless ++$Enough>$Enough_limit;
- print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit;
- each %{$_[0]->{SECRETHASH}};
-}
+use vars qw(
-sub NEXTKEY {
- each %{$_[0]->{SECRETHASH}};
-}
+ @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
-sub DESTROY {
-}
+ );
+# use strict;
+
+# &DynaLoader::mod2fname should be available to miniperl, thus
+# should be a pseudo-builtin (cmp. os2.c).
+#eval {require DynaLoader;};
+
+#
+# Set up the inheritance before we pull in the MM_* packages, because they
+# import variables and functions from here
+#
+@ISA = qw(Exporter);
+@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
+@EXPORT_OK = qw($VERSION &Version_check &neatvalue &mkbootstrap &mksymlists);
-sub warndirectuse {
- my($caller) = @_;
- return if $Enough>$Enough_limit;
- print STDOUT "Warning (non-fatal): Direct use of class methods depreciated; use\n";
- my($method) = $caller =~ /.*:(\w+)$/;
- print STDOUT
-' my $self = shift;
- local *', $method, ';
- $self->MM::', $method, "();
- instead\n";
- print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
- if ++$Enough==$Enough_limit;
+#
+# Dummy package MM inherits actual methods from OS-specific
+# default packages. We use this intermediate package so
+# MY::XYZ->func() can call MM->func() and get the proper
+# default routine without having to know under what OS
+# it's running.
+#
+@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist ExtUtils::MakeMaker];
+
+#
+# Setup dummy package:
+# MY exists for overriding methods to be defined within
+#
+{
+ package MY;
+ @MY::ISA = qw(MM);
+### sub AUTOLOAD { use Devel::Symdump; print Devel::Symdump->rnew->as_string; Carp::confess "hey why? $AUTOLOAD" }
+ package MM;
+ sub DESTROY {}
}
-package ExtUtils::MakeMaker::TieVersion;
-sub TIESCALAR { my $x = "5.00"; bless \$x }
-sub FETCH { ${$_[0]} }
-sub STORE { warn "You just tried to alter \$ExtUtils::MakeMaker::Version.
-Please check your Makefile.PL"; $_[1]; }
-sub DESTROY {}
+# "predeclare the package: we only load it via AUTOLOAD
+# but we have already mentioned it in @ISA
+package ExtUtils::Liblist;
package ExtUtils::MakeMaker;
+#
+# 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';
-# Last edited $Date: 1995/10/26 16:24:47 $ by Andreas Koenig
-
-# The tie will go away again inlater versions
-$ExtUtils::MakeMaker::Version = $ExtUtils::MakeMaker::VERSION;
-tie $ExtUtils::MakeMaker::Version, ExtUtils::MakeMaker::TieVersion;
-tie $ExtUtils::MakeMaker::VERSION, ExtUtils::MakeMaker::TieVersion;
+require ExtUtils::MM_Unix;
-$ExtUtils::MakeMaker::Version_OK = 4.13; # Makefiles older than $Version_OK will die
- # (Will be checked from MakeMaker version 4.13 onwards)
+if ($Is_VMS) {
+ require ExtUtils::MM_VMS;
+ require VMS::Filespec; # is a noop as long as we require it within MM_VMS
+}
+if ($Is_OS2) {
+ require ExtUtils::MM_OS2;
+}
+if ($Is_Mac) {
+ require ExtUtils::MM_MacOS;
+}
+if ($Is_Win32) {
+ require ExtUtils::MM_Win32;
+}
+if ($Is_Cygwin) {
+ require ExtUtils::MM_Cygwin;
+}
-# $Id: MakeMaker.pm,v 1.93 1995/10/26 16:24:47 k Exp $
+full_setup();
-use Config;
-use Carp;
-use Cwd;
-require Exporter;
-require ExtUtils::Manifest;
-require ExtUtils::Liblist;
-#use strict qw(refs);
+# The use of the Version_check target has been dropped between perl
+# 5.5.63 and 5.5.64. We must keep the subroutine for a while so that
+# old Makefiles can satisfy the Version_check target.
-eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail
- # with miniperl.
+sub Version_check {
+ my($checkversion) = @_;
+ die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.
+Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable
+changes in the meantime.
+Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n"
+ if $checkversion < $Version_OK;
+ printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v",
+ $checkversion, "Current Version is", $VERSION
+ unless $checkversion == $VERSION;
+}
-# print join "**\n**", "", %INC, "";
-%NORMAL_INC = %INC;
+sub warnhandler {
+ $_[0] =~ /^Use of uninitialized value/ && return;
+ $_[0] =~ /used only once/ && return;
+ $_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return;
+ warn @_;
+}
+sub WriteMakefile {
+ Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
+ local $SIG{__WARN__} = \&warnhandler;
+ my %att = @_;
+ MM->new(\%att)->flush;
+}
-@ISA = qw(Exporter);
-@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
-@EXPORT_OK = qw($Version $VERSION &Version_check
- &help &neatvalue &mkbootstrap &mksymlists
- %att ## Import of %att is depreciated, please use OO features!
-);
-
-$Is_VMS = $Config::Config{osname} eq 'VMS';
-require ExtUtils::MM_VMS if $Is_VMS;
-$Is_OS2 = $Config::Config{'osname'} =~ m|^os/?2$|i ;
-$ENV{EMXSHELL} = 'sh' if $Is_OS2; # to run `commands`
-
-$ExtUtils::MakeMaker::Verbose = 0;
-$^W=1;
-#$SIG{__DIE__} = sub { print @_, Carp::longmess(); die; };
-####$SIG{__WARN__} = sub { print Carp::longmess(); warn @_; };
-$SIG{__WARN__} = sub { $_[0] =~ /^Use of uninitialized value/ && return; };
+sub prompt ($;$) {
+ my($mess,$def)=@_;
+ $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe?
+ Carp::confess("prompt function called without an argument") unless defined $mess;
+ my $dispdef = defined $def ? "[$def] " : " ";
+ $def = defined $def ? $def : "";
+ my $ans;
+ local $|=1;
+ print "$mess $dispdef";
+ if ($ISA_TTY) {
+ chomp($ans = <STDIN>);
+ } else {
+ print "$def\n";
+ }
+ return ($ans ne '') ? $ans : $def;
+}
-# Setup dummy package:
-# MY exists for overriding methods to be defined within
-unshift(@MY::ISA, qw(MM));
+sub eval_in_subdirs {
+ my($self) = @_;
+ my($dir);
+ use Cwd 'cwd';
+ my $pwd = cwd();
-# Dummy package MM inherits actual methods from OS-specific
-# default packages. We use this intermediate package so
-# MY::XYZ->func() can call MM->func() and get the proper
-# default routine without having to know under what OS
-# it's running.
-#unshift(@MM::ISA, $Is_VMS ? qw(ExtUtils::MM_VMS MM_Unix) : qw(MM_Unix));
-unshift @MM::ISA, 'MM_Unix';
-unshift @MM::ISA, 'ExtUtils::MM_VMS' if $Is_VMS;
-unshift @MM::ISA, 'ExtUtils::MM_OS2' if $Is_OS2;
-push @MM::ISA, qw[ExtUtils::MakeMaker];
-
-
-@ExtUtils::MakeMaker::MM_Sections_spec = (
- post_initialize => {},
- const_config => {},
- constants => {},
- const_loadlibs => {},
- const_cccmd => {}, # the last but one addition here (CONST_CCCMD)
- tool_autosplit => {},
- tool_xsubpp => {},
- tools_other => {},
- dist => {},
- macro => {},
- post_constants => {},
- pasthru => {},
- c_o => {},
- xs_c => {},
- xs_o => {},
- top_targets => {}, # currently the last section that adds a key to $self (DIR_TARGET)
- linkext => {},
- dlsyms => {},
- dynamic => {},
- dynamic_bs => {},
- dynamic_lib => {},
- static => {},
- static_lib => {},
- installpm => {},
- manifypods => {},
- processPL => {},
- installbin => {},
- subdirs => {},
- clean => {},
- realclean => {},
- dist_basics => {},
- dist_core => {},
- dist_dir => {},
- dist_test => {},
- dist_ci => {},
- install => {},
- force => {},
- perldepend => {},
- makefile => {},
- staticmake => {}, # Sadly this defines more macros
- test => {},
- postamble => {}, # should always be last the user has hands on
- selfdocument => {}, # well, he may override it, but he won't do it
-);
-# looses section ordering
-%ExtUtils::MakeMaker::MM_Sections = @ExtUtils::MakeMaker::MM_Sections_spec;
-# keeps order
-@ExtUtils::MakeMaker::MM_Sections = grep(!ref, @ExtUtils::MakeMaker::MM_Sections_spec);
-
-%ExtUtils::MakeMaker::Recognized_Att_Keys = %ExtUtils::MakeMaker::MM_Sections; # All sections are valid keys.
-foreach(split(/\n/,attrib_help())){
- next unless m/^=item\s+(\w+)\s*$/;
- $ExtUtils::MakeMaker::Recognized_Att_Keys{$1} = $2;
- print "Attribute '$1' => '$2'\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
+ foreach $dir (@{$self->{DIR}}){
+ my($abs) = $self->catdir($pwd,$dir);
+ $self->eval_in_x($abs);
+ }
+ chdir $pwd;
}
-%ExtUtils::MakeMaker::Prepend_dot_dot = qw(
-INST_LIB 1 INST_ARCHLIB 1 INST_EXE 1 MAP_TARGET 1 INST_MAN1DIR 1 INST_MAN3DIR 1
-);
-$PACKNAME = "PACK000";
+sub eval_in_x {
+ 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;
+ if ($@) {
+# if ($@ =~ /prerequisites/) {
+# die "MakeMaker WARNING: $@";
+# } else {
+# warn "WARNING from evaluation of $dir/Makefile.PL: $@";
+# }
+ warn "WARNING from evaluation of $dir/Makefile.PL: $@";
+ }
+}
+
+sub full_setup {
+ $Verbose ||= 0;
+
+ # package name for the classes into which the first object will be blessed
+ $PACKNAME = "PACK000";
+
+ @Attrib_help = qw/
+
+ AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
+ C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS
+ EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE FULLPERL FUNCLIST H
+ HTMLLIBPODS HTMLSCRIPTPODS IMPORTS
+ INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLHTMLPRIVLIBDIR
+ INSTALLHTMLSCRIPTDIR INSTALLHTMLSITELIBDIR INSTALLMAN1DIR
+ INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
+ INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB
+ INST_HTMLLIBDIR INST_HTMLSCRIPTDIR
+ INST_MAN1DIR INST_MAN3DIR INST_SCRIPT 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
+ PERL_ARCHLIB PERL_LIB PERL_SRC PERM_RW PERM_RWX
+ PL_FILES PM PMLIBDIRS POLLUTE PPM_INSTALL_EXEC PPM_INSTALL_SCRIPT PREFIX
+ PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
+ XS_VERSION clean depend dist dynamic_lib linkext macro realclean
+ tool_autosplit
+ /;
+
+ # IMPORTS is used under OS/2 and Win32
+
+ # @Overridable is close to @MM_Sections but not identical. The
+ # order is important. Many subroutines declare macros. These
+ # depend on each other. Let's try to collect the macros up front,
+ # then pasthru, then the rules.
+
+ # MM_Sections are the sections we have to call explicitly
+ # in Overridable we have subroutines that are used indirectly
+
+
+ @MM_Sections =
+ qw(
+
+ post_initialize const_config constants tool_autosplit tool_xsubpp
+ tools_other dist macro depend cflags const_loadlibs const_cccmd
+ post_constants
+
+ pasthru
+
+ c_o xs_c xs_o top_targets linkext dlsyms dynamic dynamic_bs
+ dynamic_lib static static_lib htmlifypods manifypods processPL
+ installbin subdirs
+ clean realclean dist_basics dist_core dist_dir dist_test dist_ci
+ install force perldepend makefile staticmake test ppd
+
+ ); # loses section ordering
+
+ @Overridable = @MM_Sections;
+ push @Overridable, qw[
+
+ dir_target libscan makeaperl needs_linking perm_rw perm_rwx
+ subdir_x test_via_harness test_via_script
+
+ ];
+
+ push @MM_Sections, qw[
+
+ pm_to_blib selfdocument
+
+ ];
+
+ # Postamble needs to be the last that was always the case
+ push @MM_Sections, "postamble";
+ push @Overridable, "postamble";
+
+ # All sections are valid keys.
+ @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections;
+
+ # we will use all these variables in the Makefile
+ @Get_from_Config =
+ qw(
+ ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc
+ lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so
+ exe_ext full_ar
+ );
+
+ my $item;
+ foreach $item (@Attrib_help){
+ $Recognized_Att_Keys{$item} = 1;
+ }
+ foreach $item (@Get_from_Config) {
+ $Recognized_Att_Keys{uc $item} = $Config{$item};
+ print "Attribute '\U$item\E' => '$Config{$item}'\n"
+ if ($Verbose >= 2);
+ }
+
+ #
+ # When we eval a Makefile.PL in a subdirectory, that one will ask
+ # us (the parent) for the values and will prepend "..", so that
+ # all files to be installed end up below OUR ./blib
+ #
+ %Prepend_dot_dot =
+ qw(
+
+ INST_BIN 1 INST_EXE 1 INST_LIB 1 INST_ARCHLIB 1 INST_SCRIPT 1
+ MAP_TARGET 1 INST_HTMLLIBDIR 1 INST_HTMLSCRIPTDIR 1
+ INST_MAN1DIR 1 INST_MAN3DIR 1 PERL_SRC 1 PERL 1 FULLPERL 1
+
+ );
+
+ my @keep = qw/
+ NEEDS_LINKING HAS_LINK_CODE
+ /;
+ @Keep_after_flush{@keep} = (1) x @keep;
+}
sub writeMakefile {
die <<END;
subroutine "writeMakefile" is called, and this subroutine is not
supported anymore since about October 1994.
-Please contact the author or ask archie for a more recent version of
-the extension. If you're really desperate, you can try to change the
-subroutine name from writeMakefile to WriteMakefile and rerun 'perl
-akefile.PL', but you're most probably left alone, when you do so.
+Please contact the author or look into CPAN (details about CPAN can be
+found in the FAQ and at http:/www.perl.com) for a more recent version
+of the extension. If you're really desperate, you can try to change
+the subroutine name from writeMakefile to WriteMakefile and rerun
+'perl Makefile.PL', but you're most probably left alone, when you do
+so.
The MakeMaker team
END
}
-sub WriteMakefile {
- Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
- my %att = @_;
- MM->new(\%att)->flush;
-}
-
-sub new {
+sub ExtUtils::MakeMaker::new {
my($class,$self) = @_;
my($key);
- print STDOUT "MakeMaker (v$ExtUtils::MakeMaker::VERSION)\n" if $ExtUtils::MakeMaker::Verbose;
+ print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
if (-f "MANIFEST" && ! -f "Makefile"){
check_manifest();
}
- check_hints();
-
$self = {} unless (defined $self);
+ check_hints($self);
+
my(%initial_att) = %$self; # record initial attributes
+ my($prereq);
+ foreach $prereq (sort keys %{$self->{PREREQ_PM}}) {
+ my $eval = "require $prereq";
+ eval $eval;
+
+ if ($@) {
+ warn "Warning: prerequisite $prereq failed to load: $@";
+ }
+ elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){
+ warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found";
+# Why is/was this 'delete' here? We need PREREQ_PM later to make PPDs.
+# } else {
+# delete $self->{PREREQ_PM}{$prereq};
+ }
+ }
+# if (@unsatisfied){
+# unless (defined $ExtUtils::MakeMaker::useCPAN) {
+# print qq{MakeMaker WARNING: prerequisites not found (@unsatisfied)
+# Please install these modules first and rerun 'perl Makefile.PL'.\n};
+# if ($ExtUtils::MakeMaker::hasCPAN) {
+# $ExtUtils::MakeMaker::useCPAN = prompt(qq{Should I try to use the CPAN module to fetch them for you?},"yes");
+# } else {
+# print qq{Hint: You may want to install the CPAN module to autofetch the needed modules\n};
+# $ExtUtils::MakeMaker::useCPAN=0;
+# }
+# }
+# if ($ExtUtils::MakeMaker::useCPAN) {
+# require CPAN;
+# CPAN->import(@unsatisfied);
+# } else {
+# die qq{prerequisites not found (@unsatisfied)};
+# }
+# warn qq{WARNING: prerequisites not found (@unsatisfied)};
+# }
+
if (defined $self->{CONFIGURE}) {
if (ref $self->{CONFIGURE} eq 'CODE') {
$self = { %$self, %{&{$self->{CONFIGURE}}}};
} else {
- croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
+ Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
}
}
# This is for old Makefiles written pre 5.00, will go away
if ( Carp::longmess("") =~ /runsubdirpl/s ){
- $self->{Correct_relativ_directories}++;
- } else {
- $self->{Correct_relativ_directories}=0;
+ Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
}
- my $class = ++$PACKNAME;
+ my $newclass = ++$PACKNAME;
+ local @Parent = @Parent; # Protect against non-local exits
{
# no strict;
- print "Blessing Object into class [$class]\n" if $ExtUtils::MakeMaker::Verbose;
- mv_all_methods("MY",$class);
- bless $self, $class;
-######## tie %::att, ExtUtils::MakeMaker::TieAtt, $self;
- push @ExtUtils::MakeMaker::Parent, $self;
- @{"$class\:\:ISA"} = 'MM';
+ print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
+ mv_all_methods("MY",$newclass);
+ bless $self, $newclass;
+ push @Parent, $self;
+ @{"$newclass\:\:ISA"} = 'MM';
}
- if (defined $ExtUtils::MakeMaker::Parent[-2]){
- $self->{PARENT} = $ExtUtils::MakeMaker::Parent[-2];
+ if (defined $Parent[-2]){
+ $self->{PARENT} = $Parent[-2];
my $key;
- for $key (keys %ExtUtils::MakeMaker::Prepend_dot_dot) {
+ for $key (keys %Prepend_dot_dot) {
+ next unless defined $self->{PARENT}{$key};
$self->{$key} = $self->{PARENT}{$key};
+ # PERL and FULLPERL may be command verbs instead of full
+ # file specifications under VMS. If so, don't turn them
+ # into a filespec.
$self->{$key} = $self->catdir("..",$self->{$key})
- unless $self->{$key} =~ m!^/!;
+ unless $self->file_name_is_absolute($self->{$key})
+ || ($^O eq 'VMS' and ($key =~ /PERL$/ && $self->{$key} =~ /^[\w\-\$]+$/));
+ }
+ if ($self->{PARENT}) {
+ $self->{PARENT}->{CHILDREN}->{$newclass} = $self;
+ foreach my $opt (qw(CAPI POLLUTE)) {
+ if (exists $self->{PARENT}->{$opt}
+ and not exists $self->{$opt})
+ {
+ # inherit, but only if already unspecified
+ $self->{$opt} = $self->{PARENT}->{$opt};
+ }
+ }
}
- $self->{PARENT}->{CHILDREN}->{$class} = $self if $self->{PARENT};
} else {
- parse_args($self,@ARGV);
+ parse_args($self,split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV);
}
$self->{NAME} ||= $self->guess_name;
$self->init_main();
- if (! $self->{PERL_SRC} &&
- $INC{'Config.pm'} ne $self->catdir($Config::Config{archlibexp},'Config.pm')){
- (my $pthinks = $INC{'Config.pm'}) =~ s!/Config\.pm$!!;
- $pthinks =~ s!.*/!!;
- print STDOUT <<END;
+ if (! $self->{PERL_SRC} ) {
+ my($pthinks) = $self->canonpath($INC{'Config.pm'});
+ my($cthinks) = $self->catfile($Config{'archlibexp'},'Config.pm');
+ $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS;
+ if ($pthinks ne $cthinks &&
+ !($Is_Win32 and lc($pthinks) eq lc($cthinks))) {
+ print "Have $pthinks expected $cthinks\n";
+ if ($Is_Win32) {
+ $pthinks =~ s![/\\]Config\.pm$!!i; $pthinks =~ s!.*[/\\]!!;
+ }
+ else {
+ $pthinks =~ s!/Config\.pm$!!; $pthinks =~ s!.*/!!;
+ }
+ print STDOUT <<END unless $self->{UNINSTALLED_PERL};
Your perl and your Config.pm seem to have different ideas about the architecture
they are running on.
Perl thinks: [$pthinks]
-Config says: [$Config::Config{archname}]
+Config says: [$Config{archname}]
This may or may not cause problems. Please check your installation of perl if you
have problems building this extension.
END
+ }
}
$self->init_dirscan();
$self->init_others();
+ my($argv) = neatvalue(\@ARGV);
+ $argv =~ s/^\[/(/;
+ $argv =~ s/\]$/)/;
push @{$self->{RESULT}}, <<END;
# This Makefile is for the $self->{NAME} extension to perl.
#
-# It was generated automatically by MakeMaker version $ExtUtils::MakeMaker::VERSION from the contents
-# of Makefile.PL. Don't edit this file, edit Makefile.PL instead.
+# It was generated automatically by MakeMaker version
+# $VERSION (Revision: $Revision) from the contents of
+# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
# ANY CHANGES MADE HERE WILL BE LOST!
#
+# MakeMaker ARGV: $argv
+#
# MakeMaker Parameters:
END
for $skip (@{$self->{SKIP} || []}) {
$self->{SKIPHASH}{$skip} = 1;
}
+ delete $self->{SKIP}; # free memory
+
+ if ($self->{PARENT}) {
+ for (qw/install dist dist_basics dist_core dist_dir dist_test dist_ci/) {
+ $self->{SKIPHASH}{$_} = 1;
+ }
+ }
# We run all the subdirectories now. They don't have much to query
# from the parent, but the parent has to query them: if they need linking!
- my($dir);
unless ($self->{NORECURS}) {
- foreach $dir (@{$self->{DIR}}){
- chdir $dir;
- local *FH;
- open FH, "Makefile.PL";
- eval join "", <FH>;
- close FH;
- chdir "..";
- }
+ $self->eval_in_subdirs if @{$self->{DIR}};
}
- tie %::att, ExtUtils::MakeMaker::TieAtt, $self;
my $section;
- foreach $section ( @ExtUtils::MakeMaker::MM_Sections ){
- print "Processing Makefile '$section' section\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
+ foreach $section ( @MM_Sections ){
+ print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
my($skipit) = $self->skipcheck($section);
if ($skipit){
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
- } else { # MEMO: b 329 print "$self->{NAME}**$section**\n" and $section eq 'postamble'
+ } else {
my(%a) = %{$self->{$section} || {}};
push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
- push @{$self->{RESULT}}, "# " . join ", ", %a if $ExtUtils::MakeMaker::Verbose && %a;
+ push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
push @{$self->{RESULT}}, $self->nicetext($self->$section( %a ));
}
}
push @{$self->{RESULT}}, "\n# End.";
-######## untie %::att;
- pop @ExtUtils::MakeMaker::Parent;
$self;
}
+sub WriteEmptyMakefile {
+ if (-f 'Makefile.old') {
+ chmod 0666, 'Makefile.old';
+ unlink 'Makefile.old' or warn "unlink Makefile.old: $!";
+ }
+ rename 'Makefile', 'Makefile.old' or warn "rename Makefile Makefile.old: $!"
+ if -f 'Makefile';
+ open MF, '> Makefile' or die "open Makefile for write: $!";
+ print MF <<'EOP';
+all:
+
+clean:
+
+install:
+
+makemakerdflt:
+
+test:
+
+EOP
+ close MF or die "close Makefile for write: $!";
+}
+
sub check_manifest {
- eval {require ExtUtils::Manifest};
- if ($@){
- print STDOUT "Warning: you have not installed the ExtUtils::Manifest
- module -- skipping check of the MANIFEST file\n";
+ 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){
+ print STDOUT "Warning: the following files are missing in your kit:\n";
+ print "\t", join "\n\t", @missed;
+ print STDOUT "\n";
+ print STDOUT "Please inform the author.\n";
} else {
- print STDOUT "Checking if your kit is complete...\n";
- $ExtUtils::Manifest::Quiet=$ExtUtils::Manifest::Quiet=1; #avoid warning
- 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";
- print STDOUT "Please inform the author.\n";
- } else {
- print STDOUT "Looks good\n";
- }
+ print STDOUT "Looks good\n";
}
}
foreach (@args){
unless (m/(.*?)=(.*)/){
help(),exit 1 if m/^help$/;
- ++$ExtUtils::MakeMaker::Verbose if m/^verb/;
+ ++$Verbose if m/^verb/;
next;
}
my($name, $value) = ($1, $2);
if ($value =~ m/^~(\w+)?/){ # tilde with optional username
$value =~ s [^~(\w*)]
- [$1 ?
- ((getpwnam($1))[7] || "~$1") :
+ [$1 ?
+ ((getpwnam($1))[7] || "~$1") :
(getpwuid($>))[7]
]ex;
}
- # This will go away:
- if ($self->{Correct_relativ_directories}){
- $value = $self->catdir("..",$value)
- if $ExtUtils::MakeMaker::Prepend_dot_dot{$name} &&! $value =~ m!^/!;
- }
- $self->{$name} = $value;
+ $self->{uc($name)} = $value;
}
- delete $self->{Correct_relativ_directories};
# catch old-style 'potential_libs' and inform user how to 'upgrade'
if (defined $self->{potential_libs}){
$self->{LDFROM} = $self->{LDTARGET};
delete $self->{LDTARGET};
}
+ # Turn a DIR argument on the command line into an array
+ if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') {
+ # So they can choose from the command line, which extensions they want
+ # the grep enables them to have some colons too much in case they
+ # have to build a list with the shell
+ $self->{DIR} = [grep $_, split ":", $self->{DIR}];
+ }
+ # Turn a INCLUDE_EXT argument on the command line into an array
+ if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') {
+ $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}];
+ }
+ # Turn a EXCLUDE_EXT argument on the command line into an array
+ 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){
- print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $ExtUtils::MakeMaker::Verbose;
+ print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n"
- unless exists $ExtUtils::MakeMaker::Recognized_Att_Keys{$mmkey};
+ unless exists $Recognized_Att_Keys{$mmkey};
}
+ $| = 1 if $Verbose;
}
sub check_hints {
# First we look for the best hintsfile we have
my(@goodhints);
- my($hint)="$Config::Config{osname}_$Config::Config{osvers}";
+ my($hint)="${^O}_$Config{osvers}";
$hint =~ s/\./_/g;
$hint =~ s/_$//;
return unless $hint;
return unless -f "hints/$hint.pl"; # really there
# execute the hintsfile:
- open HINTS, "hints/$hint.pl";
- @goodhints = <HINTS>;
- close HINTS;
+# 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);
print STDOUT $@ if $@;
sub mv_all_methods {
my($from,$to) = @_;
my($method);
+ my($symtab) = \%{"${from}::"};
# no strict;
- foreach $method (@ExtUtils::MakeMaker::MM_Sections, qw[ dir_target exescan extliblist
-fileparse fileparse_set_fstype init_dirscan init_main init_others
-installpm_x libscan makeaperl mksymlists needs_linking runsubdirpl
-subdir_x test_via_harness test_via_script writedoc ]) {
+ # 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) {
# We cannot say "next" here. Nick might call MY->makeaperl
# which isn't defined right now
- # next unless defined &{"${from}::$method"};
+ # Above statement was written at 4.23 time when Tk-b8 was
+ # around. As Tk-b9 only builds with 5.002something and MM 5 is
+ # standard, we try to enable the next line again. It was
+ # commented out until MM 5.23
+
+ next unless defined &{"${from}::$method"};
*{"${to}::$method"} = \&{"${from}::$method"};
- my $symtab = \%{"${from}::"};
# delete would do, if we were sure, nobody ever called
# MY->makeaperl directly
-
+
# delete $symtab->{$method};
-
+
# If we delete a method, then it will be undefined and cannot
# be called. But as long as we have Makefile.PLs that rely on
# %MY:: being intact, we have to fill the hole with an
# inheriting method:
- eval "package MY; sub $method {local *$method; shift->MY::$method(\@_); }";
-
- }
+ eval "package MY; sub $method { shift->SUPER::$method(\@_); }";
+ }
# We have to clean out %INC also, because the current directory is
# changed frequently and Graham Barr prefers to get his version
# out of a History.pl file which is "required" so woudn't get
# loaded again in another extension requiring a History.pl
- my $inc;
- foreach $inc (keys %INC) {
- next if $ExtUtils::MakeMaker::NORMAL_INC{$inc};
- #warn "***$inc*** deleted";
- delete $INC{$inc};
- }
-
-}
-
-sub prompt {
- my($mess,$def)=@_;
- local $|=1;
- die "prompt function called without an argument" unless defined $mess;
- $def = "" unless defined $def;
- my $dispdef = "[$def] ";
- print "$mess $dispdef";
- chop(my $ans = <STDIN>);
- $ans || $def;
-}
+ # With perl5.002_01 the deletion of entries in %INC caused Tk-b11
+ # to core dump in the middle of a require statement. The required
+ # file was Tk/MMutil.pm. The consequence is, we have to be
+ # extremely careful when we try to give perl a reason to reload a
+ # library with same name. The workaround prefers to drop nothing
+ # from %INC and teach the writers not to use such libraries.
-sub attrib_help {
- return $Attrib_Help if $Attrib_Help;
- my $switch = 0;
- my $help;
- my $line;
- local *POD;
-#### local $/ = ""; # bug in 5.001m
- open POD, $INC{"ExtUtils/MakeMaker.pm"}
- or die "Open $INC{'ExtUtils/MakeMaker.pm'}: $!";
- while ($line = <POD>) {
- $switch ||= $line =~ /^=item NAME\s*$/;
- next unless $switch;
- last if $line =~ /^=cut/;
- $help .= $line;
- }
- close POD;
- $Attrib_Help = $help;
+# my $inc;
+# foreach $inc (keys %INC) {
+# #warn "***$inc*** deleted";
+# delete $INC{$inc};
+# }
}
-sub help {print &attrib_help, "\n";}
-
-sub skipcheck{
+sub skipcheck {
my($self) = shift;
my($section) = @_;
if ($section eq 'dynamic') {
print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
"in skipped section 'dynamic_bs'\n"
- if $self->{SKIPHASH}{dynamic_bs} && $ExtUtils::MakeMaker::Verbose;
+ if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
"in skipped section 'dynamic_lib'\n"
- if $self->{SKIPHASH}{dynamic_lib} && $ExtUtils::MakeMaker::Verbose;
+ if $self->{SKIPHASH}{dynamic_lib} && $Verbose;
}
if ($section eq 'dynamic_lib') {
print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
"targets in skipped section 'dynamic_bs'\n"
- if $self->{SKIPHASH}{dynamic_bs} && $ExtUtils::MakeMaker::Verbose;
+ if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
}
if ($section eq 'static') {
print STDOUT "Warning (non-fatal): Target 'static' depends on targets ",
"in skipped section 'static_lib'\n"
- if $self->{SKIPHASH}{static_lib} && $ExtUtils::MakeMaker::Verbose;
+ if $self->{SKIPHASH}{static_lib} && $Verbose;
}
return 'skipped' if $self->{SKIPHASH}{$section};
return '';
sub flush {
my $self = shift;
my($chunk);
- local *MAKE;
+# 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' : '');
- open MAKE, ">MakeMaker.tmp" or die "Unable to open MakeMaker.tmp: $!";
+# $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 MAKE "$chunk\n";
+# print $fh "$chunk\n";
+ print FH "$chunk\n";
}
- close MAKE;
- my($finalname) = $Is_VMS ? "Descrip.MMS" : $self->{MAKEFILE};
+# $fh->close;
+ close FH;
+ my($finalname) = $self->{MAKEFILE};
rename("MakeMaker.tmp", $finalname);
- chmod 0644, $finalname;
- system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":";
-}
+ chmod 0644, $finalname unless $Is_VMS;
-sub Version_check {
- my($checkversion) = @_;
- die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.
-Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable
-changes in the meantime.
-Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n"
- if $checkversion < $ExtUtils::MakeMaker::Version_OK;
- printf STDOUT "%s %.2f %s %.2f.\n", "Makefile built with ExtUtils::MakeMaker v",
- $checkversion, "Current Version is", $ExtUtils::MakeMaker::VERSION
- unless $checkversion == $ExtUtils::MakeMaker::VERSION;
-}
+ if ($self->{PARENT}) {
+ foreach (keys %$self) { # safe memory
+ delete $self->{$_} unless $Keep_after_flush{$_};
+ }
+ }
-sub mksymlists {
- my $class = shift;
- my $self = shift;
- bless $self, $class;
- tie %att, ExtUtils::MakeMaker::TieAtt, $self;
- $self->parse_args(@ARGV);
- $self->mksymlists(@_);
+ system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":";
}
# The following mkbootstrap() is only for installations that are calling
END
}
+# Ditto for mksymlists() as of MakeMaker 5.17
+sub mksymlists {
+ die <<END;
+!!! Your Makefile has been built such a long time ago, !!!
+!!! that is unlikely to work with current MakeMaker. !!!
+!!! Please rebuild your Makefile !!!
+END
+}
+
sub neatvalue {
my($v) = @_;
return "undef" unless defined $v;
my($t) = ref $v;
- return "'$v'" unless $t;
+ return "q[$v]" unless $t;
if ($t eq 'ARRAY') {
my(@m, $elem, @neat);
push @m, "[";
foreach $elem (@$v) {
- push @neat, "'$elem'";
+ push @neat, "q[$elem]";
}
push @m, join ", ", @neat;
push @m, "]";
}
return "$v" unless $t eq 'HASH';
my(@m, $key, $val);
- push(@m,"$key=>".neatvalue($val)) while (($key,$val) = each %$v);
+ while (($key,$val) = each %$v){
+ last unless defined $key; # cautious programming in case (undef,undef) is true
+ push(@m,"$key=>".neatvalue($val)) ;
+ }
return "{ ".join(', ',@m)." }";
}
sub selfdocument {
my($self) = @_;
my(@m);
- if ($ExtUtils::MakeMaker::Verbose){
+ if ($Verbose){
push @m, "\n# Full list of MakeMaker attribute values:";
foreach $key (sort keys %$self){
next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
join "\n", @m;
}
+package ExtUtils::MakeMaker;
+1;
- # # # # # #
- ## ## ## ## # # # # # # #
- # # # # # # # # # # ## # # # #
- # # # # # # # # # # # # ##
- # # # # # # # # # # ##
- # # # # # # # ## # # #
- # # # # ####### ##### # # # # #
+__END__
-package MM_Unix;
+=head1 NAME
-use Config;
-use Cwd;
-use File::Basename;
-require Exporter;
+ExtUtils::MakeMaker - create an extension Makefile
-Exporter::import('ExtUtils::MakeMaker',
- qw( $Verbose));
+=head1 SYNOPSIS
-# These attributes cannot be overridden externally
-@Other_Att_Keys{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)} = (1) x 3;
+C<use ExtUtils::MakeMaker;>
-if ($Is_VMS = $Config::Config{osname} eq 'VMS') {
- require VMS::Filespec;
- import VMS::Filespec 'vmsify';
-}
+C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );>
-$Is_OS2 = $ExtUtils::MakeMaker::Is_OS2;
+which is really
-sub guess_name { # Charles! That's something for MM_VMS
- my($self) = @_;
- my $name = fastcwd();
- if ($Is_VMS) {
- $name =~ s:.*?([^.\]]+)\]:$1: unless ($name =~ s:.*[.\[]ext\.(.*)\]:$1:i);
- $name =~ s#[.\]]#::#g;
- } else {
- $name =~ s:.*/:: unless ($name =~ s:^.*/ext/::);
- $name =~ s#/#::#g;
- $name =~ s#\-\d+\.\d+$##; # this is new with MM 5.00
- }
- $name;
-}
+C<MM-E<gt>new(\%att)-E<gt>flush;>
-sub init_main {
- my($self) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
+=head1 DESCRIPTION
- # --- Initialize Module Name and Paths
+This utility is designed to write a Makefile for an extension module
+from a Makefile.PL. It is based on the Makefile.SH model provided by
+Andy Dougherty and the perl5-porters.
- # NAME = The perl module name for this extension (eg DBD::Oracle).
- # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
- # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
- # ROOTEXT = Directory part of FULLEXT with leading /.
- ($self->{FULLEXT} =
- $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
+It splits the task of generating the Makefile into several subroutines
+that can be individually overridden. Each subroutine returns the text
+it wishes to have written to the Makefile.
- # Copied from DynaLoader:
+MakeMaker is object oriented. Each directory below the current
+directory that contains a Makefile.PL. Is treated as a separate
+object. This makes it possible to write an unlimited number of
+Makefiles with a single invocation of WriteMakefile().
- my(@modparts) = split(/::/,$self->{NAME});
- my($modfname) = $modparts[-1];
+=head2 How To Write A Makefile.PL
- # Some systems have restrictions on files names for DLL's etc.
- # mod2fname returns appropriate file base name (typically truncated)
- # It may also edit @modparts if required.
- if (defined &DynaLoader::mod2fname) {
- $modfname = &DynaLoader::mod2fname(\@modparts);
- } elsif ($Is_OS2) { # Need manual correction if run with miniperl:-(
- $modfname = substr($modfname, 0, 7) . '_';
- }
+The short answer is: Don't.
+ Always begin with h2xs.
+ Always begin with h2xs!
+ ALWAYS BEGIN WITH H2XS!
- ($self->{BASEEXT} =
- $self->{NAME}) =~ s!.*::!! ; #eg. Socket
+even if you're not building around a header file, and even if you
+don't have an XS component.
- if (defined &DynaLoader::mod2fname or $Is_OS2) {
- # As of 5.001m, dl_os2 appends '_'
- $self->{DLBASE} = $modfname; #eg. Socket_
- } else {
- $self->{DLBASE} = '$(BASEEXT)';
- }
+Run h2xs(1) before you start thinking about writing a module. For so
+called pm-only modules that consist of C<*.pm> files only, h2xs has
+the C<-X> switch. This will generate dummy files of all kinds that are
+useful for the module developer.
- ($self->{ROOTEXT} =
- $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo
+The medium answer is:
- $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT};
+ use ExtUtils::MakeMaker;
+ WriteMakefile( NAME => "Foo::Bar" );
+The long answer is the rest of the manpage :-)
- # --- Initialize PERL_LIB, INST_LIB, PERL_SRC
+=head2 Default Makefile Behaviour
- # *Real* information: where did we get these two from? ...
- my $inc_config_dir = dirname($INC{'Config.pm'});
- my $inc_carp_dir = dirname($INC{'Carp.pm'});
+The generated Makefile enables the user of the extension to invoke
- # Typically PERL_* and INST_* will be identical but that need
- # not be the case (e.g., installing into project libraries etc).
+ perl Makefile.PL # optionally "perl Makefile.PL verbose"
+ make
+ make test # optionally set TEST_VERBOSE=1
+ make install # See below
- # Perl Macro: With source No source
- # PERL_LIB ../../lib /usr/local/lib/perl5
- # PERL_ARCHLIB ../../lib /usr/local/lib/perl5/sun4-sunos
- # PERL_SRC ../.. (undefined)
+The Makefile to be produced may be altered by adding arguments of the
+form C<KEY=VALUE>. E.g.
- # INST Macro: For standard for any other
- # modules module
- # INST_LIB ../../lib ./blib
- # INST_ARCHLIB ../../lib ./blib/<archname>
+ perl Makefile.PL PREFIX=/tmp/myperl5
- unless ($self->{PERL_SRC}){
- my($dir);
- foreach $dir (qw(../.. ../../.. ../../../..)){
- if ( -f "$dir/config.sh"
- && -f "$dir/perl.h"
- && -f "$dir/lib/Exporter.pm") {
- $self->{PERL_SRC}=$dir ;
- last;
- }
- }
- }
- if ($self->{PERL_SRC}){
- $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
- $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
- $self->{PERL_INC} = $self->{PERL_SRC};
- # catch an situation that has occurred a few times in the past:
- warn <<EOM unless -s "$self->{PERL_SRC}/cflags";
-You cannot build extensions below the perl source tree after executing
-a 'make clean' in the perl source tree.
-
-To rebuild extensions distributed with the perl source you should
-simply Configure (to include those extensions) and then build perl as
-normal. After installing perl the source tree can be deleted. It is not
-needed for building extensions.
-
-It is recommended that you unpack and build additional extensions away
-from the perl source tree.
-EOM
- } else {
- # we should also consider $ENV{PERL5LIB} here
- $self->{PERL_LIB} = $Config::Config{privlibexp} unless $self->{PERL_LIB};
- $self->{PERL_ARCHLIB} = $Config::Config{archlibexp} unless $self->{PERL_ARCHLIB};
- $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
- my $perl_h;
- die <<EOM unless (-f ($perl_h = $self->catfile("$self->{PERL_INC}","perl.h")));
-Error: Unable to locate installed Perl libraries or Perl source code.
+Other interesting targets in the generated Makefile are
-It is recommended that you install perl in a standard location before
-building extensions. You can say:
+ make config # to check if the Makefile is up-to-date
+ make clean # delete local temp files (Makefile gets renamed)
+ make realclean # delete derived files (including ./blib)
+ make ci # check in all the files in the MANIFEST file
+ make dist # see below the Distribution Support section
- $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
+=head2 make test
-if you have not yet installed perl but still want to build this
-extension now.
-(You get this message, because MakeMaker could not find "$perl_h")
-EOM
+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.
-# print STDOUT "Using header files found in $self->{PERL_INC}\n"
-# if $Verbose && $self->needs_linking();
+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.
- }
+=head2 make testdb
- # INST_LIB typically pre-set if building an extension after
- # perl has been built and installed. Setting INST_LIB allows
- # you to build directly into, say $Config::Config{privlibexp}.
- unless ($self->{INST_LIB}){
- if (defined $self->{PERL_SRC}) {
- $self->{INST_LIB} = $self->{PERL_LIB};
- } else {
- $self->{INST_LIB} = $self->catdir(".","blib");
- }
- }
- # Try to work out what INST_ARCHLIB should be if not set:
- unless ($self->{INST_ARCHLIB}){
- my(%archmap) = (
- $self->catdir(".","blib") => $self->catdir(".","blib",$Config::Config{archname}), # our private build lib
- $self->{PERL_LIB} => $self->{PERL_ARCHLIB},
- $Config::Config{privlibexp} => $Config::Config{archlibexp},
- $inc_carp_dir => $inc_config_dir,
- );
- $self->{INST_ARCHLIB} = $archmap{$self->{INST_LIB}};
- unless($self->{INST_ARCHLIB}){
- # Oh dear, we'll have to default it and warn the user
- my($archname) = $Config::Config{archname};
- if (-d "$self->{INST_LIB}/$archname"){
- $self->{INST_ARCHLIB} = $self->catdir("$self->{INST_LIB}","$archname");
- print STDOUT "Defaulting INST_ARCHLIB to $self->{INST_ARCHLIB}\n";
- } else {
- $self->{INST_ARCHLIB} = $self->{INST_LIB};
- }
- }
- }
- $self->{INST_EXE} ||= $self->catdir('.','blib',$Config::Config{archname});
+A useful variation of the above is the target C<testdb>. It runs the
+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 ($self->{PREFIX}){
- $self->{INSTALLPRIVLIB} = $self->catdir($self->{PREFIX},"lib","perl5");
- $self->{INSTALLBIN} = $self->catdir($self->{PREFIX},"bin");
- $self->{INSTALLMAN1DIR} = $self->catdir($self->{PREFIX},"perl5","man","man1");
- $self->{INSTALLMAN3DIR} = $self->catdir($self->{PREFIX},"perl5","man","man3");
- }
+If you want to debug some other testfile, set C<TEST_FILE> variable
+thusly:
- if( $self->{INSTALLPRIVLIB} && ! $self->{INSTALLARCHLIB} ){
- my($archname) = $Config::Config{archname};
- if (-d $self->catdir($self->{INSTALLPRIVLIB},$archname)){
- $self->{INSTALLARCHLIB} = $self->catdir($self->{INSTALLPRIVLIB},$archname);
- print STDOUT "Defaulting INSTALLARCHLIB to $self->{INSTALLARCHLIB}\n";
- } else {
- $self->{INSTALLARCHLIB} = $self->{INSTALLPRIVLIB};
- }
- }
- $self->{INSTALLPRIVLIB} ||= $Config::Config{installprivlib};
- $self->{INSTALLARCHLIB} ||= $Config::Config{installarchlib};
- $self->{INSTALLBIN} ||= $Config::Config{installbin};
+ make testdb TEST_FILE=t/mytest.t
- $self->{INST_MAN1DIR} ||= $self->catdir('.','blib','man','man1');
- $self->{INSTALLMAN1DIR} ||= $Config::Config{installman1dir};
- $self->{MAN1EXT} ||= $Config::Config{man1ext};
+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:
- $self->{INST_MAN3DIR} ||= $self->catdir('.','blib','man','man3');
- $self->{INSTALLMAN3DIR} ||= $Config::Config{installman3dir};
- $self->{MAN3EXT} ||= $Config::Config{man3ext};
+ make testdb TESTDB_SW=-Dx
- $self->{MAP_TARGET} = "perl" unless $self->{MAP_TARGET};
+=head2 make install
- $self->{LIB_EXT} = $Config::Config{lib_ext} || "a";
- $self->{OBJ_EXT} = $Config::Config{obj_ext} || "o";
- $self->{AR} = $Config::Config{ar} || "ar";
+make alone puts all relevant files into directories that are named by
+the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_HTMLLIBDIR,
+INST_HTMLSCRIPTDIR, INST_MAN1DIR, and INST_MAN3DIR. All these default
+to something below ./blib if you are I<not> building below the perl
+source directory. If you I<are> building below the perl source,
+INST_LIB and INST_ARCHLIB default to ../../lib, and INST_SCRIPT is not
+defined.
+
+The I<install> target of the generated Makefile copies the files found
+below each of the INST_* directories to their INSTALL*
+counterparts. Which counterparts are chosen depends on the setting of
+INSTALLDIRS according to the following table:
+
+ INSTALLDIRS set to
+ perl site
+
+ INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH
+ INST_LIB INSTALLPRIVLIB INSTALLSITELIB
+ INST_HTMLLIBDIR INSTALLHTMLPRIVLIBDIR INSTALLHTMLSITELIBDIR
+ INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR
+ INST_BIN INSTALLBIN
+ INST_SCRIPT INSTALLSCRIPT
+ INST_MAN1DIR INSTALLMAN1DIR
+ INST_MAN3DIR INSTALLMAN3DIR
- unless ($self->{LIBPERL_A}){
- if ($Is_VMS) {
- $self->{LIBPERL_A} = 'libperl.olb';
- } else {
- $self->{LIBPERL_A} = "libperl.$self->{LIB_EXT}";
- }
- }
+The INSTALL... macros in turn default to their %Config
+($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
- # make a few simple checks
- warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
- (Exporter.pm not found)"
- unless (-f $self->catfile("$self->{PERL_LIB}","Exporter.pm"));
+You can check the values of these variables on your system with
- ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME};
- $self->{VERSION} = "0.10" unless $self->{VERSION};
- ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g;
+ perl '-V:install.*'
+And to check the sequence in which the library directories are
+searched by perl, run
- # --- Initialize Perl Binary Locations
+ perl -le 'print join $/, @INC'
- # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL'
- # will be working versions of perl 5. miniperl has priority over perl
- # for PERL to ensure that $(PERL) is usable while building ./ext/*
- my $path_sep = $Is_OS2 ? ";" : $Is_VMS ? "/" : ":";
- my $path = $ENV{PATH};
- $path =~ s:\\:/:g if $Is_OS2;
- my @path = split $path_sep, $path;
- my ($component,@defpath);
- foreach $component ($self->{PERL_SRC}, @path, $Config::Config{binexp}) {
- push @defpath, $component if defined $component;
- }
- $self->{PERL} =
- $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ],
- \@defpath, $ExtUtils::MakeMaker::Verbose ) unless ($self->{PERL});
-# don't check, if perl is executable, maybe they
-# have decided to supply switches with perl
-
- # Define 'FULLPERL' to be a non-miniperl (used in test: target)
- ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
- unless ($self->{FULLPERL});
-}
-sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
- my($self) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
- local(%pm); #the sub in find() has to see this hash
- $ignore{'test.pl'} = 1;
- $ignore{'makefile.pl'} = 1 if $Is_VMS;
- foreach $name ($self->lsdir(".")){
- next if ($name =~ /^\./ or $ignore{$name});
- if (-d $name){
- $dir{$name} = $name if (-f "$name/Makefile.PL");
- } elsif ($name =~ /\.xs$/){
- my($c); ($c = $name) =~ s/\.xs$/.c/;
- $xs{$name} = $c;
- $c{$c} = 1;
- } elsif ($name =~ /\.c$/){
- $c{$name} = 1
- unless $name =~ m/perlmain\.c/; # See MAP_TARGET
- } elsif ($name =~ /\.h$/){
- $h{$name} = 1;
- } elsif ($name =~ /\.(p[ml]|pod)$/){
- $pm{$name} = $self->catfile('$(INST_LIBDIR)',"$name");
- } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") {
- ($pl_files{$name} = $name) =~ s/\.PL$// ;
- }
- }
+=head2 PREFIX and LIB attribute
- # Some larger extensions often wish to install a number of *.pm/pl
- # files into the library in various locations.
+PREFIX and LIB can be used to set several INSTALL* attributes in one
+go. The quickest way to install a module in a non-standard place might
+be
- # The attribute PMLIBDIRS holds an array reference which lists
- # subdirectories which we should search for library files to
- # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ].
- # We recursively search through the named directories (skipping
- # any which don't exist or contain Makefile.PL files).
+ perl Makefile.PL LIB=~/lib
- # For each *.pm or *.pl file found $self->libscan() is called with
- # the default installation path in $_[1]. The return value of
- # libscan defines the actual installation location. The default
- # libscan function simply returns the path. The file is skipped
- # if libscan returns false.
+This will install the module's architecture-independent files into
+~/lib, the architecture-dependent files into ~/lib/$archname.
- # The default installation location passed to libscan in $_[1] is:
- #
- # ./*.pm => $(INST_LIBDIR)/*.pm
- # ./xyz/... => $(INST_LIBDIR)/xyz/...
- # ./lib/... => $(INST_LIB)/...
- #
- # In this way the 'lib' directory is seen as the root of the actual
- # perl library whereas the others are relative to INST_LIBDIR
- # (which includes ROOTEXT). This is a subtle distinction but one
- # that's important for nested modules.
-
- $self->{PMLIBDIRS} = [ 'lib', $self->{BASEEXT} ] unless $self->{PMLIBDIRS};
-
- #only existing directories that aren't in $dir are allowed
-
- # Avoid $_ wherever possible:
- # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
- my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
- my ($pmlibdir);
- @{$self->{PMLIBDIRS}} = ();
- foreach $pmlibdir (@pmlibdirs) {
- -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
- }
+Another way to specify many INSTALL directories with a single
+parameter is PREFIX.
- if (@{$self->{PMLIBDIRS}}){
- print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
- if ($ExtUtils::MakeMaker::Verbose >= 2);
- use File::Find; # try changing to require !
- File::Find::find(sub {
- if (-d $_){
- if ($_ eq "CVS" || $_ eq "RCS"){
- $File::Find::prune = 1;
- }
- return;
- }
- my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)');
- my $striplibpath;
- $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^lib/::);
- my($inst) = $self->catdir($prefix,$striplibpath);
- local($_) = $inst; # for backwards compatibility
- $inst = $self->libscan($inst);
- print "libscan($path) => '$inst'\n" if ($ExtUtils::MakeMaker::Verbose >= 2);
- return unless $inst;
- $pm{$path} = $inst;
- }, @{$self->{PMLIBDIRS}});
- }
+ perl Makefile.PL PREFIX=~
- $self->{DIR} = [sort keys %dir] unless $self->{DIR};
- $self->{XS} = \%xs unless $self->{XS};
- $self->{PM} = \%pm unless $self->{PM};
- $self->{C} = [sort keys %c] unless $self->{C};
- my(@o_files) = @{$self->{C}};
- $self->{O_FILES} = [grep s/\.c$/\.$self->{OBJ_EXT}/, @o_files] ;
- $self->{H} = [sort keys %h] unless $self->{H};
- $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES};
-
- # Set up names of manual pages to generate from pods
- # Configure overrides anything else
- if ($self->{MANPODS}) {
- } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
- $self->{MANPODS} = {};
- } else {
- my %manifypods = (); # we collect the keys first, i.e. the files
- # we have to convert to pod
- foreach $name (keys %{$self->{PM}}) {
- if ($name =~ /\.pod$/ ) {
- $manifypods{$name} = $self->{PM}{$name};
- } elsif ($name =~ /\.p[ml]$/ ) {
- local(*TESTPOD);
- my($ispod)=0;
- open(TESTPOD,"<$name");
- my $testpodline;
- while ($testpodline = <TESTPOD>) {
- if($testpodline =~ /^=head/) {
- $ispod=1;
- last;
- }
- #Speculation on the future (K.A., not A.K. :)
- #if(/^=don't\S+install/) { $ispod=0; last}
- }
- close(TESTPOD);
-
- if( $ispod ) {
- $manifypods{$name} = $self->{PM}{$name};
- }
- }
- }
+This will replace the string specified by C<$Config{prefix}> in all
+C<$Config{install*}> values.
- # Remove "Configure.pm" and similar, if it's not the only pod listed
- # To force inclusion, just name it "Configure.pod", or override MANPODS
- foreach $name (keys %manifypods) {
- if ($name =~ /(config|install|setup).*\.pm/i) {
- delete $manifypods{$name};
- next;
- }
- my($manpagename) = $name;
- unless ($manpagename =~ s!^lib/!!) {
- $manpagename = join("/",$self->{ROOTEXT},$manpagename);
- }
- $manpagename =~ s/\.p(od|m|l)$//;
- # Strip leading slashes
- $manpagename =~ s!^/+!!;
- # Turn other slashes into colons
-# $manpagename =~ s,/+,::,g;
- $manpagename = $self->replace_manpage_seperator($manpagename);
- $manifypods{$name} = "\$(INST_MAN3DIR)/$manpagename.\$(MAN3EXT)";
- }
- $self->{MANPODS} = \%manifypods;
- }
-}
+Note, that in both cases the tilde expansion is done by MakeMaker, not
+by perl by default, nor by make.
-sub lsdir {
- my($self) = shift;
- my($dir, $regex) = @_;
- local(*DIR, @ls);
- opendir(DIR, $dir || ".") or return ();
- @ls = readdir(DIR);
- closedir(DIR);
- @ls = grep(/$regex/, @ls) if $regex;
- @ls;
-}
+Conflicts between parameters LIB,
+PREFIX and the various INSTALL* arguments are resolved so that:
-sub replace_manpage_seperator {
- my($self,$man) = @_;
- $man =~ s,/+,::,g;
- $man;
-}
+=over 4
-sub libscan {
- my($self,$path) = @_;
- return '' if $path =~ m:/RCS/: ;
- $path;
-}
+=item *
-sub init_others { # --- Initialize Other Attributes
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
+setting LIB overrides any setting of INSTALLPRIVLIB, INSTALLARCHLIB,
+INSTALLSITELIB, INSTALLSITEARCH (and they are not affected by PREFIX);
- # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS}
- # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or
- # undefined. In any case we turn it into an anon array:
- $self->{LIBS}=[] unless $self->{LIBS};
- $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR;
- $self->{LD_RUN_PATH} = "";
- my($libs);
- foreach $libs ( @{$self->{LIBS}} ){
- $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace
- my(@libs) = $self->extliblist($libs);
- if ($libs[0] or $libs[1] or $libs[2]){
- ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}) = @libs;
- if ($libs[2]) {
- my @splitted = split(" ", $libs[2]);
- my $splitted;
- foreach $splitted (@splitted) {
- $splitted =~ s/^-L//;
- }
- $self->{LD_RUN_PATH} = join ":", @splitted;
- }
- last;
- }
- }
+=item *
- print STDOUT "CONFIG must be an array ref\n"
- if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
- $self->{CONFIG} = [] unless (ref $self->{CONFIG});
- push(@{$self->{CONFIG}},
- qw(cc libc ldflags lddlflags ccdlflags cccdlflags
- ranlib so dlext dlsrc
- ));
- push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags};
-
- unless ( $self->{OBJECT} ){
- # init_dirscan should have found out, if we have C files
- $self->{OBJECT} = '$(BASEEXT).$(OBJ_EXT)' if @{$self->{C}||[]};
- }
- $self->{OBJECT} =~ s/\n+/ \\\n\t/g;
- $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : "";
- $self->{LD} = ($Config::Config{ld} || 'ld') unless $self->{LD};
- $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM};
-
- # Sanity check: don't define LINKTYPE = dynamic if we're skipping
- # the 'dynamic' section of MM. We don't have this problem with
- # 'static', since we either must use it (%Config says we can't
- # use dynamic loading) or the caller asked for it explicitly.
- if (!$self->{LINKTYPE}) {
- $self->{LINKTYPE} = grep(/dynamic/,@{$self->{SKIP} || []})
- ? 'static'
- : ($Config::Config{usedl} ? 'dynamic' : 'static');
- };
-
- # These get overridden for VMS and maybe some other systems
- $self->{NOOP} = "";
- $self->{MAKEFILE} ||= "Makefile";
- $self->{RM_F} = "rm -f";
- $self->{RM_RF} = "rm -rf";
- $self->{TOUCH} = "touch";
- $self->{CP} = "cp";
- $self->{MV} = "mv";
- $self->{CHMOD} = "chmod";
- $self->{UMASK_NULL} = "umask 0";
-}
+without LIB, setting PREFIX replaces the initial C<$Config{prefix}>
+part of those INSTALL* arguments, even if the latter are explicitly
+set (but are set to still start with C<$Config{prefix}>).
-sub find_perl{
- my($self, $ver, $names, $dirs, $trace) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($name, $dir);
- if ($trace >= 2){
- print "Looking for perl $ver by these names:
-@$names
-in these dirs:
-@$dirs
-";
- }
- foreach $dir (@$dirs){
- next unless defined $dir; # $self->{PERL_SRC} may be undefined
- foreach $name (@$names){
- my $abs;
- if ($name =~ m|^/|) {
- $abs = $name;
- } else {
- $abs = $self->catfile($dir, $name);
- }
- print "Checking $abs\n" if ($trace >= 2);
- if ($Is_OS2) {
- $abs .= ".exe" unless -x $abs;
- }
- next unless -x "$abs";
- print "Executing $abs\n" if ($trace >= 2);
- if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
- print "Using PERL=$abs\n" if $trace;
- return $abs;
- }
- }
- }
- print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
- 0; # false and not empty
-}
-
-sub post_initialize {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "";
-}
-
-# --- Constants Sections ---
-
-sub const_config {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$m);
- push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n");
- my(%once_only);
- foreach $m (@{$self->{CONFIG}}){
- next if $once_only{$m};
- print STDOUT "CONFIG key '$m' does not exist in Config.pm\n"
- unless exists $Config::Config{$m};
- push @m, "\U$m\E = $Config::Config{$m}\n";
- $once_only{$m} = 1;
- }
- join('', @m);
-}
-
-sub constants {
- my($self) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$tmp);
-
- push @m, "
-NAME = $self->{NAME}
-DISTNAME = $self->{DISTNAME}
-NAME_SYM = $self->{NAME_SYM}
-VERSION = $self->{VERSION}
-VERSION_SYM = $self->{VERSION_SYM}
-VERSION_MACRO = VERSION
-DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
-
-# In which directory should we put this extension during 'make'?
-# This is typically ./blib.
-# (also see INST_LIBDIR and relationship to ROOTEXT)
-INST_LIB = $self->{INST_LIB}
-INST_ARCHLIB = $self->{INST_ARCHLIB}
-INST_EXE = $self->{INST_EXE}
-
-# AFS users will want to set the installation directories for
-# the final 'make install' early without setting INST_LIB,
-# INST_ARCHLIB, and INST_EXE for the testing phase
-INSTALLPRIVLIB = $self->{INSTALLPRIVLIB}
-INSTALLARCHLIB = $self->{INSTALLARCHLIB}
-INSTALLBIN = $self->{INSTALLBIN}
-
-# Perl library to use when building the extension
-PERL_LIB = $self->{PERL_LIB}
-PERL_ARCHLIB = $self->{PERL_ARCHLIB}
-LIBPERL_A = $self->{LIBPERL_A}
-
-MAKEMAKER = \$(PERL_LIB)/ExtUtils/MakeMaker.pm
-MM_VERSION = $ExtUtils::MakeMaker::VERSION
-
-OBJ_EXT = $self->{OBJ_EXT}
-LIB_EXT = $self->{LIB_EXT}
-AR = $self->{AR}
-";
-
- push @m, "
-# Where is the perl source code located?
-PERL_SRC = $self->{PERL_SRC}\n" if $self->{PERL_SRC};
-
- push @m, "
-# Perl header files (will eventually be under PERL_LIB)
-PERL_INC = $self->{PERL_INC}
-# Perl binaries
-PERL = $self->{PERL}
-FULLPERL = $self->{FULLPERL}
-";
- push @m, "
-# FULLEXT = Pathname for extension directory (eg DBD/Oracle).
-# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
-# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
-# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
-FULLEXT = $self->{FULLEXT}
-BASEEXT = $self->{BASEEXT}
-ROOTEXT = $self->{ROOTEXT}
-DLBASE = $self->{DLBASE}
-";
- push @m, "
-INC = $self->{INC}
-DEFINE = $self->{DEFINE}
-OBJECT = $self->{OBJECT}
-LDFROM = $self->{LDFROM}
-LINKTYPE = $self->{LINKTYPE}
-
-# Handy lists of source code files:
-XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
-C_FILES = ".join(" \\\n\t", @{$self->{C}})."
-O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
-H_FILES = ".join(" \\\n\t", @{$self->{H}})."
-MANPODS = ".join(" \\\n\t", sort keys %{$self->{MANPODS}})."
-
-# Man installation stuff:
-INST_MAN1DIR = $self->{INST_MAN1DIR}
-INSTALLMAN1DIR = $self->{INSTALLMAN1DIR}
-MAN1EXT = $self->{MAN1EXT}
-
-INST_MAN3DIR = $self->{INST_MAN3DIR}
-INSTALLMAN3DIR = $self->{INSTALLMAN3DIR}
-MAN3EXT = $self->{MAN3EXT}
-
-
-# work around a famous dec-osf make(1) feature(?):
-makemakerdflt: all
-
-.SUFFIXES: .xs .c .\$(OBJ_EXT)
-
-.PRECIOUS: Makefile
-
-.PHONY: all config static dynamic test linkext
-
-# This extension may link to it's own library (see SDBM_File)
-MYEXTLIB = $self->{MYEXTLIB}
-
-# Where is the Config information that we are using/depend on
-CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
-";
-
- push @m, '
-# Where to put things:
-INST_LIBDIR = $(INST_LIB)$(ROOTEXT)
-INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT)
-
-INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
-INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
-';
-
- if ($self->has_link_code()) {
- push @m, '
-INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT).$(LIB_EXT)
-INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT)
-INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs
-';
- } else {
- push @m, '
-INST_STATIC =
-INST_DYNAMIC =
-INST_BOOT =
-';
- }
-
- if ($Is_OS2) {
- $tmp = "$self->{BASEEXT}.def";
- } else {
- $tmp = "";
- }
- push @m, "
-EXPORT_LIST = $tmp
-";
-
- if ($Is_OS2) {
- $tmp = "\$(PERL_INC)/libperl.lib";
- } else {
- $tmp = "";
- }
- push @m, "
-PERL_ARCHIVE = $tmp
-";
-
- push @m, '
-INST_PM = '.join(" \\\n\t", sort values %{$self->{PM}}).'
-';
-
- join('',@m);
-}
-
-sub const_loadlibs {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return "" unless $self->needs_linking;
- "
-# $self->{NAME} might depend on some other libraries:
-# (These comments may need revising:)
-#
-# Dependent libraries can be linked in one of three ways:
-#
-# 1. (For static extensions) by the ld command when the perl binary
-# is linked with the extension library. See EXTRALIBS below.
-#
-# 2. (For dynamic extensions) by the ld command when the shared
-# object is built/linked. See LDLOADLIBS below.
-#
-# 3. (For dynamic extensions) by the DynaLoader when the shared
-# object is loaded. See BSLOADLIBS below.
-#
-# EXTRALIBS = List of libraries that need to be linked with when
-# linking a perl binary which includes this extension
-# Only those libraries that actually exist are included.
-# These are written to a file and used when linking perl.
-#
-# LDLOADLIBS = List of those libraries which can or must be linked into
-# the shared library when created using ld. These may be
-# static or dynamic libraries.
-# LD_RUN_PATH is a colon separated list of the directories
-# in LDLOADLIBS. It is passed as an environment variable to
-# the process that links the shared library.
-#
-# BSLOADLIBS = List of those libraries that are needed but can be
-# linked in dynamically at run time on this platform.
-# SunOS/Solaris does not need this because ld records
-# the information (from LDLOADLIBS) into the object file.
-# This list is used to create a .bs (bootstrap) file.
-#
-EXTRALIBS = $self->{EXTRALIBS}
-LDLOADLIBS = $self->{LDLOADLIBS}
-BSLOADLIBS = $self->{BSLOADLIBS}
-LD_RUN_PATH= $self->{LD_RUN_PATH}
-";
-}
-
-sub const_cccmd {
- my($self,$libperl)=@_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
- return '' unless $self->needs_linking();
- $libperl or $libperl = $self->{LIBPERL_A} || "libperl.$self->{LIB_EXT}" ;
- $libperl =~ s/\.\$\(A\)$/.$self->{LIB_EXT}/;
- # This is implemented in the same manner as extliblist,
- # e.g., do both and compare results during the transition period.
- my($cc,$ccflags,$optimize,$large,$split, $shflags)
- = @Config{qw(cc ccflags optimize large split shellflags)};
- my($optdebug) = "";
-
- $shflags = '' unless $shflags;
- my($prog, $old, $uc, $perltype);
-
- chop($old = `cd $self->{PERL_SRC}; sh $shflags ./cflags $libperl $self->{BASEEXT}.c`)
- if $self->{PERL_SRC};
-
- my(%map) = (
- D => '-DDEBUGGING',
- E => '-DEMBED',
- DE => '-DDEBUGGING -DEMBED',
- M => '-DEMBED -DMULTIPLICITY',
- DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
- );
-
- if ($libperl =~ /libperl(\w*)\.$self->{LIB_EXT}/){
- $uc = uc($1);
- } else {
- $uc = ""; # avoid warning
- }
- $perltype = $map{$uc} ? $map{$uc} : "";
-
- if ($uc =~ /^D/) {
- $optdebug = "-g";
- }
-
-
- my($name);
- ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
- if ($prog = $Config::Config{$name}) {
- # Expand hints for this extension via the shell
- print STDOUT "Processing $name hint:\n" if $ExtUtils::MakeMaker::Verbose;
- my(@o)=`cc=\"$cc\"
- ccflags=\"$ccflags\"
- optimize=\"$optimize\"
- perltype=\"$perltype\"
- optdebug=\"$optdebug\"
- large=\"$large\"
- split=\"$split\"
- eval '$prog'
- echo cc=\$cc
- echo ccflags=\$ccflags
- echo optimize=\$optimize
- echo perltype=\$perltype
- echo optdebug=\$optdebug
- echo large=\$large
- echo split=\$split
- `;
- my(%cflags,$line);
- foreach $line (@o){
- chomp $line;
- if ($line =~ /(.*?)=\s*(.*)\s*$/){
- $cflags{$1} = $2;
- print STDOUT " $1 = $2\n" if $ExtUtils::MakeMaker::Verbose;
- } else {
- print STDOUT "Unrecognised result from hint: '$line'\n";
- }
- }
- ( $cc,$ccflags,$perltype,$optdebug,$optimize,$large,$split )=@cflags{
- qw( cc ccflags perltype optdebug optimize large split)};
- }
-
- if ($optdebug) {
- $optimize = $optdebug;
- }
-
- my($new) = "$cc -c $ccflags $optimize $perltype $large $split";
- $new =~ s/^\s+//; $new =~ s/\s+/ /g; $new =~ s/\s+$//;
- if (defined($old)){
- $old =~ s/^\s+//; $old =~ s/\s+/ /g; $old =~ s/\s+$//;
- if ($new ne $old) {
- print STDOUT "Warning (non-fatal): cflags evaluation in ",
- "MakeMaker ($ExtUtils::MakeMaker::VERSION) ",
- "differs from shell output\n",
- " package: $self->{NAME}\n",
- " old: $old\n",
- " new: $new\n",
- " Using 'old' set.\n",
- Config::myconfig(), "\n";
- }
- }
- my($cccmd)=($old) ? $old : $new;
- $cccmd =~ s/^\s*\Q$Config::Config{cc}\E\s/\$(CC) /;
- $cccmd .= " \$(DEFINE_VERSION)";
- $self->{CONST_CCCMD} = "CCCMD = $cccmd\n";
-}
-
-# --- Tool Sections ---
-
-sub tool_autosplit {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($asl) = "";
- $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
- q{
-# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
-AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
-};
-}
-
-sub tool_xsubpp {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($xsdir) = '$(PERL_LIB)/ExtUtils';
- # drop back to old location if xsubpp is not in new location yet
- $xsdir = '$(PERL_SRC)/ext' unless (-f "$self->{PERL_LIB}/ExtUtils/xsubpp");
- my(@tmdeps) = ('$(XSUBPPDIR)/typemap');
- if( $self->{TYPEMAPS} ){
- my $typemap;
- foreach $typemap (@{$self->{TYPEMAPS}}){
- if( ! -f $typemap ){
- warn "Typemap $typemap not found.\n";
- }
- else{
- push(@tmdeps, $typemap);
- }
- }
- }
- push(@tmdeps, "typemap") if -f "typemap";
- my(@tmargs) = map("-typemap $_", @tmdeps);
- "
-XSUBPPDIR = $xsdir
-XSUBPP = \$(XSUBPPDIR)/xsubpp
-XSUBPPDEPS = @tmdeps
-XSUBPPARGS = @tmargs
-";
-};
-
-sub tools_other {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "
-SHELL = /bin/sh
-LD = $self->{LD}
-TOUCH = $self->{TOUCH}
-CP = $self->{CP}
-MV = $self->{MV}
-RM_F = $self->{RM_F}
-RM_RF = $self->{RM_RF}
-CHMOD = $self->{CHMOD}
-UMASK_NULL = $self->{UMASK_NULL}
-".q{
-# The following is a portable way to say mkdir -p
-# To see which directories are created, change the if 0 to if 1
-MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
--e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
--e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
--e 'mkdir("@p",0777)||die $$! } } exit 0;'
-};
-}
-
-sub dist {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- # VERSION should be sanitised before use as a file name
- my($name) = $attribs{NAME} || '$(DISTVNAME)';
- my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar
- my($tarflags) = $attribs{TARFLAGS} || 'cvf';
- my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip
- my($suffix) = $attribs{SUFFIX} || 'Z'; # eg gz
- my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip"
- my($preop) = $attribs{PREOP} || '@ true'; # eg update MANIFEST
- my($postop) = $attribs{POSTOP} || '@ true'; # eg remove the distdir
- my($ci) = $attribs{CI} || 'ci -u';
- my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q';
- my($dist_cp) = $attribs{DIST_CP} || 'cp';
- my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist';
-
- push @m, "
-DISTVNAME = \$(DISTNAME)-\$(VERSION)
-TAR = $tar
-TARFLAGS = $tarflags
-COMPRESS = $compress
-SUFFIX = $suffix
-SHAR = $shar
-PREOP = $preop
-POSTOP = $postop
-CI = $ci
-RCS_LABEL = $rcs_label
-DIST_CP = $dist_cp
-DIST_DEFAULT = $dist_default
-";
- join "", @m;
-}
-
-sub macro {
- my($self,%attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$key,$val);
- while (($key,$val) = each %attribs){
- push @m, "$key = $val\n";
- }
- join "", @m;
-}
-
-sub post_constants{
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "";
-}
-
-sub pasthru {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$key);
-
- my(@pasthru); # 1 was for runsubdirpl, 2 for normal make in subdirectories
-
- foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
- INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
- push @pasthru, "$key=\"\$($key)\"";
- }
-
- push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n";
- join "", @m;
-}
-
-# --- Translation Sections ---
-
-sub c_o {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking();
- my(@m);
- push @m, '
-.c.$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c
-';
- join "", @m;
-}
-
-sub xs_c {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking();
- '
-.xs.c:
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
-';
-}
-
-sub xs_o { # many makes are too dumb to use xs_c then c_o
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking();
- '
-.xs.$(OBJ_EXT):
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c
-';
-}
-
-# --- Target Sections ---
-
-sub top_targets {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- push @m, '
-all :: config $(INST_PM) subdirs linkext manifypods
-
-subdirs :: $(MYEXTLIB)
-
-'.$self->{NOOP}.'
-
-config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists
-
-config :: $(INST_ARCHAUTODIR)/.exists Version_check
-
-config :: $(INST_AUTODIR)/.exists
-
-config :: $(INST_MAN1DIR)/.exists
-
-config :: $(INST_MAN3DIR)/.exists
-';
-
-
-
-#postamble ist einfach leer!
-
- # 5.00 breaks with the incomplete rules set up by Tk-b8. We
- # introduce the following dependency for Tk-b8:
- if ($self->{NAME} eq 'Tk' && $self->{VERSION} eq 'b8') {
-# push @m, "
-#$(MYEXTLIB) ::
-# cd pTk";
- }
-
-
-
-
-
- push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)
- $(INST_MAN1DIR) $(INST_MAN3DIR)]);
-
- push @m, '
-$(O_FILES): $(H_FILES)
-' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
-
- push @m, q{
-help:
- perldoc ExtUtils::MakeMaker
-};
-
- push @m, q{
-Version_check:
- @$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
- -e 'use ExtUtils::MakeMaker qw($$Version &Version_check);' \
- -e '&Version_check($(MM_VERSION))'
-};
-
- join('',@m);
-}
-
-sub linkext {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- # LINKTYPE => static or dynamic or ''
- my($linktype) = defined $attribs{LINKTYPE} ?
- $attribs{LINKTYPE} : '$(LINKTYPE)';
- "
-linkext :: $linktype
-$self->{NOOP}
-";
-}
-
-sub dlsyms {
- my($self,%attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
-
- return '' if ($Config::Config{osname} ne 'aix');
-
- my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my(@m);
-
- push(@m,"
-dynamic :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{dynamic};
-
- push(@m,"
-static :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{static};
-
- push(@m,"
-$self->{BASEEXT}.exp: Makefile.PL
-",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::MakeMaker qw(&mksymlists); \\
- &mksymlists(DL_FUNCS => ',
- %$funcs ? neatvalue($funcs) : '""',', DL_VARS => ',
- @$vars ? neatvalue($vars) : '""', ", NAME => \"$self->{NAME}\")'
-");
-
- join('',@m);
-}
-
-# --- Dynamic Loading Sections ---
-
-sub dynamic {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- '
-# $(INST_PM) has been moved to the all: target.
-# It remains here for awhile to allow for old usage: "make dynamic"
-dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
-'.$self->{NOOP}.'
-';
-}
-
-sub dynamic_bs {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking();
- '
-BOOTSTRAP = '."$self->{BASEEXT}.bs".'
-
-# As Mkbootstrap might not write a file (if none is required)
-# we use touch to prevent make continually trying to remake it.
-# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".'
- @ echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
- @ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
- -e \'use ExtUtils::Mkbootstrap;\' \
- -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
- @ $(TOUCH) $(BOOTSTRAP)
- $(CHMOD) 644 $@
- @echo $@ >> $(INST_ARCHAUTODIR)/.packlist
-
-$(INST_BOOT): $(BOOTSTRAP)
- @ '.$self->{RM_RF}.' $(INST_BOOT)
- -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
- $(CHMOD) 644 $@
- @echo $@ >> $(INST_ARCHAUTODIR)/.packlist
-';
-}
-
-sub dynamic_lib {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking(); #might be because of a subdir
-
- return '
-$(INST_DYNAMIC):
-' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
-
- my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
- my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
- my($ldfrom) = '$(LDFROM)';
- my($osname) = $Config::Config{osname};
- $armaybe = 'ar' if ($osname eq 'dec_osf' and $armaybe eq ':');
- my(@m);
- push(@m,'
-# This section creates the dynamically loadable $(INST_DYNAMIC)
-# from $(OBJECT) and possibly $(MYEXTLIB).
-ARMAYBE = '.$armaybe.'
-OTHERLDFLAGS = '.$otherldflags.'
-
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE)
-');
- if ($armaybe ne ':'){
- $ldfrom = "tmp.$(LIB_EXT)";
- push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
- push(@m,' $(RANLIB) '."$ldfrom\n");
- }
- $ldfrom = "-all $ldfrom -none" if ($osname eq 'dec_osf');
- push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom.
- ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS) $(EXPORT_LIST) $(PERL_ARCHIVE)');
- push @m, '
- $(CHMOD) 755 $@
- @echo $@ >> $(INST_ARCHAUTODIR)/.packlist
-';
-
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('',@m);
-}
-
-# --- Static Loading Sections ---
-
-sub static {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- '
-# $(INST_PM) has been moved to the all: target.
-# It remains here for awhile to allow for old usage: "make static"
-static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM)
-'.$self->{NOOP}.'
-';
-}
-
-sub static_lib {
- my($self) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return '' unless $self->needs_linking(); #might be because of a subdir
-
- return '
-$(INST_DYNAMIC):
-' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
-
- my(@m);
- push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
-END
- # If this extension has it's own library (eg SDBM_File)
- # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
- push(@m, " $self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
-
- push(@m, <<'END');
- $(AR) cr $@ $(OBJECT) && $(RANLIB) $@
- @echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
- $(CHMOD) 755 $@
- @echo $@ >> $(INST_ARCHAUTODIR)/.packlist
-END
-
-# Old mechanism - still available:
-
- push(@m, <<'END') if $self->{PERL_SRC};
- @ echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
-END
+=back
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('', "\n",@m);
-}
+If the user has superuser privileges, and is not working on AFS
+or relatives, then the defaults for
+INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLSCRIPT, etc. will be appropriate,
+and this incantation will be the best:
-sub installpm {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- # By default .pm files are split into the architecture independent
- # library. This is a good thing. If a specific module requires that
- # it's .pm files are split into the architecture specific library
- # then it should use: installpm => {SPLITLIB=>'$(INST_ARCHLIB)'}
- # Note that installperl currently interferes with this (Config.pm)
- # User can disable split by saying: installpm => {SPLITLIB=>''}
- my($splitlib) = '$(INST_LIB)'; # NOT arch specific by default
- $splitlib = $attribs{SPLITLIB} if exists $attribs{SPLITLIB};
- my(@m, $dist);
- push @m, "inst_pm :: \$(INST_PM)\n\n";
- foreach $dist (sort keys %{$self->{PM}}){
- my($inst) = $self->{PM}->{$dist};
- push(@m, "\n# installpm: $dist => $inst, splitlib=$splitlib\n");
- push(@m, $self->installpm_x($dist, $inst, $splitlib));
- push(@m, "\n");
- }
- join('', @m);
-}
+ perl Makefile.PL; make; make test
+ make install
-sub installpm_x { # called by installpm per file
- my($self, $dist, $inst, $splitlib) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- warn "Warning: Most probably 'make' will have problems processing this file: $inst\n"
- if $inst =~ m![:#]!;
- my($instdir) = $inst =~ m|(.*)/|;
- my(@m);
- push(@m,"
-$inst: $dist $self->{MAKEFILE} $instdir/.exists
-".' @ '.$self->{RM_F}.' $@
- $(UMASK_NULL) && '."$self->{CP} $dist".' $@
- @ echo $@ >> $(INST_ARCHAUTODIR)/.packlist
-');
- push(@m, "\t\@\$(AUTOSPLITFILE) \$@ $splitlib/auto\n")
- if ($splitlib and $inst =~ m/\.pm$/);
-
- push @m, $self->dir_target($instdir);
- join('', @m);
-}
+make install per default writes some documentation of what has been
+done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature
+can be bypassed by calling make pure_install.
-sub manifypods {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($dist);
- my(@m);
- push @m,
-q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
--e 'next if -e $$m{$$_} && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\
--e 'print "Installing $$m{$$_}\n";' \\
--e 'system("pod2man $$_>$$m{$$_}")==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
--e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
-];
- push @m, "\nmanifypods :";
-
- push(@m,"\n");
- if (%{$self->{MANPODS}}) {
- push @m, "\t\@\$(POD2MAN) \\\t";
- push @m, join " \\\n\t", %{$self->{MANPODS}};
- }
- join('', @m);
-}
+=head2 AFS users
-sub processPL {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- return "" unless $self->{PL_FILES};
- my(@m, $plfile);
- foreach $plfile (sort keys %{$self->{PL_FILES}}) {
- push @m, "
-all :: $self->{PL_FILES}->{$plfile}
-
-$self->{PL_FILES}->{$plfile} :: $plfile
- \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile
-";
- }
- join "", @m;
-}
+will have to specify the installation directories as these most
+probably have changed since perl itself has been installed. They will
+have to do this by calling
-sub installbin {
- my($self) = shift;
- return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
- my(@m, $from, $to, %fromto, @to);
- push @m, $self->dir_target(qw[$(INST_EXE)]);
- for $from (@{$self->{EXE_FILES}}) {
- my($path)= '$(INST_EXE)/' . basename($from);
- local($_) = $path; # for backwards compatibility
- $to = $self->exescan($path);
- print "exescan($from) => '$to'\n" if ($ExtUtils::MakeMaker::Verbose >=2);
- $fromto{$from}=$to;
- }
- @to = values %fromto;
- push(@m, "
-EXE_FILES = @{$self->{EXE_FILES}}
-
-all :: @to
-
-realclean ::
- $self->{RM_F} @to
-");
-
- while (($from,$to) = each %fromto) {
- my $todir = dirname($to);
- push @m, "
-$to: $from $self->{MAKEFILE} $todir/.exists
- $self->{CP} $from $to
-";
- }
- join "", @m;
-}
+ perl Makefile.PL INSTALLSITELIB=/afs/here/today \
+ INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
+ make
-sub exescan {
- my($self,$path) = @_;
- $path;
-}
-# --- Sub-directory Sections ---
+Be careful to repeat this procedure every time you recompile an
+extension, unless you are sure the AFS installation directories are
+still valid.
-sub subdirs {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$dir);
- # This method provides a mechanism to automatically deal with
- # subdirectories containing further Makefile.PL scripts.
- # It calls the subdir_x() method for each subdirectory.
- foreach $dir (@{$self->{DIR}}){
- push(@m, $self->subdir_x($dir));
- print "Including $dir subdirectory\n" if $ExtUtils::MakeMaker::Verbose;
- }
- if (@m){
- unshift(@m, "
-# The default clean, realclean and test targets in this Makefile
-# have automatically been given entries for each subdir.
+=head2 Static Linking of a new Perl Binary
-");
- } else {
- push(@m, "\n# none")
- }
- join('',@m);
-}
+An extension that is built with the above steps is ready to use on
+systems supporting dynamic loading. On systems that do not support
+dynamic loading, any newly created extension has to be linked together
+with the available resources. MakeMaker supports the linking process
+by creating appropriate targets in the Makefile whenever an extension
+is built. You can invoke the corresponding section of the makefile with
-sub runsubdirpl{ # Experimental! See subdir_x section
- my($self,$subdir) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- chdir($subdir) or die "chdir($subdir): $!";
- #ExtUtils::MakeMaker::check_hints();
- package main;
- require "Makefile.PL";
-}
+ make perl
-sub subdir_x {
- my($self, $subdir) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- qq{
+That produces a new perl binary in the current directory with all
+extensions linked in that can be found in INST_ARCHLIB , SITELIBEXP,
+and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on
+UNIX, this is called Makefile.aperl (may be system dependent). If you
+want to force the creation of a new perl, it is recommended, that you
+delete this Makefile.aperl, so the directories are searched-through
+for linkable libraries again.
-subdirs ::
- \@ -cd $subdir && \$(MAKE) all \$(PASTHRU)
+The binary can be installed into the directory where perl normally
+resides on your machine with
-};
-}
+ make inst_perl
-# --- Cleanup and Distribution Sections ---
+To produce a perl binary with a different name than C<perl>, either say
-sub clean {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$dir);
- push(@m, '
-# Delete temporary files but do not touch installed files. We don\'t delete
-# the Makefile here so a later make realclean still has a makefile to use.
-
-clean ::
-');
- # clean subdirectories first
- for $dir (@{$self->{DIR}}) {
- push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
- }
+ perl Makefile.PL MAP_TARGET=myperl
+ make myperl
+ make inst_perl
- my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
- push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
- push(@otherfiles, qw[./blib Makeaperlfile $(INST_ARCHAUTODIR)/extralibs.all
- perlmain.c mon.out core so_locations
- *~ */*~ */*/*~
- *.$(OBJ_EXT) *.$(LIB_EXT)
- perl.exe $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def $(BASEEXT).exp
- ]);
- push @m, "\t-$self->{RM_RF} @otherfiles\n";
- # See realclean and ext/utils/make_ext for usage of Makefile.old
- push(@m,
- "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
- push(@m,
- "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
- join("", @m);
-}
+or say
-sub realclean {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- push(@m,'
-# Delete temporary files (via clean) and also delete installed files
-realclean purge :: clean
-');
- # realclean subdirectories first (already cleaned)
- my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
- foreach(@{$self->{DIR}}){
- push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
- push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
- }
- push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n");
- push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n");
- push(@m, " $self->{RM_F} \$(INST_STATIC) \$(INST_PM)\n");
- my(@otherfiles) = ($self->{MAKEFILE},
- "$self->{MAKEFILE}.old"); # Makefiles last
- push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
- push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles;
- push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
- join("", @m);
-}
+ perl Makefile.PL
+ make myperl MAP_TARGET=myperl
+ make inst_perl MAP_TARGET=myperl
-sub dist_basics {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- push @m, q{
-distclean :: realclean distcheck
-};
-
- push @m, q{
-distcheck :
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
- -e 'fullcheck();'
-};
-
- push @m, q{
-manifest :
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
- -e 'mkmanifest();'
-};
- join "", @m;
-}
+In any case you will be prompted with the correct invocation of the
+C<inst_perl> target that installs the new binary into INSTALLBIN.
-sub dist_core {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- push @m, q{
-dist : $(DIST_DEFAULT)
-
-tardist : $(DISTVNAME).tar.$(SUFFIX)
-
-$(DISTVNAME).tar.$(SUFFIX) : distdir
- $(PREOP)
- $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
- $(RM_RF) $(DISTVNAME)
- $(COMPRESS) $(DISTVNAME).tar
- $(POSTOP)
-
-uutardist : $(DISTVNAME).tar.$(SUFFIX)
- uuencode $(DISTVNAME).tar.$(SUFFIX) \\
- $(DISTVNAME).tar.$(SUFFIX) > \\
- $(DISTVNAME).tar.$(SUFFIX).uu
-
-shdist : distdir
- $(PREOP)
- $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
- $(RM_RF) $(DISTVNAME)
- $(POSTOP)
-};
- join "", @m;
-}
+make inst_perl per default writes some documentation of what has been
+done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
+can be bypassed by calling make pure_inst_perl.
-sub dist_dir {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- push @m, q{
-distdir :
- $(RM_RF) $(DISTVNAME)
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "/mani/";' \\
- -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
-};
- join "", @m;
-}
+Warning: the inst_perl: target will most probably overwrite your
+existing perl binary. Use with care!
-sub dist_test {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- push @m, q{
-disttest : distdir
- cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
- cd $(DISTVNAME) && $(MAKE)
- cd $(DISTVNAME) && $(MAKE) test
-};
- join "", @m;
-}
+Sometimes you might want to build a statically linked perl although
+your system supports dynamic loading. In this case you may explicitly
+set the linktype with the invocation of the Makefile.PL or make:
-sub dist_ci {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- push @m, q{
-ci :
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
- -e '@all = keys %{ maniread() };' \\
- -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
- -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
-};
- join "", @m;
-}
+ perl Makefile.PL LINKTYPE=static # recommended
-sub install {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- push @m, q{
-doc_install ::
- @ echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
- @ $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \\
- -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
- 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', \\
- 'EXE_FILES=$(EXE_FILES)')" >> $(INSTALLARCHLIB)/perllocal.pod
-};
-
- push(@m, "
-install :: pure_install doc_install
-
-pure_install ::
-");
- # install subdirectories first
- push(@m, map("\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) install\n",
- @{$self->{DIR}}));
-
- push(@m, "\t\@\$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" -e 'require File::Path;' \\
- -e '\$\$message = q[ You do not have permissions to install into];' \\
- -e 'File::Path::mkpath(\@ARGV);' \\
- -e 'foreach (\@ARGV){ die qq{ \$\$message \$\$_\\n} unless -w \$\$_}' \\
- \$(INSTALLPRIVLIB) \$(INSTALLARCHLIB)
- \$(MAKE) INST_LIB=\$(INSTALLPRIVLIB) INST_ARCHLIB=\$(INSTALLARCHLIB) INST_EXE=\$(INSTALLBIN) INST_MAN1DIR=\$(INSTALLMAN1DIR) INST_MAN3DIR=\$(INSTALLMAN3DIR) all
- \@\$(PERL) -i.bak -lne 'print unless \$\$seen{ \$\$_ }++' \$(INSTALLARCHLIB)/auto/\$(FULLEXT)/.packlist
-");
-
- push @m, '
-#### UNINSTALL IS STILL EXPERIMENTAL ####
-uninstall ::
-';
-
- push(@m, map("\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) uninstall\n",
- @{$self->{DIR}}));
- push @m, "\t".'$(RM_RF) `cat $(INSTALLARCHLIB)/auto/$(FULLEXT)/.packlist`
-';
-
- join("",@m);
-}
+or
+ make LINKTYPE=static # works on most systems
-sub force {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- '# Phony target to force checking subdirectories.
-FORCE:
-';
-}
+=head2 Determination of Perl Library and Installation Locations
+MakeMaker needs to know, or to guess, where certain things are
+located. Especially INST_LIB and INST_ARCHLIB (where to put the files
+during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read
+existing modules from), and PERL_INC (header files and C<libperl*.*>).
-sub perldepend {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m);
- push(@m,'
-PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \
- $(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \
- $(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \
- $(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \
- $(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \
- $(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \
- $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \
- $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \
- $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \
- $(PERL_INC)/util.h $(PERL_INC)/config.h
-
-');
-
- push @m, '
-$(OBJECT) : $(PERL_HDRS)
-' if $self->{OBJECT};
-
- push(@m,'
-# Check for unpropogated config.sh changes. Should never happen.
-# We do NOT just update config.h because that is not sufficient.
-# An out of date config.h is not fatal but complains loudly!
-$(PERL_INC)/config.h: $(PERL_SRC)/config.sh
- -@echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false
-
-$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
- @echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
- cd $(PERL_SRC) && $(MAKE) lib/Config.pm
-') if $self->{PERL_SRC};
-
- push(@m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n")
- if %{$self->{XS}};
- join("\n",@m);
-}
+Extensions may be built either using the contents of the perl source
+directory tree or from the installed perl library. The recommended way
+is to build extensions after you have run 'make install' on perl
+itself. You can do that in any directory on your hard disk that is not
+below the perl source tree. The support for extensions below the ext
+directory of the perl distribution is only good for the standard
+extensions that come with perl.
-sub makefile {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my @m;
- # We do not know what target was originally specified so we
- # must force a manual rerun to be sure. But as it should only
- # happen very rarely it is not a significant problem.
- push @m, '
-$(OBJECT) : '.$self->{MAKEFILE}.'
-' if $self->{OBJECT};
-
- push @m, '
-# We take a very conservative approach here, but it\'s worth it.
-# We move Makefile to Makefile.old here to avoid gnu make looping.
-'.$self->{MAKEFILE}.' : Makefile.PL $(CONFIGDEP)
- @echo "Makefile out-of-date with respect to $?"
- @echo "Cleaning current config before rebuilding Makefile..."
- -@mv '."$self->{MAKEFILE} $self->{MAKEFILE}.old".'
- -$(MAKE) -f '.$self->{MAKEFILE}.'.old clean >/dev/null 2>&1 || true
- $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL '."@ARGV".'
- @echo ">>> Your Makefile has been rebuilt. <<<"
- @echo ">>> Please rerun the make command. <<<"; false
-';
-
- join "", @m;
-}
+If an extension is being built below the C<ext/> directory of the perl
+source then MakeMaker will set PERL_SRC automatically (e.g.,
+C<../..>). If PERL_SRC is defined and the extension is recognized as
+a standard extension, then other variables default to the following:
-sub staticmake {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@static);
+ PERL_INC = PERL_SRC
+ PERL_LIB = PERL_SRC/lib
+ PERL_ARCHLIB = PERL_SRC/lib
+ INST_LIB = PERL_LIB
+ INST_ARCHLIB = PERL_ARCHLIB
- my(%searchdirs)=($self->{PERL_ARCHLIB} => 1, $self->{INST_ARCHLIB} => 1);
- my(@searchdirs)=keys %searchdirs;
+If an extension is being built away from the perl source then MakeMaker
+will leave PERL_SRC undefined and default to using the installed copy
+of the perl library. The other variables default to the following:
- # And as it's not yet built, we add the current extension
- # but only if it has some C code (or XS code, which implies C code)
- if (@{$self->{C}}) {
- @static="$self->{INST_ARCHLIB}/auto/$self->{FULLEXT}/$self->{BASEEXT}.$self->{LIB_EXT}";
- }
+ PERL_INC = $archlibexp/CORE
+ PERL_LIB = $privlibexp
+ PERL_ARCHLIB = $archlibexp
+ INST_LIB = ./blib/lib
+ INST_ARCHLIB = ./blib/arch
- # Either we determine now, which libraries we will produce in the
- # subdirectories or we do it at runtime of the make.
+If perl has not yet been installed then PERL_SRC can be defined on the
+command line as shown in the previous section.
- # We could ask all subdir objects, but I cannot imagine, why it
- # would be necessary.
- # Instead we determine all libraries for the new perl at
- # runtime.
- my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
+=head2 Which architecture dependent directory?
- $self->makeaperl(MAKE => $self->{MAKEFILE},
- DIRS => \@searchdirs,
- STAT => \@static,
- INCL => \@perlinc,
- TARGET => $self->{MAP_TARGET},
- TMP => "",
- LIBPERL => $self->{LIBPERL_A}
- );
-}
+If you don't want to keep the defaults for the INSTALL* macros,
+MakeMaker helps you to minimize the typing needed: the usual
+relationship between INSTALLPRIVLIB and INSTALLARCHLIB is determined
+by Configure at perl compilation time. MakeMaker supports the user who
+sets INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not,
+then MakeMaker defaults the latter to be the same subdirectory of
+INSTALLPRIVLIB as Configure decided for the counterparts in %Config ,
+otherwise it defaults to INSTALLPRIVLIB. The same relationship holds
+for INSTALLSITELIB and INSTALLSITEARCH.
-# --- Test and Installation Sections ---
+MakeMaker gives you much more freedom than needed to configure
+internal variables and get different results. It is worth to mention,
+that make(1) also lets you configure most of the variables that are
+used in the Makefile. But in the majority of situations this will not
+be necessary, and should only be done if the author of a package
+recommends it (or you know what you're doing).
-sub test {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : "");
- my(@m);
- push(@m,"
-TEST_VERBOSE=0
-TEST_TYPE=test_\$(LINKTYPE)
-
-test :: \$(TEST_TYPE)
-");
- push(@m, map("\t\@cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
- @{$self->{DIR}}));
- push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n")
- unless $tests or -f "test.pl" or @{$self->{DIR}};
- push(@m, "\n");
-
- push(@m, "test_dynamic :: all\n");
- push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
- push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
- push(@m, "\n");
-
- # Occasionally we may face this degenerated target:
- push @m, "test_ : test_dynamic\n\n";
-
- if ($self->needs_linking()) {
- push(@m, "test_static :: all \$(MAP_TARGET)\n");
- push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests;
- push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
- push(@m, "\n");
- } else {
- push @m, "test_static :: test_dynamic\n";
- }
- join("", @m);
-}
+=head2 Using Attributes and Parameters
-sub test_via_harness {
- my($self, $perl, $tests) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "\tPERL_DL_NONLAZY=1 $perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n";
-}
+The following attributes can be specified as arguments to WriteMakefile()
+or as NAME=VALUE pairs on the command line:
-sub test_via_script {
- my($self, $perl, $script) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "\tPERL_DL_NONLAZY=1 $perl".' -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl
-';
-}
+=over 2
+=item ABSTRACT
-sub postamble {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- "";
-}
+One line description of the module. Will be included in PPD file.
-sub makeaperl {
- my($self, %attribs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
- @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
- my(@m);
- push @m, "
-# --- MakeMaker makeaperl section ---
-MAP_TARGET = $target
-FULLPERL = $self->{FULLPERL}
-";
- return join '', @m if $self->{PARENT};
-
- unless ($self->{MAKEAPERL}) {
- push @m, '
-$(MAP_TARGET) ::
- $(MAKE) LINKTYPE=static all
- $(PERL) Makefile.PL MAKEFILE=Makefile.aperl LINKTYPE=static MAKEAPERL=1 NORECURS=1
- $(MAKE) -f Makefile.aperl $(MAP_TARGET)
-';
- return join '', @m;
- }
+=item ABSTRACT_FROM
-
-
- my($cccmd, $linkcmd, $lperl);
-
-
- $cccmd = $self->const_cccmd($libperl);
- $cccmd =~ s/^CCCMD\s*=\s*//;
- $cccmd =~ s/\s/ -I$self->{PERL_INC} /;
- $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib});
- $cccmd =~ s/\n/ /g; # yes I've seen "\n", don't ask me where it came from. A.K.
-
- # The front matter of the linkcommand...
- $linkcmd = join ' ', "\$(CC)",
- grep($_, @Config{qw(large split ldflags ccdlflags)});
- $linkcmd =~ s/\s+/ /g;
-
- # Which *.a files could we make use of...
- local(%static);
- File::Find::find(sub {
- return unless m/\.$self->{LIB_EXT}$/;
- return if m/^libperl/;
- # don't include the installed version of this extension. I
- # leave this line here, although it is not necessary anymore:
- # I patched minimod.PL instead, so that Miniperl.pm won't
- # enclude duplicates
-
- # Once the patch to minimod.PL is in the distribution, I can
- # drop it
- return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}.$self->{LIB_EXT}$:;
- $static{fastcwd() . "/" . $_}++;
- }, grep( -d $_, @{$searchdirs || []}) );
-
- # We trust that what has been handed in as argument, will be buildable
- $static = [] unless $static;
- @static{@{$static}} = (1) x @{$static};
-
- $extra = [] unless $extra && ref $extra eq 'ARRAY';
- for (sort keys %static) {
- next unless /\.$self->{LIB_EXT}$/;
- $_ = dirname($_) . "/extralibs.ld";
- push @$extra, $_;
- }
+Name of the file that contains the package description. MakeMaker looks
+for a line in the POD matching /^($package\s-\s)(.*)/. This is typically
+the first line in the "=head1 NAME" section. $2 becomes the abstract.
- grep(s/^/-I/, @{$perlinc || []});
+=item AUTHOR
- $target = "perl" unless $target;
- $tmp = "." unless $tmp;
+String containing name (and email address) of package author(s). Is used
+in PPD (Perl Package Description) files for PPM (Perl Package Manager).
-# MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
-# regenerate the Makefiles, MAP_STATIC and the dependencies for
-# extralibs.all are computed correctly
- push @m, "
-MAP_LINKCMD = $linkcmd
-MAP_PERLINC = @{$perlinc || []}
-MAP_STATIC = ",
-join(" \\\n\t", sort keys %static), "
+=item BINARY_LOCATION
-MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib}
-";
+Used when creating PPD files for binary packages. It can be set to a
+full or relative path or URL to the binary archive for a particular
+architecture. For example:
- if (defined $libperl) {
- ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
- }
- unless ($libperl && -f $lperl) { # Could quite follow your idea her, Ilya
- my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
- $libperl ||= "libperl.$self->{LIB_EXT}";
- $libperl = "$dir/$libperl";
- $lperl ||= "libperl.$self->{LIB_EXT}";
- $lperl = "$dir/$lperl";
- print STDOUT "Warning: $libperl not found
- If you're going to build a static perl binary, make sure perl is installed
- otherwise ignore this warning\n"
- unless (-f $lperl || defined($self->{PERL_SRC}));
- }
+ perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz
- push @m, "
-MAP_LIBPERL = $libperl
-";
+builds a PPD package that references a binary of the C<Agent> package,
+located in the C<x86> directory relative to the PPD itself.
- push @m, "
-\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)."
- \@ $self->{RM_F} \$\@
- \@ \$(TOUCH) \$\@
-";
+=item C
- my $catfile;
- foreach $catfile (@$extra){
- push @m, "\tcat $catfile >> \$\@\n";
- }
+Ref to array of *.c file names. Initialised from a directory scan
+and the values portion of the XS attribute hash. This is not
+currently used by MakeMaker but may be handy in Makefile.PLs.
- push @m, "
-\$(MAP_TARGET) :: $tmp/perlmain.\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
- \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain.\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
- @ echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
- @ echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
- @ echo 'To remove the intermediate files say'
- @ echo ' make -f $makefilename map_clean'
-
-$tmp/perlmain.\$(OBJ_EXT): $tmp/perlmain.c
-";
- push @m, "\tcd $tmp && $cccmd perlmain.c\n";
-
- push @m, qq{
-$tmp/perlmain.c: $makefilename}, q{
- @ echo Writing $@
- @ $(FULLPERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
- writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
-
-};
-
-# We write EXTRA outside the perl program to have it eval'd by the shell
- push @m, q{
-doc_inst_perl:
- @ echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
- @ $(FULLPERL) -e 'use ExtUtils::MakeMaker; MY->new->writedoc("Perl binary",' \\
- -e '"$(MAP_TARGET)", "MAP_STATIC=$(MAP_STATIC)",' \\
- -e '"MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' \\
- -- `cat $(INST_ARCHAUTODIR)/extralibs.all` >> $(INSTALLARCHLIB)/perllocal.pod
-};
-
- push @m, qq{
-inst_perl: pure_inst_perl doc_inst_perl
-
-pure_inst_perl: \$(MAP_TARGET)
- $self->{CP} \$(MAP_TARGET) \$(INSTALLBIN)/\$(MAP_TARGET)
-
-clean :: map_clean
-
-map_clean :
- $self->{RM_F} $tmp/perlmain.\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
-};
-
- join '', @m;
-}
+=item CAPI
-sub extliblist {
- my($self,$libs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- require ExtUtils::Liblist;
- ExtUtils::Liblist::ext($libs, $ExtUtils::MakeMaker::Verbose);
-}
+[This attribute is obsolete in Perl 5.6. PERL_OBJECT builds are C-compatible
+by default.]
-sub mksymlists {
- my($self) = shift;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($pkg);
+Switch to force usage of the Perl C API even when compiling for PERL_OBJECT.
- # only AIX requires a symbol list at this point
- # (so does VMS, but that's handled by the MM_VMS package)
- return '' unless $Config::Config{osname} eq 'aix';
+Note that this attribute is passed through to any recursive build,
+but if and only if the submodule's Makefile.PL itself makes no mention
+of the 'CAPI' attribute.
- $self->init_main(@ARGV) unless defined $self->{BASEEXT};
- if (! $self->{DL_FUNCS}) {
- my($bootfunc);
- ($bootfunc = $self->{NAME}) =~ s/\W/_/g;
- $self->{DL_FUNCS} = {$self->{BASEEXT} => ["boot_$bootfunc"]};
- }
- rename "$self->{BASEEXT}.exp", "$self->{BASEEXT}.exp_old";
-
- open(EXP,">$self->{BASEEXT}.exp") or die $!;
- print EXP join("\n",@{$self->{DL_VARS}}, "\n") if $self->{DL_VARS};
- foreach $pkg (keys %{$self->{DL_FUNCS}}) {
- (my($prefix) = $pkg) =~ s/\W/_/g;
- my $func;
- foreach $func (@{$self->{DL_FUNCS}->{$pkg}}) {
- $func = "XS_${prefix}_$func" unless $func =~ /^boot_/;
- print EXP "$func\n";
- }
- }
- close EXP;
-}
+=item CCFLAGS
-# --- Make-Directories section (internal method) ---
-# dir_target(@array) returns a Makefile entry for the file .exists in each
-# named directory. Returns nothing, if the entry has already been processed.
-# We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
-# Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
-# prerequisite, because there has to be one, something that doesn't change
-# too often :)
-
-sub dir_target {
- my($self,@dirs) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my(@m,$dir);
- foreach $dir (@dirs) {
- next if $self->{DIR_TARGET}{$self}{$dir}++;
- push @m, "
-$dir/.exists :: \$(PERL)
- \@ \$(MKPATH) $dir
- \@ \$(TOUCH) $dir/.exists
- \@-\$(CHMOD) 755 $dir
-";
- }
- join "", @m;
-}
+String that will be included in the compiler call command line between
+the arguments INC and OPTIMIZE.
-# --- Output postprocessing section ---
-# nicetext is included to make VMS support easier
-sub nicetext { # Just return the input - no action needed
- my($self,$text) = @_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- $text;
-}
+=item CONFIG
-sub needs_linking { # Does this module need linking? Looks into
- # subdirectory objects (see also has_link_code()
- my($self) = shift;
- my($child,$caller);
- $caller = (caller(0))[3];
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse($caller);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/;
- return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
-# print "DEBUG:\n";
-# print Carp::longmess();
-# print "EO_DEBUG\n";
- if ($self->has_link_code){
- $self->{NEEDS_LINKING} = 1;
- return 1;
- }
- foreach $child (keys %{$self->{CHILDREN}}) {
- if ($self->{CHILDREN}->{$child}->needs_linking) {
- $self->{NEEDS_LINKING} = 1;
- return 1;
- }
- }
- return $self->{NEEDS_LINKING} = 0;
-}
+Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
+config.sh. MakeMaker will add to CONFIG the following values anyway:
+ar
+cc
+cccdlflags
+ccdlflags
+dlext
+dlsrc
+ld
+lddlflags
+ldflags
+libc
+lib_ext
+obj_ext
+ranlib
+sitelibexp
+sitearchexp
+so
-sub has_link_code {
- my($self) = shift;
- return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
- if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB} or $self->{MAKEAPERL}){
- $self->{HAS_LINK_CODE} = 1;
- return 1;
- }
- return $self->{HAS_LINK_CODE} = 0;
-}
+=item CONFIGURE
-# --- perllocal.pod section ---
-sub writedoc {
- my($self,$what,$name,@attribs)=@_;
- unless (ref $self){
- ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
- $self = $ExtUtils::MakeMaker::Parent[-1];
- }
- my($time);
- require "ctime.pl";
- chop($time = ctime(time));
- print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
- print join "\n\n=item *\n\n", map("C<$_>",@attribs);
- print "\n\n=back\n\n";
-}
+CODE reference. The subroutine should return a hash reference. The
+hash may contain further attributes, e.g. {LIBS =E<gt> ...}, that have to
+be determined by some evaluation method.
-sub catdir { shift; join('/',@_); }
-sub catfile { shift; join('/',@_); }
+=item DEFINE
-package ExtUtils::MM_OS2;
+Something like C<"-DHAVE_UNISTD_H">
-#use Config;
-#use Cwd;
-#use File::Basename;
-require Exporter;
+=item DIR
-Exporter::import('ExtUtils::MakeMaker',
- qw( $Verbose));
+Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm'
+] in ext/SDBM_File
-sub dlsyms {
- my($self,%attribs) = @_;
+=item DISTNAME
- my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my(@m);
- (my $boot = $self->{NAME}) =~ s/:/_/g;
-
- if (not $self->{SKIPHASH}{'dynamic'}) {
- push(@m,"
-$self->{BASEEXT}.def: Makefile.PL"
- . '
- echo "LIBRARY ' . "'$self->{DLBASE}'" . ' INITINSTANCE TERMINSTANCE" > $@ ; \\
- echo "CODE LOADONCALL" >> $@ ; \\
- echo "DATA LOADONCALL NONSHARED MULTIPLE" >> $@ ; \\
- echo "EXPORTS" >> $@ ; \\
- echo " ' . "boot_$boot" . '" >> $@');
- foreach $sym (keys %$funcs, @$vars) {
- push(@m, " ; \\
- echo \" $sym\" >> \$@");
- }
- push(@m,"\n");
- }
+Your name for distributing the package (by tar file). This defaults to
+NAME above.
- join('',@m);
-}
+=item DL_FUNCS
-sub replace_manpage_seperator {
- my($self,$man) = @_;
- $man =~ s,/+,.,g;
- $man;
-}
+Hashref of symbol names for routines to be made available as universal
+symbols. Each key/value pair consists of the package name and an
+array of routine names in that package. Used only under AIX, OS/2,
+VMS and Win32 at present. The routine names supplied will be expanded
+in the same way as XSUB names are expanded by the XS() macro.
+Defaults to
-# the following keeps AutoSplit happy
-package ExtUtils::MakeMaker;
-1;
+ {"$(NAME)" => ["boot_$(NAME)" ] }
-__END__
+e.g.
-=head1 NAME
+ {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
+ "NetconfigPtr" => [ 'DESTROY'] }
-ExtUtils::MakeMaker - create an extension Makefile
+Please see the L<ExtUtils::Mksymlists> documentation for more information
+about the DL_FUNCS, DL_VARS and FUNCLIST attributes.
-=head1 SYNOPSIS
+=item DL_VARS
-C<use ExtUtils::MakeMaker;>
+Array of symbol names for variables to be made available as universal symbols.
+Used only under AIX, OS/2, VMS and Win32 at present. Defaults to [].
+(e.g. [ qw(Foo_version Foo_numstreams Foo_tree ) ])
-C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );>
+=item EXCLUDE_EXT
-which is really
+Array of extension names to exclude when doing a static build. This
+is ignored if INCLUDE_EXT is present. Consult INCLUDE_EXT for more
+details. (e.g. [ qw( Socket POSIX ) ] )
-C<MM-E<gt>new(\%att)-E<gt>flush;>
+This attribute may be most useful when specified as a string on the
+command line: perl Makefile.PL EXCLUDE_EXT='Socket Safe'
-=head1 DESCRIPTION
+=item EXE_FILES
-This utility is designed to write a Makefile for an extension module
-from a Makefile.PL. It is based on the Makefile.SH model provided by
-Andy Dougherty and the perl5-porters.
+Ref to array of executable files. The files will be copied to the
+INST_SCRIPT directory. Make realclean will delete them from there
+again.
-It splits the task of generating the Makefile into several subroutines
-that can be individually overridden. Each subroutine returns the text
-it wishes to have written to the Makefile.
+=item FIRST_MAKEFILE
-MakeMaker.pm uses the architecture specific information from
-Config.pm. In addition it evaluates architecture specific hints files
-in a C<hints/> directory. The hints files are expected to be named
-like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
-name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
-MakeMaker within the WriteMakefile() subroutine, and can be used to
-execute commands as well as to include special variables. The rules
-which hintsfile is chosen are the same as in Configure.
+The name of the Makefile to be produced. Defaults to the contents of
+MAKEFILE, but can be overridden. This is used for the second Makefile
+that will be produced for the MAP_TARGET.
-=head2 What's new in version 5 of MakeMaker
+=item FULLPERL
-MakeMaker 5 is pure object oriented. This allows us to write an
-unlimited number of Makefiles with a single perl process. 'perl
-Makefile.PL' with MakeMaker 5 goes through all subdirectories
-immediately and evaluates any Makefile.PL found in the next level
-subdirectories. The benefit of this approach comes in useful for both
-single and multi directories extensions.
+Perl binary able to run this extension.
-Multi directory extensions have an immediately visible speed
-advantage, because there's no startup penalty for any single
-subdirectory Makefile.
+=item FUNCLIST
-Single directory packages benefit from the much improved
-needs_linking() method. As the main Makefile knows everything about
-the subdirectories, a needs_linking() method can now query all
-subdirectories if there is any linking involved down in the tree. The
-speedup for PM-only Makefiles seems to be around 1 second on my
-Indy 100 MHz.
+This provides an alternate means to specify function names to be
+exported from the extension. Its value is a reference to an
+array of function names to be exported by the extension. These
+names are passed through unaltered to the linker options file.
-=head2 Incompatibilities between MakeMaker 5.00 and 4.23
+=item H
-There are no incompatibilities in the short term, as all changes are
-accompanied by short-term workarounds that guarantee full backwards
-compatibility.
+Ref to array of *.h file names. Similar to C.
-You are likely to face a few warnings that expose depreciations which
-will result in incompatibilities in the long run:
+=item HTMLLIBPODS
-You should not use %att directly anymore. Instead any subroutine you
-override in the MY package will be called by the object method, so you
-can access all object attributes directly via the object in $_[0].
+Hashref of .pm and .pod files. MakeMaker will default this to all
+ .pod and any .pm files that include POD directives. The files listed
+here will be converted to HTML format and installed as was requested
+at Configure time.
-You should not call the class methos MM->something anymore. Instead
-you should call the superclass. Something like
+=item HTMLSCRIPTPODS
- sub MY::constants {
- my $self = shift;
- local *constants;
- $self->MM::constants();
- }
+Hashref of pod-containing files. MakeMaker will default this to all
+EXE_FILES files that include POD directives. The files listed
+here will be converted to HTML format and installed as was requested
+at Configure time.
-Especially the libscan() and exescan() methods should be altered
-towards OO programming, that means do not expect that $_ to contain
-the path but rather $_[1].
+=item IMPORTS
-You should program with more care. Watch out for any MakeMaker
-variables. Do not try to alter them, somebody else might depend on
-them. E.g. do not overwrite the ExtUtils::MakeMaker::VERSION variable
-(this happens if you import it and then set it to the version number
-of your package), do not expect that the INST_LIB variable will be
-./blib (do not 'unshift @INC, "./blib" and do not use
-"blib/FindBin.pm"). Do not croak in your Makefile.PL, let it fail with
-a warning instead.
+This attribute is used to specify names to be imported into the
+extension. It is only used on OS/2 and Win32.
-Try to build several extensions simultanously to debug your
-Makefile.PL. You can unpack a bunch of distributed packages, so your
-directory looks like
+=item INC
- Alias-1.00/ Net-FTP-1.01a/ Set-Scalar-0.001/
- ExtUtils-Peek-0.4/ Net-Ping-1.00/ SetDualVar-1.0/
- Filter-1.06/ NetTools-1.01a/ Storable-0.1/
- GD-1.00/ Religion-1.04/ Sys-Domain-1.05/
- MailTools-1.03/ SNMP-1.5b/ Term-ReadLine-0.7/
+Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
-and write a dummy Makefile.PL that contains nothing but
+=item INCLUDE_EXT
- use ExtUtils::MakeMaker;
- WriteMakefile();
+Array of extension names to be included when doing a static build.
+MakeMaker will normally build with all of the installed extensions when
+doing a static build, and that is usually the desired behavior. If
+INCLUDE_EXT is present then MakeMaker will build only with those extensions
+which are explicitly mentioned. (e.g. [ qw( Socket POSIX ) ])
-That's actually fun to watch :)
+It is not necessary to mention DynaLoader or the current extension when
+filling in INCLUDE_EXT. If the INCLUDE_EXT is mentioned but is empty then
+only DynaLoader and the current extension will be included in the build.
-Final suggestion: Try to delete all of your MY:: subroutines and
-watch, if you really still need them. MakeMaker might already do what
-you want without them. That's all about it.
+This attribute may be most useful when specified as a string on the
+command line: perl Makefile.PL INCLUDE_EXT='POSIX Socket Devel::Peek'
+=item INSTALLARCHLIB
-=head2 Default Makefile Behaviour
+Used by 'make install', which copies files from INST_ARCHLIB to this
+directory if INSTALLDIRS is set to perl.
-The automatically generated Makefile enables the user of the extension
-to invoke
+=item INSTALLBIN
- perl Makefile.PL # optionally "perl Makefile.PL verbose"
- make
- make test # optionally set TEST_VERBOSE=1
- make install # See below
+Directory to install binary files (e.g. tkperl) into.
-The Makefile to be produced may be altered by adding arguments of the
-form C<KEY=VALUE>. If the user wants to work with a different perl
-than the default, this can be achieved with
+=item INSTALLDIRS
- perl Makefile.PL PERL=/tmp/myperl5
+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.
-Other interesting targets in the generated Makefile are
+=item INSTALLHTMLPRIVLIBDIR
- make config # to check if the Makefile is up-to-date
- make clean # delete local temp files (Makefile gets renamed)
- make realclean # delete derived files (including ./blib)
- make dist # see below the Distribution Support section
+This directory gets the HTML pages at 'make install' time. Defaults to
+$Config{installhtmlprivlibdir}.
-=head2 Special case make install
+=item INSTALLHTMLSCRIPTDIR
-make alone puts all relevant files into directories that are named by
-the macros INST_LIB, INST_ARCHLIB, INST_EXE, INST_MAN1DIR, and
-INST_MAN3DIR. All these default to ./blib or something below blib if
-you are I<not> building below the perl source directory. If you I<are>
-building below the perl source, INST_LIB and INST_ARCHLIB default to
-../../lib, and INST_EXE is not defined.
+This directory gets the HTML pages at 'make install' time. Defaults to
+$Config{installhtmlscriptdir}.
-The I<install> target of the generated Makefile is a recursive call to
-make which sets
+=item INSTALLHTMLSITELIBDIR
- INST_LIB to INSTALLPRIVLIB
- INST_ARCHLIB to INSTALLARCHLIB
- INST_EXE to INSTALLBIN
- INST_MAN1DIR to INSTALLMAN1DIR
- INST_MAN3DIR to INSTALLMAN3DIR
+This directory gets the HTML pages at 'make install' time. Defaults to
+$Config{installhtmlsitelibdir}.
-The INSTALL... macros in turn default to their %Config
-($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
-The recommended way to proceed is to set only the INSTALL* macros, not
-the INST_* targets. In doing so, you give room to the compilation
-process without affecting important directories. Usually a make
-test will succeed after the make, and a make install can finish
-the game.
+=item INSTALLMAN1DIR
-MakeMaker gives you much more freedom than needed to configure
-internal variables and get different results. It is worth to mention,
-that make(1) also lets you configure most of the variables that are
-used in the Makefile. But in the majority of situations this will not
-be necessary, and should only be done, if the author of a package
-recommends it.
+This directory gets the man pages at 'make install' time. Defaults to
+$Config{installman1dir}.
-The usual relationship between INSTALLPRIVLIB and INSTALLARCHLIB is
-that the latter is a subdirectory of the former with the name
-C<$Config{archname}>, MakeMaker supports the user who sets
-INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not, then
-MakeMaker defaults the latter to be INSTALLPRIVLIB/ARCHNAME if that
-directory exists, otherwise it defaults to INSTALLPRIVLIB.
+=item INSTALLMAN3DIR
+This directory gets the man pages at 'make install' time. Defaults to
+$Config{installman3dir}.
-=head2 PREFIX attribute
+=item INSTALLPRIVLIB
-The PREFIX attribute can be used to set the INSTALL*
-attributes in one go. This is the quickest way to install a module in
-a non-standard place.
+Used by 'make install', which copies files from INST_LIB to this
+directory if INSTALLDIRS is set to perl.
- perl Makefile.PL PREFIX=~
+=item INSTALLSCRIPT
-This is identical to
+Used by 'make install' which copies files from INST_SCRIPT to this
+directory.
- perl Makefile.PL INSTALLPRIVLIB=~/perl5/lib INSTALLBIN=~/bin \
- INSTAMAN1DIR=~/perl5/man/man1 INSTALLMAN3DIR=~/perl5/man/man3
+=item INSTALLSITEARCH
-Note, that the tilde expansion is done by MakeMaker, not by perl by
-default, nor by make.
+Used by 'make install', which copies files from INST_ARCHLIB to this
+directory if INSTALLDIRS is set to site (default).
-It is important to know, that the INSTALL* macros should be absolute
-paths, never relativ ones. Packages with multiple Makefile.PLs in
-different directories get the contents of the INSTALL* macros
-propagated verbatim. (The INST_* macros will be corrected, if they are
-relativ paths, but not the INSTALL* macros.)
+=item INSTALLSITELIB
-If the user has superuser privileges, and is not working on AFS
-(Andrew File System) or relatives, then the defaults for
-INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLBIN, etc. will be appropriate,
-and this incantation will be the best:
+Used by 'make install', which copies files from INST_LIB to this
+directory if INSTALLDIRS is set to site (default).
- perl Makefile.PL; make; make test
- make install
+=item INST_ARCHLIB
-make install per default writes some documentation of what has been
-done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This is
-an experimental feature. It can be bypassed by calling make
-pure_install.
+Same as INST_LIB for architecture dependent files.
-=head2 AFS users
+=item INST_BIN
-will have to specify the installation directories as these most
-probably have changed since perl itself has been installed. They will
-have to do this by calling
+Directory to put real binary files during 'make'. These will be copied
+to INSTALLBIN during 'make install'
- perl Makefile.PL INSTALLPRIVLIB=/afs/here/today \
- INSTALLBIN=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
- make
+=item INST_EXE
-In nested extensions with many subdirectories, the INSTALL* arguments
-will get propagated to the subdirectories. Be careful to repeat this
-procedure every time you recompile an extension, unless you are sure
-the AFS istallation directories are still valid.
+Old name for INST_SCRIPT. Deprecated. Please use INST_SCRIPT if you
+need to use it.
+=item INST_HTMLLIBDIR
+Directory to hold the man pages in HTML format at 'make' time
-=head2 Static Linking of a new Perl Binary
+=item INST_HTMLSCRIPTDIR
-An extension that is built with the above steps is ready to use on
-systems supporting dynamic loading. On systems that do not support
-dynamic loading, any newly created extension has to be linked together
-with the available resources. MakeMaker supports the linking process
-by creating appropriate targets in the Makefile whenever an extension
-is built. You can invoke the corresponding section of the makefile with
+Directory to hold the man pages in HTML format at 'make' time
- make perl
+=item INST_LIB
-That produces a new perl binary in the current directory with all
-extensions linked in that can be found in INST_ARCHLIB (which usually
-is C<./blib>) and PERL_ARCHLIB.
+Directory where we put library files of this extension while building
+it.
-The binary can be installed into the directory where perl normally
-resides on your machine with
+=item INST_MAN1DIR
- make inst_perl
+Directory to hold the man pages at 'make' time
-To produce a perl binary with a different name than C<perl>, either say
+=item INST_MAN3DIR
- perl Makefile.PL MAP_TARGET=myperl
- make myperl
- make inst_perl
+Directory to hold the man pages at 'make' time
-or say
+=item INST_SCRIPT
- perl Makefile.PL
- make myperl MAP_TARGET=myperl
- make inst_perl MAP_TARGET=myperl
+Directory, where executable files should be installed during
+'make'. Defaults to "./blib/script", just to have a dummy location during
+testing. make install will copy the files in INST_SCRIPT to
+INSTALLSCRIPT.
-In any case you will be prompted with the correct invocation of the
-C<inst_perl> target that installs the new binary into INSTALLBIN.
+=item LDFROM
-Note, that there is a C<makeaperl> scipt in the perl distribution,
-that supports the linking of a new perl binary in a similar fashion,
-but with more options.
+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)
-make inst_perl per default writes some documentation of what has been
-done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
-can be bypassed by calling make pure_inst_perl.
+=item LIB
-Warning: the inst_perl: target is rather mighty and will probably
-overwrite your existing perl binary. Use with care!
+LIB should only be set at C<perl Makefile.PL> time but is allowed as a
+MakeMaker argument. It has the effect of
+setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any
+explicit setting of those arguments (or of PREFIX).
+INSTALLARCHLIB and INSTALLSITEARCH are set to the corresponding
+architecture subdirectory.
-Sometimes you might want to build a statically linked perl although
-your system supports dynamic loading. In this case you may explicitly
-set the linktype with the invocation of the Makefile.PL or make:
+=item LIBPERL_A
- perl Makefile.PL LINKTYPE=static # recommended
+The filename of the perllibrary that will be used together with this
+extension. Defaults to libperl.a.
-or
+=item LIBS
- make LINKTYPE=static # works on most systems
+An anonymous array of alternative library
+specifications to be searched for (in order) until
+at least one library is found. E.g.
-=head2 Determination of Perl Library and Installation Locations
+ 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
-MakeMaker needs to know, or to guess, where certain things are
-located. Especially INST_LIB and INST_ARCHLIB (where to install files
-into), PERL_LIB and PERL_ARCHLIB (where to read existing modules
-from), and PERL_INC (header files and C<libperl*.*>).
+Mind, that any element of the array
+contains a complete set of arguments for the ld
+command. So do not specify
-Extensions may be built either using the contents of the perl source
-directory tree or from an installed copy of the perl library.
+ 'LIBS' => ["-ltcl", "-ltk", "-lX11"]
-If an extension is being built below the C<ext/> directory of the perl
-source then MakeMaker will set PERL_SRC automatically (e.g., C<../..>).
-If PERL_SRC is defined then other variables default to the following:
+See ODBM_File/Makefile.PL for an example, where an array is needed. If
+you specify a scalar as in
- PERL_INC = PERL_SRC
- PERL_LIB = PERL_SRC/lib
- PERL_ARCHLIB = PERL_SRC/lib
- INST_LIB = PERL_LIB
- INST_ARCHLIB = PERL_ARCHLIB
+ 'LIBS' => "-ltcl -ltk -lX11"
-If an extension is being built away from the perl source then MakeMaker
-will leave PERL_SRC undefined and default to using the installed copy
-of the perl library. The other variables default to the following:
+MakeMaker will turn it into an array with one element.
- PERL_INC = $archlib/CORE
- PERL_LIB = $privlib
- PERL_ARCHLIB = $archlib
- INST_LIB = ./blib
- INST_ARCHLIB = ./blib/<archname>
+=item LINKTYPE
-If perl has not yet been installed then PERL_SRC can be defined on the
-command line as shown in the previous section.
+'static' or 'dynamic' (default unless usedl=undef in
+config.sh). Should only be used to force static linking (also see
+linkext below).
-=head2 Useful Default Makefile Macros
+=item MAKEAPERL
-FULLEXT = Pathname for extension directory (eg DBD/Oracle).
+Boolean which tells MakeMaker, that it should include the rules to
+make a perl. This is handled automatically as a switch by
+MakeMaker. The user normally does not need it.
-BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
+=item MAKEFILE
-ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
+The name of the Makefile to be produced.
-INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)>
+=item MAN1PODS
-INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)>
+Hashref of pod-containing files. MakeMaker will default this to all
+EXE_FILES files that include POD directives. The files listed
+here will be converted to man pages and installed as was requested
+at Configure time.
-INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)>
+=item MAN3PODS
-=head2 Using Attributes (and Parameters)
+Hashref of .pm and .pod files. MakeMaker will default this to all
+ .pod and any .pm files that include POD directives. The files listed
+here will be converted to man pages and installed as was requested
+at Configure time.
-The following attributes can be specified as arguments to WriteMakefile()
-or as NAME=VALUE pairs on the command line:
+=item MAP_TARGET
-=cut
+If it is intended, that a new perl binary be produced, this variable
+may hold a name for that binary. Defaults to perl
-# The following "=item NAME" is used by the attrib_help routine
-# likewise the "=back" below. So be careful when changing it!
+=item MYEXTLIB
-=over 2
+If the extension links to a library that it builds set this to the
+name of the library (see SDBM_File)
=item NAME
to the directory name but should be explicitly defined in the
Makefile.PL.
-=item DISTNAME
+=item NEEDS_LINKING
-Your name for distributing the package (by tar file) This defaults to
-NAME above.
+MakeMaker will figure out if an extension contains linkable code
+anywhere down the directory tree, and will set this variable
+accordingly, but you can speed it up a very little bit if you define
+this boolean variable yourself.
-=item VERSION
+=item NOECHO
-Your version number for distributing the package. This defaults to
-0.1.
+Defaults to C<@>. By setting it to an empty string you can generate a
+Makefile that echos all commands. Mainly used in debugging MakeMaker
+itself.
-=item CONFIGURE
+=item NORECURS
-CODE reference. Extension writers are requested to do all their
-initializing within that subroutine. The subroutine
-should return a hash reference. The hash may contain
-further attributes, e.g. {LIBS => ...}, that have to
-be determined by some evaluation method.
+Boolean. Attribute to inhibit descending into subdirectories.
-=item NEEDS_LINKING
+=item NO_VC
-MakeMaker will figure out, if an extension contains linkable code
-anywhere down the directory tree, but you can speed him up a little
-bit, if you define this boolean variable yourself. Extensions that do
-not need linking will be given a reduced Makefile yielding a
-considerable speedadvantage.
+In general, any generated Makefile checks for the current version of
+MakeMaker and the version the Makefile was built under. If NO_VC is
+set, the version check is neglected. Do not write this into your
+Makefile.PL, use it interactively instead.
-=item INST_LIB
+=item OBJECT
-Directory where we put library files of this extension while building
-it.
+List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
+string containing all object files, e.g. "tkpBind.o
+tkpButton.o tkpCanvas.o"
-=item INSTALLPRIVLIB
+(Where BASEEXT is the last component of NAME, and OBJ_EXT is $Config{obj_ext}.)
-Used by 'make install', which sets INST_LIB to this value.
+=item OPTIMIZE
-=item INST_ARCHLIB
+Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is
+passed to subdirectory makes.
-Same as INST_LIB for architecture dependent files.
+=item PERL
-=item INSTALLARCHLIB
+Perl binary for tasks that can be done by miniperl
-Used by 'make install', which sets INST_ARCHLIB to this value.
+=item PERLMAINCC
-=item INST_EXE
+The call to the program that is able to compile perlmain.c. Defaults
+to $(CC).
-Directory, where executable scripts should be installed during
-'make'. Defaults to "./blib/ARCHNAME", just to have a dummy
-location during testing. make install will set
-INST_EXE to INSTALLBIN.
+=item PERL_ARCHLIB
-=item INSTALLBIN
+Same as below, but for architecture dependent files.
-Used by 'make install' which sets INST_EXE to this value.
+=item PERL_LIB
-=item INST_MAN1DIR
+Directory containing the Perl library to use.
-=item INST_MAN3DIR
+=item PERL_MALLOC_OK
-These directories get the man pages at 'make' time
+defaults to 0. Should be set to TRUE if the extension can work with
+the memory allocation routines substituted by the Perl malloc() subsystem.
+This should be applicable to most extensions with exceptions of those
-=item INSTALLMAN1DIR
+=over 4
-=item INSTALLMAN3DIR
+=item *
-These directories get the man pages at 'make install' time
+with bugs in memory allocations which are caught by Perl's malloc();
-=item PREFIX
+=item *
-Can be used to set the three INSTALL* attributes above in one go.
-They will have PREFIX as a common directory node and
-will branch from that node into lib/, lib/ARCHNAME,
-and bin/ unless you override one of them.
+which interact with the memory allocator in other ways than via
+malloc(), realloc(), free(), calloc(), sbrk() and brk();
-=item PERL_LIB
+=item *
-Directory containing the Perl library to use.
+which rely on special alignment which is not provided by Perl's malloc().
-=item PERL_ARCHLIB
+=back
-Same as above for architecture dependent files
+B<NOTE.> Negligence to set this flag in I<any one> of loaded extension
+nullifies many advantages of Perl's malloc(), such as better usage of
+system resources, error detection, memory usage reporting, catchable failure
+of memory allocations, etc.
=item PERL_SRC
Directory containing the Perl source code (use of this should be
avoided, it may be undefined)
-=item INC
-
-Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
-
-=item DEFINE
-
-Something like C<"-DHAVE_UNISTD_H">
-
-=item OBJECT
-
-List of object files, defaults to '$(BASEEXT).$(OBJ_EXT)', but can be a long
-string containing all object files, e.g. "tkpBind.o
-tkpButton.o tkpCanvas.o"
+=item PERM_RW
-=item MYEXTLIB
-
-If the extension links to a library that it builds set this to the
-name of the library (see SDBM_File)
+Desired permission for read/writable files. Defaults to C<644>.
+See also L<MM_Unix/perm_rw>.
-=item LIBS
-
-An anonymous array of alternative library
-specifications to be searched for (in order) until
-at least one library is found. E.g.
+=item PERM_RWX
- 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
+Desired permission for executable files. Defaults to C<755>.
+See also L<MM_Unix/perm_rwx>.
-Mind, that any element of the array
-contains a complete set of arguments for the ld
-command. So do not specify
+=item PL_FILES
- 'LIBS' => ["-ltcl", "-ltk", "-lX11"]
+Ref to hash of files to be processed as perl programs. MakeMaker
+will default to any found *.PL file (except Makefile.PL) being keys
+and the basename of the file being the value. E.g.
-See ODBM_File/Makefile.PL for an example, where an array is needed. If
-you specify a scalar as in
+ {'foobar.PL' => 'foobar'}
- 'LIBS' => "-ltcl -ltk -lX11"
+The *.PL files are expected to produce output to the target files
+themselves. If multiple files can be generated from the same *.PL
+file then the value in the hash can be a reference to an array of
+target file names. E.g.
-MakeMaker will turn it into an array with one element.
+ {'foobar.PL' => ['foobar1','foobar2']}
-=item LDFROM
+=item PM
-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)
+Hashref of .pm files and *.pl files to be installed. e.g.
-=item DIR
+ {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'}
-Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm'
-] in ext/SDBM_File
+By default this will include *.pm and *.pl and the files found in
+the PMLIBDIRS directories. Defining PM in the
+Makefile.PL will override PMLIBDIRS.
=item PMLIBDIRS
Ref to array of subdirectories containing library files. Defaults to
-[ 'lib', $(BASEEXT) ]. The directories will be scanned and any files
+[ 'lib', $(BASEEXT) ]. The directories will be scanned and I<any> files
they contain will be installed in the corresponding location in the
library. A libscan() method can be used to alter the behaviour.
Defining PM in the Makefile.PL will override PMLIBDIRS.
-=item PM
+(Where BASEEXT is the last component of NAME.)
-Hashref of .pm files and *.pl files to be installed. e.g.
+=item POLLUTE
- {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'}
+Release 5.005 grandfathered old global symbol names by providing preprocessor
+macros for extension source compatibility. As of release 5.6, these
+preprocessor definitions are not available by default. The POLLUTE flag
+specifies that the old names should still be defined:
-By default this will include *.pm and *.pl. If a lib directory
-exists and is not listed in DIR (above) then any *.pm and *.pl files
-it contains will also be included by default. Defining PM in the
-Makefile.PL will override PMLIBDIRS.
+ perl Makefile.PL POLLUTE=1
-=item XS
+Please inform the module author if this is necessary to successfully install
+a module under 5.6 or later.
-Hashref of .xs files. MakeMaker will default this. e.g.
+=item PPM_INSTALL_EXEC
- {'name_of_file.xs' => 'name_of_file.c'}
+Name of the executable used to run C<PPM_INSTALL_SCRIPT> below. (e.g. perl)
-The .c files will automatically be included in the list of files
-deleted by a make clean.
+=item PPM_INSTALL_SCRIPT
-=item C
+Name of the script that gets executed by the Perl Package Manager after
+the installation of a package.
-Ref to array of *.c file names. Initialised from a directory scan
-and the values portion of the XS attribute hash. This is not
-currently used by MakeMaker but may be handy in Makefile.PLs.
+=item PREFIX
-=item H
+Can be used to set the three INSTALL* attributes in one go (except for
+probably INSTALLMAN1DIR, if it is not below PREFIX according to
+%Config). They will have PREFIX as a common directory node and will
+branch from that node into lib/, lib/ARCHNAME or whatever Configure
+decided at the build time of your perl (unless you override one of
+them, of course).
+
+=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 SKIP
-Ref to array of *.h file names. Similar to C above.
+Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the
+Makefile. Caution! Do not use the SKIP attribute for the negligible
+speedup. It may seriously damage the resulting Makefile. Only use it
+if you really need it.
=item TYPEMAPS
precedence, even if it isn't listed in TYPEMAPS. The default system
typemap has lowest precedence.
-=item PL_FILES
-
-Ref to hash of files to be processed as perl programs. MakeMaker
-will default to any found *.PL file (except Makefile.PL) being keys
-and the basename of the file being the value. E.g.
-
- {'foobar.PL' => 'foobar'}
-
-The *.PL files are expected to produce output to the target files
-themselves.
-
-=item EXE_FILES
-
-Ref to array of executable files. The files will be copied to the
-INST_EXE directory. Make realclean will delete them from there
-again.
-
-=item LINKTYPE
-
-'static' or 'dynamic' (default unless usedl=undef in config.sh) Should
-only be used to force static linking (also see
-linkext below).
-
-=item DL_FUNCS
+=item VERSION
-Hashref of symbol names for routines to be made available as
-universal symbols. Each key/value pair consists of the package name
-and an array of routine names in that package. Used only under AIX
-(export lists) and VMS (linker options) at present. The routine
-names supplied will be expanded in the same way as XSUB names are
-expanded by the XS() macro. Defaults to
+Your version number for distributing the package. This defaults to
+0.1.
- {"$(NAME)" => ["boot_$(NAME)" ] }
+=item VERSION_FROM
-e.g.
+Instead of specifying the VERSION in the Makefile.PL you can let
+MakeMaker parse a file to determine the version number. The parsing
+routine requires that the file named by VERSION_FROM contains one
+single line to compute the version number. The first line in the file
+that contains the regular expression
- {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
- "NetconfigPtr" => [ 'DESTROY'] }
+ /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
-=item DL_VARS
+will be evaluated with eval() and the value of the named variable
+B<after> the eval() will be assigned to the VERSION attribute of the
+MakeMaker object. The following lines will be parsed o.k.:
-Array of symbol names for variables to be made available as
-universal symbols. Used only under AIX (export lists) and VMS
-(linker options) at present. Defaults to []. (e.g. [ qw(
-Foo_version Foo_numstreams Foo_tree ) ])
+ $VERSION = '1.00';
+ *VERSION = \'1.01';
+ ( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/;
+ $FOO::VERSION = '1.10';
+ *FOO::VERSION = \'1.11';
+ our $VERSION = 1.2.3; # new for perl5.6.0
-=item CONFIG
+but these will fail:
-Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
-config.sh
+ my $VERSION = '1.01';
+ local $VERSION = '1.02';
+ local $FOO::VERSION = '1.30';
-=item SKIP
+(Putting C<my> or C<local> on the preceding line will work o.k.)
-Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the
-Makefile
+The file named in VERSION_FROM is not added as a dependency to
+Makefile. This is not really correct, but it would be a major pain
+during development to have to rewrite the Makefile for any smallish
+change in that file. If you want to make sure that the Makefile
+contains the correct VERSION macro after any change of the file, you
+would have to do something like
-=item MAP_TARGET
+ depend => { Makefile => '$(VERSION_FROM)' }
-If it is intended, that a new perl binary be produced, this variable
-may hold a name for that binary. Defaults to perl
+See attribute C<depend> below.
-=item LIBPERL_A
+=item XS
-The filename of the perllibrary that will be used together with this
-extension. Defaults to libperl.a.
+Hashref of .xs files. MakeMaker will default this. e.g.
-=item PERL
+ {'name_of_file.xs' => 'name_of_file.c'}
-Perl binary for tasks that can be done by miniperl
+The .c files will automatically be included in the list of files
+deleted by a make clean.
-=item FULLPERL
+=item XSOPT
-Perl binary able to run this extension.
+String of options to pass to xsubpp. This might include C<-C++> or
+C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for
+that purpose.
-=item PREREQ
+=item XSPROTOARG
-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. (Not yet implemented!)
+May be set to an empty string, which is identical to C<-prototypes>, or
+C<-noprototypes>. See the xsubpp documentation for details. MakeMaker
+defaults to the empty string.
-=item NORECURS
+=item XS_VERSION
-Boolean. Experimental attribute to inhibit descending into
-subdirectories.
+Your version number for the .xs file of this package. This defaults
+to the value of the VERSION attribute.
-=item MANPODS
+=back
-Hashref of .pm and .pod files. MakeMaker will default this to all
-.pod and any .pm files that include POD directives. The files listed
-here will be converted to man pages and installed as was requested
-at Configure time.
+=head2 Additional lowercase attributes
-=item MAKEAPERL
+can be used to pass parameters to the methods which implement that
+part of the Makefile.
-Boolean which tells MakeMaker, that it should include the rules to
-make a perl. This is handled automatically as a switch by
-MakeMaker. The user normally does not need it.
+=over 2
-=item MAKEFILE
+=item clean
-The name of the Makefile to be produced.
+ {FILES => "*.xyz foo"}
-=back
+=item depend
-=head2 Additional lowercase attributes
+ {ANY_TARGET => ANY_DEPENDECY, ...}
-can be used to pass parameters to the methods which implement that
-part of the Makefile. These are not normally required:
+(ANY_TARGET must not be given a double-colon rule by MakeMaker.)
-=over 2
+=item dist
-=item macro
+ {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz',
+ SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip',
+ ZIPFLAGS => '-rl', DIST_DEFAULT => 'private tardist' }
- {ANY_MACRO => ANY_VALUE, ...}
+If you specify COMPRESS, then SUFFIX should also be altered, as it is
+needed to tell make the target file of the compression. Setting
+DIST_CP to ln can be useful, if you need to preserve the timestamps on
+your files. DIST_CP can take the values 'cp', which copies the file,
+'ln', which links the file, and 'best' which copies symbolic links and
+links the rest. Default is 'best'.
-=item installpm
+=item dynamic_lib
- {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'}
+ {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'}
=item linkext
{LINKTYPE => 'static', 'dynamic' or ''}
-NB: Extensions that have nothing but *.pm files or have the role of
-holding together several subdirectories specify
+NB: Extensions that have nothing but *.pm files had to say
{LINKTYPE => ''}
-=item dynamic_lib
-
- {ARMAYBE => 'ar', OTHERLDFLAGS => '...'}
+with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
+can be deleted safely. MakeMaker recognizes when there's nothing to
+be linked.
-=item clean
+=item macro
- {FILES => "*.xyz foo"}
+ {ANY_MACRO => ANY_VALUE, ...}
=item realclean
{FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
-=item dist
-
- {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => 'gz',
- SHAR => 'shar -m', DIST_CP => 'ln'}
+=item test
-If you specify COMPRESS, then SUFFIX should also be altered, as it
-is needed to tell make the target file of the compression. DIST_CP
-can be useful, if you need to preserve the timestamps on your files.
+ {TESTS => 't/*.t'}
=item tool_autosplit
- {MAXLEN =E<gt> 8}
+ {MAXLEN => 8}
=back
-=cut
-
-# bug in pod2html, so leave the =back
-
-# Don't delete this cut, MM depends on it!
-
=head2 Overriding MakeMaker Methods
If you cannot achieve the desired Makefile behaviour by specifying
or you can edit the default by saying something like:
sub MY::c_o {
- my $self = shift;
- local *c_o;
- $_=$self->MM::c_o;
- s/old text/new text/;
- $_;
+ package MY; # so that "SUPER" works right
+ my $inherited = shift->SUPER::c_o(@_);
+ $inherited =~ s/old text/new text/;
+ $inherited;
}
-Both methods above are available for backwards compatibility with
-older Makefile.PLs.
+If you are running experiments with embedding perl as a library into
+other applications, you might find MakeMaker is not sufficient. You'd
+better have a look at ExtUtils::Embed which is a collection of utilities
+for embedding.
If you still need a different solution, try to develop another
-subroutine, that fits your needs and submit the diffs to
-F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate.
+subroutine that fits your needs and submit the diffs to
+F<perl5-porters@perl.org> or F<comp.lang.perl.moderated> as appropriate.
+
+For a complete description of all MakeMaker methods see L<ExtUtils::MM_Unix>.
+
+Here is a simple example of how to add a new target to the generated
+Makefile:
+
+ sub MY::postamble {
+ '
+ $(MYEXTLIB): sdbm/Makefile
+ cd sdbm && $(MAKE) all
+ ';
+ }
+
+
+=head2 Hintsfile support
+
+MakeMaker.pm uses the architecture specific information from
+Config.pm. In addition it evaluates architecture specific hints files
+in a C<hints/> directory. The hints files are expected to be named
+like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
+name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
+MakeMaker within the WriteMakefile() subroutine, and can be used to
+execute commands as well as to include special variables. The rules
+which hintsfile is chosen are the same as in Configure.
+
+The hintsfile is eval()ed immediately after the arguments given to
+WriteMakefile are stuffed into a hash reference $self but before this
+reference becomes blessed. So if you want to do the equivalent to
+override or create an attribute you would say something like
+
+ $self->{LIBS} = ['-ldbm -lucb -lc'];
=head2 Distribution Support
MANIFEST file and vice versa. (See ExtUtils::Manifest::fullcheck() for
details)
+=item make skipcheck
+
+reports which files are skipped due to the entries in the
+C<MANIFEST.SKIP> file (See ExtUtils::Manifest::skipcheck() for
+details)
+
=item make distclean
does a realclean first and then the distcheck. Note that this is not
-needed to build a new distribution as long as you are sure, that the
+needed to build a new distribution as long as you are sure that the
MANIFEST file is ok.
=item make manifest
=item make disttest
Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and
-a make install in that directory.
+a make test in that directory.
=item make tardist
-First does a command $(PREOP) which defaults to a null command. Does a
-distdir next and runs C<tar> on that directory into a tarfile. Then
-deletes the distdir. Finishes with a command $(POSTOP) which defaults
-to a null command.
+First does a distdir. Then a command $(PREOP) which defaults to a null
+command, followed by $(TOUNIX), which defaults to a null command under
+UNIX, and will convert files in distribution directory to UNIX format
+otherwise. Next it runs C<tar> on that directory into a tarfile and
+deletes the directory. Finishes with a command $(POSTOP) which
+defaults to a null command.
=item make dist
=item make shdist
-First does a command $(PREOP) which defaults to a null command. Does a
-distdir next and runs C<shar> on that directory into a sharfile. Then
-deletes the distdir. Finishes with a command $(POSTOP) which defaults
-to a null command. Note: For shdist to work properly a C<shar>
-program that can handle directories is mandatory.
+First does a distdir. Then a command $(PREOP) which defaults to a null
+command. Next it runs C<shar> on that directory into a sharfile and
+deletes the intermediate directory again. Finishes with a command
+$(POSTOP) which defaults to a null command. Note: For shdist to work
+properly a C<shar> program that can handle directories is mandatory.
+
+=item make zipdist
+
+First does a distdir. Then a command $(PREOP) which defaults to a null
+command. Runs C<$(ZIP) $(ZIPFLAGS)> on that directory into a
+zipfile. Then deletes that directory. Finishes with a command
+$(POSTOP) which defaults to a null command.
=item make ci
following parameters are recognized:
CI ('ci -u')
- COMPRESS ('compress')
+ COMPRESS ('gzip --best')
POSTOP ('@ :')
PREOP ('@ :')
+ TO_UNIX (depends on the system)
RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):')
SHAR ('shar')
- SUFFIX ('Z')
+ SUFFIX ('.gz')
TAR ('tar')
TARFLAGS ('cvf')
+ ZIP ('zip')
+ ZIPFLAGS ('-r')
An example:
- WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" })
+ WriteMakefile( 'dist' => { COMPRESS=>"bzip2", SUFFIX=>".bz2" })
+=head2 Disabling an extension
-=head1 AUTHORS
+If some events detected in F<Makefile.PL> imply that there is no way
+to create the Module, but this is a normal state of things, then you
+can create a F<Makefile> which does nothing, but succeeds on all the
+"usual" build targets. To do so, use
+
+ ExtUtils::MakeMaker::WriteEmptyMakefile();
-Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas
-KE<ouml>nig F<E<lt>A.Koenig@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce
-F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey
-F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. Contact the makemaker
-mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if you have any
-questions.
+instead of WriteMakefile().
-=head1 MODIFICATION HISTORY
+This may be useful if other modules expect this module to be I<built>
+OK, as opposed to I<work> OK (say, this system-dependent module builds
+in a subdirectory of some other distribution, or is listed as a
+dependency in a CPAN::Bundle, but the functionality is supported by
+different means on the current architecture).
-For a more complete documentation see the file Changes in the
-MakeMaker distribution package.
+=head1 ENVIRONMENT
-=head1 TODO
+=over 8
+
+=item PERL_MM_OPT
+
+Command line options used by C<MakeMaker-E<gt>new()>, and thus by
+C<WriteMakefile()>. The string is split on whitespace, and the result
+is processed before any actual command line arguments are processed.
+
+=back
+
+=head1 SEE ALSO
+
+ExtUtils::MM_Unix, ExtUtils::Manifest, ExtUtils::testlib,
+ExtUtils::Install, ExtUtils::Embed
+
+=head1 AUTHORS
-See the file Todo in the MakeMaker distribution package.
+Andy Dougherty <F<doughera@lafcol.lafayette.edu>>, Andreas KE<ouml>nig
+<F<A.Koenig@franz.ww.TU-Berlin.DE>>, Tim Bunce <F<Tim.Bunce@ig.co.uk>>.
+VMS support by Charles Bailey <F<bailey@newman.upenn.edu>>. OS/2
+support by Ilya Zakharevich <F<ilya@math.ohio-state.edu>>. Contact the
+makemaker mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if
+you have any questions.
=cut