use File::Basename qw(basename dirname fileparse);
use DirHandle;
use strict;
-use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS
+use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS
$Verbose %pm %static $Xsubpp_Version);
-$VERSION = substr q$Revision: 1.107 $, 10;
-# $Id: MM_Unix.pm,v 1.107 1996/09/03 20:53:39 k Exp $
+$VERSION = substr q$Revision: 1.109 $, 10;
+# $Id: MM_Unix.pm,v 1.109 1996/12/17 00:42:32 k Exp k $
Exporter::import('ExtUtils::MakeMaker',
qw( $Verbose &neatvalue));
-$Is_OS2 = $^O =~ m|^os/?2$|i;
+$Is_OS2 = $^O eq 'os2';
$Is_Mac = $^O eq "MacOS";
if ($Is_VMS = $^O eq 'VMS') {
Not all of the methods below are overridable in a
Makefile.PL. Overridable methods are marked as (o). All methods are
overridable by a platform specific MM_*.pm file (See
-L<ExtUtils::MM_VMS> and L<ExtUtils::MM_OS2>).
+L<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>).
=head2 Preloaded methods
__DATA__
+=back
+
=head2 SelfLoaded methods
+=over 2
+
=item c_o (o)
Defines the suffix rules to compile different flavors of C files to
AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
- INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
+ INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
0; # false and not empty
}
+=back
+
=head2 Methods to actually produce chunks of text for the Makefile
-The methods here are called in the order specified by
-@ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as
-well as possible. Some methods call each other, so in doubt refer to
-the code.
+The methods here are called for each MakeMaker object in the order
+specified by @ExtUtils::MakeMaker::MM_Sections.
+
+=over 2
=item force (o)
# It may also edit @modparts if required.
if (defined &DynaLoader::mod2fname) {
$modfname = &DynaLoader::mod2fname(\@modparts);
- }
+ }
($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
$self->{PERL_INC} = $self->{PERL_SRC};
# catch a situation that has occurred a few times in the past:
- warn <<EOM unless (-s $self->catfile($self->{PERL_SRC},'cflags') or $Is_VMS && -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt') or $Is_Mac);
+ unless (
+ -s $self->catfile($self->{PERL_SRC},'cflags')
+ or
+ $Is_VMS
+ &&
+ -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt')
+ or
+ $Is_Mac
+ ){
+ warn qq{
You cannot build extensions below the perl source tree after executing
a 'make clean' in the perl source tree.
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};
$self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp};
$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")));
+ unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))){
+ die qq{
Error: Unable to locate installed Perl libraries or Perl source code.
It is recommended that you install perl in a standard location before
-building extensions. You can say:
-
- $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
-
-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
+building extensions. Some precompiled versions of perl do not contain
+these header files, so you cannot build extensions. In such a case,
+please build and install your perl from a fresh perl distribution. It
+usually solves this kind of problem.
+\(You get this message, because MakeMaker could not find "$perl_h"\)
+};
+ }
# print STDOUT "Using header files found in $self->{PERL_INC}\n"
# if $Verbose && $self->needs_linking();
# The user who requests an installation directory explicitly
# should not have to tell us a architecture installation directory
- # as well We look if a directory exists that is named after the
+ # as well. We look if a directory exists that is named after the
# architecture. If not we take it as a sign that it should be the
# same as the requested installation directory. Otherwise we take
# the found one.
# requested values. We're going to set the $Config{prefix} part of
# all the installation path variables to literally $(PREFIX), so
# the user can still say make PREFIX=foo
- my($prefix) = $Config{'prefix'};
+ my($configure_prefix) = $Config{'prefix'};
$prefix = VMS::Filespec::unixify($prefix) if $Is_VMS;
- unless ($self->{PREFIX}){
- $self->{PREFIX} = $prefix;
+ $self->{PREFIX} ||= $configure_prefix;
+
+
+ my($install_variable,$search_prefix,$replace_prefix);
+
+ # The rule, taken from Configure, is that if prefix contains perl,
+ # we shape the tree
+ # perlprefix/lib/ INSTALLPRIVLIB
+ # perlprefix/lib/pod/
+ # perlprefix/lib/site_perl/ INSTALLSITELIB
+ # perlprefix/bin/ INSTALLBIN
+ # perlprefix/man/ INSTALLMAN1DIR
+ # else
+ # prefix/lib/perl5/ INSTALLPRIVLIB
+ # prefix/lib/perl5/pod/
+ # prefix/lib/perl5/site_perl/ INSTALLSITELIB
+ # prefix/bin/ INSTALLBIN
+ # prefix/lib/perl5/man/ INSTALLMAN1DIR
+
+ $replace_prefix = qq[\$\(PREFIX\)];
+ for $install_variable (qw/
+ INSTALLBIN
+ INSTALLSCRIPT
+ /) {
+ $self->prefixify($install_variable,$configure_prefix,$replace_prefix);
+ }
+ $search_prefix = $configure_prefix =~ /perl/ ?
+ $self->catdir($configure_prefix,"lib") :
+ $self->catdir($configure_prefix,"lib","perl5");
+ if ($self->{LIB}) {
+ $self->{INSTALLPRIVLIB} = $self->{INSTALLSITELIB} = $self->{LIB};
+ $self->{INSTALLARCHLIB} = $self->{INSTALLSITEARCH} =
+ $self->catdir($self->{LIB},$Config{'archname'});
+ } else {
+ $replace_prefix = $self->{PREFIX} =~ /perl/ ?
+ $self->catdir(qq[\$\(PREFIX\)],"lib") :
+ $self->catdir(qq[\$\(PREFIX\)],"lib","perl5");
+ for $install_variable (qw/
+ INSTALLPRIVLIB
+ INSTALLARCHLIB
+ INSTALLSITELIB
+ INSTALLSITEARCH
+ /) {
+ $self->prefixify($install_variable,$search_prefix,$replace_prefix);
+ }
}
- my($install_variable);
+ $search_prefix = $configure_prefix =~ /perl/ ?
+ $self->catdir($configure_prefix,"man") :
+ $self->catdir($configure_prefix,"lib","perl5","man");
+ $replace_prefix = $self->{PREFIX} =~ /perl/ ?
+ $self->catdir(qq[\$\(PREFIX\)],"man") :
+ $self->catdir(qq[\$\(PREFIX\)],"lib","perl5","man");
for $install_variable (qw/
-
- INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
- INSTALLMAN1DIR INSTALLMAN3DIR INSTALLSCRIPT
- INSTALLSITELIB INSTALLSITEARCH
-
+ INSTALLMAN1DIR
+ INSTALLMAN3DIR
/) {
- $self->prefixify($install_variable,$prefix,q[$(PREFIX)]);
+ $self->prefixify($install_variable,$search_prefix,$replace_prefix);
}
-
# Now we head at the manpages. Maybe they DO NOT want manpages
# installed
$self->{INSTALLMAN1DIR} = $Config::Config{installman1dir}
$cccmd = $self->const_cccmd($libperl);
$cccmd =~ s/^CCCMD\s*=\s*//;
$cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /;
- $cccmd .= " $Config::Config{cccdlflags}"
+ $cccmd .= " $Config::Config{cccdlflags}"
if ($Config::Config{useshrplib} eq 'true');
$cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
my $eval = qq{
package ExtUtils::MakeMaker::_version;
no strict;
-
- \$$1=undef; do {
- $_
+
+ \$$1=undef; do {
+ $_
}; \$$1
};
local($^W) = 0;
my($sep) = $Is_VMS ? ',' : '';
$sep .= "\\\n\t";
- foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
+ foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){
push @pasthru, "$key=\"\$($key)\"";
}
1;
+=back
=head1 SEE ALSO
package ExtUtils::MakeMaker;
-$Version = $VERSION = "5.38";
+$Version = $VERSION = "5.39";
$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.207 $, 10)) =~ s/\s+$//;
+($Revision = substr(q$Revision: 1.208 $, 10)) =~ s/\s+$//;
# Now we can can pull in the friends
#
$Is_VMS = $^O eq 'VMS';
-$Is_OS2 = $^O =~ m|^os/?2$|i;
+$Is_OS2 = $^O eq 'os2';
$Is_Mac = $^O eq 'MacOS';
require ExtUtils::MM_Unix;
INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR
INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB
- INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIBS
+ INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIB LIBS
LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB
NAME NEEDS_LINKING NOECHO NORECURS OBJECT OPTIMIZE PERL PERLMAINCC
PERL_ARCHLIB PERL_LIB PERL_SRC PL_FILES PM PMLIBDIRS PREFIX
# This is for old Makefiles written pre 5.00, will go away
if ( Carp::longmess("") =~ /runsubdirpl/s ){
- #$self->{Correct_relativ_directories}++;
Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
- } else {
- $self->{Correct_relativ_directories}=0;
}
my $newclass = ++$PACKNAME;
(getpwuid($>))[7]
]ex;
}
- # This may go away, in mid 1996
-# if ($self->{Correct_relativ_directories}){
-# $value = $self->catdir("..",$value)
-# if $Prepend_dot_dot{$name} && ! $self->file_name_is_absolute($value);
-# }
$self->{uc($name)} = $value;
}
- # This may go away, in mid 1996
- delete $self->{Correct_relativ_directories};
# catch old-style 'potential_libs' and inform user how to 'upgrade'
if (defined $self->{potential_libs}){
=head2 How To Write A Makefile.PL
-The short answer is: Don't. 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 very useful C<-X> switch. This will
-generate dummy files of all kinds that are useful for the module
-developer.
+The short answer is: Don't.
+
+ Always begin with h2xs.
+ Always begin with h2xs!
+ ALWAYS BEGIN WITH H2XS!
+
+even if you're not building around a header file, and even if you
+don't have an XS component.
+
+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.
The medium answer is:
use ExtUtils::MakeMaker;
WriteMakefile( NAME => "Foo::Bar" );
-The long answer is below.
+The long answer is the rest of the manpage :-)
=head2 Default Makefile Behaviour
=head2 make test
-MakeMaker checks for the existence of a file named "test.pl" in the
+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.
all matching files via the L<Test::Harness> module with the C<-I>
switches set correctly.
+=head2 make testdb
+
+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 you want to debug some other testfile, set C<TEST_FILE> variable
+thusly:
+
+ make testdb TEST_FILE=t/mytest.t
+
+By default the debugger is called using C<-d> option to perl. If you
+want to specify some other option, set C<TESTDB_SW> variable:
+
+ make testdb TESTDB_SW=-Dx
+
=head2 make install
make alone puts all relevant files into directories that are named by
You can check the values of these variables on your system with
- perl -MConfig -le 'print join $/, map
- sprintf("%20s: %s", $_, $Config{$_}),
- grep /^install/, keys %Config'
+ perl '-V:install.*'
And to check the sequence in which the library directories are
searched by perl, run
perl -le 'print join $/, @INC'
-=head2 PREFIX attribute
+=head2 PREFIX and LIB attribute
+
+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
+
+ perl Makefile.PL LIB=~/lib
-The PREFIX attribute can be used to set the INSTALL* attributes in one
-go. The quickest way to install a module in a non-standard place
+This will install the module's architecture-independent files into
+~/lib, the architecture-dependent files into ~/lib/$archname/auto.
+
+Another way to specify many INSTALL directories with a single
+parameter is PREFIX.
perl Makefile.PL PREFIX=~
This will replace the string specified by $Config{prefix} in all
$Config{install*} values.
-Note, that the tilde expansion is done by MakeMaker, not by perl by
-default, nor by make.
+Note, that in both cases the tilde expansion is done by MakeMaker, not
+by perl by default, nor by make. Conflicts between parmeters LIB,
+PREFIX and the various INSTALL* arguments are resolved so that
+XXX
If the user has superuser privileges, and is not working on AFS
(Andrew File System) or relatives, then the defaults for
The filename of the perllibrary that will be used together with this
extension. Defaults to libperl.a.
+=item LIB
+
+LIB can only be set at C<perl Makefile.PL> time. It has the effect of
+setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any
+
=item LIBS
An anonymous array of alternative library
MakeMaker object. The following lines will be parsed o.k.:
$VERSION = '1.00';
- ( $VERSION ) = '$Revision: 1.207 $ ' =~ /\$Revision:\s+([^\s]+)/;
+ ( $VERSION ) = '$Revision: 1.208 $ ' =~ /\$Revision:\s+([^\s]+)/;
$FOO::VERSION = '1.10';
but these will fail: