use Exporter ();
use Carp;
use Config qw(%Config);
-use File::Basename qw(basename dirname fileparse);
+use File::Basename qw(basename dirname);
use DirHandle;
use vars qw($VERSION @ISA
$Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Win95 $Is_Dos $Is_VOS
- $Is_QNX $Is_AIX $Is_OSF $Is_IRIX $Is_NetBSD
+ $Is_QNX $Is_AIX $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD
$Is_SunOS4 $Is_Solaris $Is_SunOS
- $Verbose %pm %static $Xsubpp_Version
+ $Verbose %pm %static
%Config_Override
);
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.36';
+$VERSION = '1.45';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
$Is_SunOS4 = $^O eq 'sunos';
$Is_Solaris = $^O eq 'solaris';
$Is_SunOS = $Is_SunOS4 || $Is_Solaris;
+$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos$/;
=head1 NAME
push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
push(@otherfiles, qw[./blib $(MAKE_APERL_FILE)
$(INST_ARCHAUTODIR)/extralibs.all
- perlmain.c tmon.out mon.out so_locations pm_to_blib
+ $(INST_ARCHAUTODIR)/extralibs.ld
+ perlmain.c tmon.out mon.out so_locations
+ blibdirs pm_to_blib
*$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
$(BOOTSTRAP) $(BASEEXT).bso
$(BASEEXT).def lib$(BASEEXT).def
}
else {
push(@otherfiles, qw[core core.*perl.*.? *perl.core]);
+
+ # core.\d+
+ push(@otherfiles, map { "core." . "[0-9]"x$_ } (1..5));
}
push @m, "\t-\$(RM_RF) @otherfiles\n";
my($self) = @_;
my @m = ();
- for my $macro (qw/
+ for my $macro (qw(
AR_STATIC_ARGS DIRFILESEP
NAME NAME_SYM
VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB
+ INST_MAN1DIR INST_MAN3DIR
+ MAN1EXT MAN3EXT
INSTALLDIRS
DESTDIR PREFIX
PERLPREFIX SITEPREFIX VENDORPREFIX
- INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
- INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
- INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN INSTALLSCRIPT
+ ),
+ (map { ("INSTALL".$_,
+ "DESTINSTALL".$_)
+ } $self->installvars),
+ qw(
PERL_LIB
PERL_ARCHLIB
LIBPERL_A MYEXTLIB
PERL_CORE
PERM_RW PERM_RWX
- / )
+ ) )
{
next unless defined $self->{$macro};
MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."
";
- for my $macro (qw/
- INST_MAN1DIR MAN1EXT
- INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR
- INST_MAN3DIR MAN3EXT
- INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR
- /)
- {
- next unless defined $self->{$macro};
- push @m, "$macro = $self->{$macro}\n";
- }
-
push @m, q{
# Where is the Config information that we are using/depend on
join "", @m;
}
-=item dir_target (o)
-Takes an array of directories that need to exist and returns a
-Makefile entry for a .exists file in these directories. 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 "::".
+=item dir_target B<DEPRECATED>
+
+ my $make_frag = $mm->dir_target(@directories);
+
+I<This function is deprecated> its use is no longer necessary and is I<only
+provided for backwards compatibility>. blibdirs_target provides a much
+simpler mechanism and pm_to_blib() can create its own directories anyway.
+
+Returns a Makefile entry for a .exists file in each of the @directories.
+The purpose is to create a directory and provide a make target to depend on.
+The make target is a .exists file in each of those directories.
+
+For example
+
+ $mm->dir_target('$(INST_ARCHDIR)');
+
+would return the make target C<$(INST_ARCHDIR)/.exists> which would
+create $(INST_ARCHDIR) and touch .exists. You would depend on this target
+to make sure $(INST_ARCHDIR) is created.
+
+Ignores directories which have already gone through dir_target() so you
+might wind up getting nothing.
=cut
sub dir_target {
-# --- 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 :)
-
- my($self,@dirs) = @_;
- my(@m,$dir,$targdir);
- foreach $dir (@dirs) {
- my($src) = $self->catfile($self->{PERL_INC},'perl.h');
- my($targ) = $self->catfile($dir,'.exists');
- # catfile may have adapted syntax of $dir to target OS, so...
- if ($Is_VMS) { # Just remove file name; dirspec is often in macro
- ($targdir = $targ) =~ s:/?\.exists\z::;
- }
- else { # while elsewhere we expect to see the dir separator in $targ
- $targdir = dirname($targ);
- }
- next if $self->{DIR_TARGET}{$self}{$targdir}++;
- push @m, qq{
-$targ :: $src
+ my($self, @dirs) = @_;
+
+ my @targs = ();
+ my $make = '';
+ foreach my $dir (@dirs) {
+ my $targ = $self->catfile($dir, '.exists');
+
+ my $targdir;
+ if ($Is_VMS) { # Just remove file name; dirspec is often in macro
+ ($targdir = $targ) =~ s:/?\.exists\z::;
+ }
+ else { # while elsewhere we expect to see the dir separator in $targ
+ $targdir = dirname($targ);
+ }
+
+ next if $self->{DIR_TARGET}{$self}{$targdir}++;
+
+ push @targs, $targ;
+ $make .= <<MAKE_FRAG;
+$targ ::
\$(NOECHO) \$(MKPATH) $targdir
- \$(NOECHO) \$(EQUALIZE_TIMESTAMP) $src $targ
-};
- push(@m, qq{
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir
-}) unless $Is_VMS;
+ \$(NOECHO) \$(TOUCH) $targ
+ \$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir
+
+MAKE_FRAG
+
}
- join "", @m;
+
+ # So these new .exists targets get called along with blibdirs.
+ my $blib_addition = '';
+ $blib_addition = <<MAKE_FRAG if @targs;
+blibdirs :: @targs
+ \$(NOECHO) \$(NOOP)
+
+MAKE_FRAG
+
+ return $blib_addition . $make;
}
+
+=item init_DEST
+
+ $mm->init_DEST
+
+Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
+
+=cut
+
+sub init_DEST {
+ my $self = shift;
+
+ # Initialize DESTDIR
+ $self->{DESTDIR} ||= '';
+
+ # Make DEST variables.
+ foreach my $var ($self->installvars) {
+ my $destvar = 'DESTINSTALL'.$var;
+ $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')';
+ }
+}
+
+
=item init_dist
$mm->init_dist;
ci :
$(PERLRUN) "-MExtUtils::Manifest=maniread" \\
-e "@all = keys %{ maniread() };" \\
- -e "print("Executing $(CI) @all\n"); system(qq{$(CI) @all});" \\
- -e "print("Executing $(RCS_LABEL) ...\n"); system(qq{$(RCS_LABEL) @all});"
+ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \\
+ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
};
}
my $date_check = $self->oneliner(<<'CODE', ['-l']);
print 'Warning: Makefile possibly out of date with $(VERSION_FROM)'
- if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';
+ if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';
CODE
return sprintf <<'MAKE_FRAG', $date_check;
-dist : $(DIST_DEFAULT)
+dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
$(NOECHO) %s
MAKE_FRAG
}
my($self) = shift;
return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest
+distdir : metafile metafile_addtomanifest signature
$(RM_RF) $(DISTVNAME)
$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
my($self) = shift;
'
-## $(INST_PM) has been moved to the all: target.
-## It remains here for awhile to allow for old usage: "make dynamic"
dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
$(NOECHO) $(NOOP)
';
# 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): $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) blibdirs
$(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) \
"-MExtUtils::Mkbootstrap" \
$(NOECHO) $(TOUCH) $(BOOTSTRAP)
$(CHMOD) $(PERM_RW) $@
-$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_BOOT): $(BOOTSTRAP) blibdirs
$(NOECHO) $(RM_RF) $(INST_BOOT)
-$(CP) $(BOOTSTRAP) $(INST_BOOT)
$(CHMOD) $(PERM_RW) $@
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
INST_DYNAMIC_FIX = '.$ld_fix.'
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
');
if ($armaybe ne ':'){
$ldfrom = 'tmp$(LIB_EXT)';
my $libs = '$(LDLOADLIBS)';
- if ($Is_NetBSD) {
+ if ($Is_NetBSD && $Config{'useshrplib'}) {
# Use nothing on static perl platforms, and to the flags needed
# to link against the shared libperl library on shared perl
# platforms. We peek at lddlflags to see if we need -Wl,-R
# or -R to add paths to the run-time library search path.
- if ($Config{'useshrplib'}) {
- if ($Config{'lddlflags'} =~ /-Wl,-R/) {
- $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl';
- } elsif ($Config{'lddlflags'} =~ /-R/) {
- $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl';
- }
- }
+ if ($Config{'lddlflags'} =~ /-Wl,-R/) {
+ $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
+ } elsif ($Config{'lddlflags'} =~ /-R/) {
+ $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
+ }
}
push(@m,
$(CHMOD) $(PERM_RWX) $@
';
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
join('',@m);
}
my $stderr_duped = 0;
local *STDERR_COPY;
- if( open(STDERR_COPY, '>&STDERR') ) {
- $stderr_duped = 1;
- }
- else {
- warn <<WARNING;
+ unless ($Is_BSD) {
+ if( open(STDERR_COPY, '>&STDERR') ) {
+ $stderr_duped = 1;
+ }
+ else {
+ warn <<WARNING;
find_perl() can't dup STDERR: $!
You might see some garbage while we search for Perl
WARNING
+ }
}
foreach $name (@$names){
next unless $self->maybe_command($abs);
print "Executing $abs\n" if ($trace >= 2);
+ my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
# To avoid using the unportable 2>&1 to supress STDERR,
# we close it before running the command.
- close STDERR if $stderr_duped;
- $val = `$abs -e "require $ver; print qq{VER_OK\n}"`;
- open STDERR, '>&STDERR_COPY' if $stderr_duped;
+ # However, thanks to a thread library bug in many BSDs
+ # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
+ # we cannot use the fancier more portable way in here
+ # but instead need to use the traditional 2>&1 construct.
+ if ($Is_BSD) {
+ $val = `$version_check 2>&1`;
+ } else {
+ close STDERR if $stderr_duped;
+ $val = `$version_check`;
+ open STDERR, '>&STDERR_COPY' if $stderr_duped;
+ }
if ($val =~ /^VER_OK/) {
print "Using PERL=$abs\n" if $trace;
warn "Can't create new $file: $!\n";
next;
}
- my($dev,$ino,$mode) = stat FIXIN;
# Print out the new #! line (or equivalent).
local $\;
sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
my($self) = @_;
my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
- local(%pm); #the sub in find() has to see this hash
+ my %pm;
@ignore{qw(Makefile.PL test.pl t)} = (1,1,1);
next unless $self->libscan($name);
if (-d $name){
next if -l $name; # We do not support symlinks at all
+ next if $self->{NORECURS};
$dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
} elsif ($name =~ /\.xs\z/){
my($c); ($c = $name) =~ s/\.xs\z/.c/;
}
return if /\#/;
return if /~$/; # emacs temp files
+ return if /,v$/; # RCS files
my $path = $File::Find::name;
my $prefix = $self->{INST_LIBDIR};
my($manpagename) = $name;
$manpagename =~ s/\.p(od|m|l)\z//;
# everything below lib is ok
- if($self->{PARENT_NAME} && $manpagename !~ s!^\W*lib\W+!!s) {
+ unless($manpagename =~ s!^\W*lib\W+!!s) {
$manpagename = $self->catfile(
split(/::/,$self->{PARENT_NAME}),$manpagename
);
Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
-INSTALL*, INSTALLDIRS, LD, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
+INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
VERSION_SYM, XS_VERSION.
EOP
}
}
- }
-
- 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. 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();
-
+ }
}
# We get SITELIBEXP and SITEARCHEXP directly via
$self->{AR_STATIC_ARGS} ||= "cr";
# These should never be needed
- $self->{LD} ||= 'ld';
$self->{OBJ_EXT} ||= '.o';
$self->{LIB_EXT} ||= '.a';
=item init_others
-Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
+Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD,
OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP,
FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F,
-TOUCH, CP, MV, CHMOD, UMASK_NULL
+TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N
=cut
sub init_others { # --- Initialize Other Attributes
my($self) = shift;
+ $self->{LD} ||= 'ld';
+
# 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->{NOOP} ||= '$(SHELL) -c true';
$self->{NOECHO} = '@' unless defined $self->{NOECHO};
- $self->{MAKEFILE} ||= 'Makefile';
- $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE};
- $self->{MAKEFILE_OLD} ||= '$(FIRST_MAKEFILE).old';
- $self->{MAKE_APERL_FILE} ||= '$(FIRST_MAKEFILE).aperl';
+ $self->{FIRST_MAKEFILE} ||= 'Makefile';
+ $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
+ $self->{MAKEFILE_OLD} ||= $self->{MAKEFILE}.'.old';
+ $self->{MAKE_APERL_FILE} ||= $self->{MAKEFILE}.'.aperl';
$self->{SHELL} ||= $Config{sh} || '/bin/sh';
$self->{ECHO} ||= 'echo';
+ $self->{ECHO_N} ||= 'echo -n';
$self->{RM_F} ||= "rm -f";
$self->{RM_RF} ||= "rm -rf";
$self->{TOUCH} ||= "touch";
}
my @parentdir = split(/::/, $self->{PARENT_NAME});
- $self->{INST_LIBDIR} = $self->catdir($self->{INST_LIB},@parentdir);
- $self->{INST_ARCHLIBDIR} = $self->catdir($self->{INST_ARCHLIB},
- @parentdir);
- $self->{INST_AUTODIR} = $self->catdir($self->{INST_LIB},'auto',
- $self->{FULLEXT});
- $self->{INST_ARCHAUTODIR} = $self->catdir($self->{INST_ARCHLIB},
- 'auto',$self->{FULLEXT});
+ $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir);
+ $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir);
+ $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto',
+ '$(FULLEXT)');
+ $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto',
+ '$(FULLEXT)');
- $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script');
+ $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script');
$self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
$self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
$self->init_lib2arch;
- if( $Config{usevendorprefix} ) {
- $Config_Override{installvendorman1dir} =
- $self->catdir($Config{vendorprefixexp}, 'man', 'man1');
- $Config_Override{installvendorman3dir} =
- $self->catdir($Config{vendorprefixexp}, 'man', 'man3');
+ # There are often no Config.pm defaults for these new man variables so
+ # we fall back to the old behavior which is to use installman*dir
+ foreach my $num (1, 3) {
+ my $k = 'installsiteman'.$num.'dir';
+
+ $self->{uc $k} ||= uc "\$(installman${num}dir)"
+ unless $Config{$k};
}
- else {
- $Config_Override{installvendorman1dir} = '';
- $Config_Override{installvendorman3dir} = '';
+
+ foreach my $num (1, 3) {
+ my $k = 'installvendorman'.$num.'dir';
+
+ unless( $Config{$k} ) {
+ $self->{uc $k} ||= $Config{usevendorprefix}
+ ? uc "\$(installman${num}dir)"
+ : '';
+ }
}
+ $self->{INSTALLSITEBIN} ||= '$(INSTALLBIN)'
+ unless $Config{installsitebin};
+
+ unless( $Config{installvendorbin} ) {
+ $self->{INSTALLVENDORBIN} ||= $Config{usevendorprefix}
+ ? $Config{installbin}
+ : '';
+ }
+
+
my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
$Config{prefixexp} || $Config{prefix} || '';
my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : '';
# 5.005_03 doesn't have a siteprefix.
$sprefix = $iprefix unless $sprefix;
- # There are often no Config.pm defaults for these, but we can make
- # it up.
- unless( $Config{installsiteman1dir} ) {
- $Config_Override{installsiteman1dir} =
- $self->catdir($sprefix, 'man', 'man1');
- }
-
- unless( $Config{installsiteman3dir} ) {
- $Config_Override{installsiteman3dir} =
- $self->catdir($sprefix, 'man', 'man3');
- }
-
- unless( $Config{installsitebin} ) {
- $Config_Override{installsitebin} =
- $self->catdir($sprefix, 'bin');
- }
$self->{PREFIX} ||= '';
$self->{PERLPREFIX} ||= $iprefix;
$self->{SITEPREFIX} ||= $sprefix;
$self->{VENDORPREFIX} ||= $vprefix;
- }
- # Add DESTDIR.
- $self->{DESTDIR} ||= '';
- foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) {
- $self->{$prefix} = '$(DESTDIR)'.$self->{$prefix};
+ # Lots of MM extension authors like to use $(PREFIX) so we
+ # put something sensible in there no matter what.
+ $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
}
my $arch = $Config{archname};
# Build up a set of file names (not command names).
my $thisperl = $self->canonpath($^X);
- $thisperl .= $Config{exe_ext} unless $thisperl =~ m/$Config{exe_ext}$/i;
+ $thisperl .= $Config{exe_ext} unless
+ # VMS might have a file version # at the end
+ $Is_VMS ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
+ : $thisperl =~ m/$Config{exe_ext}$/i;
# We need a relative path to perl when in the core.
$thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
# don't check if perl is executable, maybe they have decided to
# supply switches with perl
+ # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe.
+ my $perl_name = 'perl';
+ $perl_name = 'ndbgperl' if $Is_VMS &&
+ defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define';
+
+ # XXX This logic is flawed. If "miniperl" is anywhere in the path
+ # it will get confused. It should be fixed to work only on the filename.
# Define 'FULLPERL' to be a non-miniperl (used in test: target)
- ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i
+ ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/$perl_name/i
unless $self->{FULLPERL};
# Little hack to get around VMS's find_perl putting "MCR" in front
pure_perl_install ::
$(NOECHO) $(MOD_INSTALL) \
read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
- write }.$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
- $(INST_LIB) $(INSTALLPRIVLIB) \
- $(INST_ARCHLIB) $(INSTALLARCHLIB) \
- $(INST_BIN) $(INSTALLBIN) \
- $(INST_SCRIPT) $(INSTALLSCRIPT) \
- $(INST_MAN1DIR) $(INSTALLMAN1DIR) \
- $(INST_MAN3DIR) $(INSTALLMAN3DIR)
+ write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
+ $(INST_LIB) $(DESTINSTALLPRIVLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
+ $(INST_BIN) $(DESTINSTALLBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
}.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
pure_site_install ::
$(NOECHO) $(MOD_INSTALL) \
read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
- write }.$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
- $(INST_LIB) $(INSTALLSITELIB) \
- $(INST_ARCHLIB) $(INSTALLSITEARCH) \
- $(INST_BIN) $(INSTALLSITEBIN) \
- $(INST_SCRIPT) $(INSTALLSCRIPT) \
- $(INST_MAN1DIR) $(INSTALLSITEMAN1DIR) \
- $(INST_MAN3DIR) $(INSTALLSITEMAN3DIR)
+ write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
+ $(INST_LIB) $(DESTINSTALLSITELIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
+ $(INST_BIN) $(DESTINSTALLSITEBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
pure_vendor_install ::
$(NOECHO) $(MOD_INSTALL) \
read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
- write }.$self->catfile('$(INSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \
- $(INST_LIB) $(INSTALLVENDORLIB) \
- $(INST_ARCHLIB) $(INSTALLVENDORARCH) \
- $(INST_BIN) $(INSTALLVENDORBIN) \
- $(INST_SCRIPT) $(INSTALLSCRIPT) \
- $(INST_MAN1DIR) $(INSTALLVENDORMAN1DIR) \
- $(INST_MAN3DIR) $(INSTALLVENDORMAN3DIR)
+ write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \
+ $(INST_LIB) $(DESTINSTALLVENDORLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
+ $(INST_BIN) $(DESTINSTALLVENDORBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
doc_perl_install ::
- $(NOECHO) $(ECHO) Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
- -$(NOECHO) $(MKPATH) $(INSTALLARCHLIB)
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
-$(NOECHO) $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLPRIVLIB)" \
LINKTYPE "$(LINKTYPE)" \
VERSION "$(VERSION)" \
EXE_FILES "$(EXE_FILES)" \
- >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
+ >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
doc_site_install ::
- $(NOECHO) $(ECHO) Appending installation info to $(INSTALLSITEARCH)/perllocal.pod
- -$(NOECHO) $(MKPATH) $(INSTALLSITEARCH)
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
-$(NOECHO) $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLSITELIB)" \
LINKTYPE "$(LINKTYPE)" \
VERSION "$(VERSION)" \
EXE_FILES "$(EXE_FILES)" \
- >> }.$self->catfile('$(INSTALLSITEARCH)','perllocal.pod').q{
+ >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
doc_vendor_install ::
- $(NOECHO) $(ECHO) Appending installation info to $(INSTALLVENDORARCH)/perllocal.pod
- -$(NOECHO) $(MKPATH) $(INSTALLVENDORARCH)
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
-$(NOECHO) $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLVENDORLIB)" \
LINKTYPE "$(LINKTYPE)" \
VERSION "$(VERSION)" \
EXE_FILES "$(EXE_FILES)" \
- >> }.$self->catfile('$(INSTALLVENDORARCH)','perllocal.pod').q{
+ >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
};
return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
return "" unless @{$self->{EXE_FILES}};
my(@m, $from, $to, %fromto, @to);
- push @m, $self->dir_target(qw[$(INST_SCRIPT)]);
for $from (@{$self->{EXE_FILES}}) {
my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
local($_) = $path; # for backwards compatibility
$fromto{$from}=$to;
}
@to = values %fromto;
+
+ my $fixin;
+ if( $Is_Win32 ) {
+ $fixin = $self->{PERL_CORE} ? '$(PERLRUN) ../../win32/bin/pl2bat.pl'
+ : 'pl2bat.bat';
+ }
+ else {
+ $fixin = q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"};
+ }
+
push(@m, qq{
EXE_FILES = @{$self->{EXE_FILES}}
-} . ($Is_Win32
- ? q{FIXIN = pl2bat.bat
-} : q{FIXIN = $(PERLRUN) "-MExtUtils::MY" \
- -e "MY->fixin(shift)"
-}).qq{
+FIXIN = $fixin
+
pure_all :: @to
\$(NOECHO) \$(NOOP)
last unless defined $from;
my $todir = dirname($to);
push @m, "
-$to: $from \$(FIRST_MAKEFILE) " . $self->catdir($todir,'.exists') . "
+$to : $from \$(FIRST_MAKEFILE) blibdirs
\$(NOECHO) \$(RM_F) $to
\$(CP) $from $to
\$(FIXIN) $to
$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
$(NOECHO) $(PERLRUNINST) \
Makefile.PL DIR=}, $dir, q{ \
- FIRST_MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
+ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
foreach (@ARGV){
require File::Find;
File::Find::find(sub {
return unless m/\Q$self->{LIB_EXT}\E$/;
- return if m/^libperl/;
+ return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/;
# Skip purified versions of libraries (e.g., DynaLoader_pure_p1_c0_032.a)
return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
";
push @m, "
-\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)\$(DIRFILESEP).exists ".join(" \\\n\t", @$extra).'
+\$(INST_ARCHAUTODIR)/extralibs.all: blibdirs ".join(" \\\n\t", @$extra).'
$(NOECHO) $(RM_F) $@
$(NOECHO) $(TOUCH) $@
';
push @m, q{
doc_inst_perl:
- $(NOECHO) $(ECHO) Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
- -$(NOECHO) $(MKPATH) $(INSTALLARCHLIB)
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
-$(NOECHO) $(DOC_INSTALL) \
"Perl binary" "$(MAP_TARGET)" \
MAP_STATIC "$(MAP_STATIC)" \
MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
MAP_LIBPERL "$(MAP_LIBPERL)" \
- >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{
+ >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
};
inst_perl: pure_inst_perl doc_inst_perl
pure_inst_perl: $(MAP_TARGET)
- }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(INSTALLBIN)','$(MAP_TARGET)').q{
+ }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{
clean :: map_clean
' if $self->{OBJECT};
push @m, q{
-# We take a very conservative approach here, but it\'s worth it.
+# We take a very conservative approach here, but it's worth it.
# We move Makefile to Makefile.old here to avoid gnu make looping.
$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
$(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
- $(NOECHO) $(RM_F) $(MAKEFILE_OLD)
- $(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+ -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
+ -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
-$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP)
$(PERLRUN) Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
my $result;
local *FH;
local $/ = "\n";
+ local $_;
open(FH,$parsefile) or die "Could not open '$parsefile': $!";
my $inpod = 0;
while (<FH>) {
$inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
next if $inpod || /^\s*#/;
chop;
- # next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
- next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
+ next unless /(?<!\\)([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
my $eval = qq{
package ExtUtils::MakeMaker::_version;
no strict;
$(PERL_INC)/nostdio.h \
$(PERL_INC)/op.h \
$(PERL_INC)/opcode.h \
- $(PERL_INC)/opnames.h \
$(PERL_INC)/patchlevel.h \
$(PERL_INC)/perl.h \
- $(PERL_INC)/perlapi.h \
$(PERL_INC)/perlio.h \
$(PERL_INC)/perlsdio.h \
$(PERL_INC)/perlsfio.h \
$(PERL_INC)/thrdvar.h \
$(PERL_INC)/thread.h \
$(PERL_INC)/unixish.h \
- $(PERL_INC)/utf8.h \
- $(PERL_INC)/util.h \
- $(PERL_INC)/warnings.h
+ $(PERL_INC)/util.h
$(OBJECT) : $(PERL_HDRS)
} if $self->{OBJECT};
my $path = $self->{uc $var} ||
$Config_Override{lc $var} || $Config{lc $var} || '';
+ $rprefix .= '/' if $sprefix =~ m|/$|;
+
print STDERR " prefixify $var => $path\n" if $Verbose >= 2;
print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2;
- if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} ) {
+ if( $self->{ARGS}{PREFIX} && $self->file_name_is_absolute($path) &&
+ $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
+ {
print STDERR " cannot prefix, using default.\n" if $Verbose >= 2;
print STDERR " no default!\n" if !$default && $Verbose >= 2;
push(@m, " \$(RM_F) \$(INST_STATIC)\n");
}
- my @files = ();
+ my @files = values %{$self->{PM}};
push @files, $attribs{FILES} if $attribs{FILES};
push @files, '$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)';
$cmd =~ s{^\n+}{};
$cmd =~ s{\n+$}{};
- $cmd = $self->quote_literal($cmd);
+ my @cmds = split /\n/, $cmd;
+ $cmd = join " \n\t-e ", map $self->quote_literal($_), @cmds;
$cmd = $self->escape_newlines($cmd);
$switches = join ' ', @$switches;
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
$(RM_RF) $@
END
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
MAKE_FRAG
- push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)');
join('', @m);
}
");
if ($Is_Win95) {
- push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q{\$(MAKE) test \$(PASTHRU)}" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}}));
+ push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q[\$(MAKE) test \$(PASTHRU)]" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}}));
}
else {
push(@m, map("\t\$(NOECHO) cd $_ && \$(TEST_F) \$(FIRST_MAKEFILE) && \$(MAKE) test \$(PASTHRU)\n", @{$self->{DIR}}));
}
- push(@m, "\t\$(NOECHO) $(ECHO) 'No tests defined for \$(NAME) extension.'\n")
+ push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
unless $tests or -f "test.pl" or @{$self->{DIR}};
push(@m, "\n");
my @m;
for my $tool (qw{ SHELL CHMOD CP MV NOOP NOECHO RM_F RM_RF TEST_F TOUCH
- UMASK_NULL DEV_NULL MKPATH EQUALIZE_TIMESTAMP ECHO
+ UMASK_NULL DEV_NULL MKPATH EQUALIZE_TIMESTAMP
+ ECHO ECHO_N
UNINST VERBINST
MOD_INSTALL DOC_INSTALL UNINSTALL
WARN_IF_OLD_PACKLIST
}
- my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,"xsubpp"));
-
- # What are the correct thresholds for version 1 && 2 Paul?
- if ( $xsubpp_version > 1.923 ){
- $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
- } else {
- if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
- print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
- Your version of xsubpp is $xsubpp_version and cannot handle this.
- Please upgrade to a more recent version of xsubpp.
-};
- } else {
- $self->{XSPROTOARG} = "";
- }
- }
+ $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
return qq{
XSUBPPDIR = $xsdir
};
};
-sub xsubpp_version
-{
- my($self,$xsubpp) = @_;
- return $Xsubpp_Version if defined $Xsubpp_Version; # global variable
-
- my ($version) ;
-
- # try to figure out the version number of the xsubpp on the system
-
- # first try the -v flag, introduced in 1.921 & 2.000a2
-
- return "" unless $self->needs_linking;
-
- my $command = qq{$self->{PERL} "-I$self->{PERL_LIB}" $xsubpp -v 2>&1};
- print "Running $command\n" if $Verbose >= 2;
- $version = `$command` ;
- warn "Running '$command' exits with status " . ($?>>8) if $?;
- chop $version ;
-
- return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ;
-
- # nope, then try something else
-
- my $counter = '000';
- my ($file) = 'temp' ;
- $counter++ while -e "$file$counter"; # don't overwrite anything
- $file .= $counter;
-
- open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
- print F <<EOM ;
-MODULE = fred PACKAGE = fred
-
-int
-fred(a)
- int a;
-EOM
-
- close F ;
-
- $command = "$self->{PERL} $xsubpp $file 2>&1";
- print "Running $command\n" if $Verbose >= 2;
- my $text = `$command` ;
- warn "Running '$command' exits with status " . ($?>>8) if $?;
- unlink $file ;
-
- # gets 1.2 -> 1.92 and 2.000a1
- return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
-
- # it is either 1.0 or 1.1
- return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ;
-
- # none of the above, so 1.0
- return $Xsubpp_Version = "1.0" ;
-}
-
=item all_target
my(@m);
push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
-
+
push @m, '
pure_all :: config pm_to_blib subdirs linkext
$(NOECHO) $(NOOP)
subdirs :: $(MYEXTLIB)
$(NOECHO) $(NOOP)
-config :: $(FIRST_MAKEFILE) $(INST_LIBDIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-config :: $(INST_AUTODIR)$(DIRFILESEP).exists
+config :: $(FIRST_MAKEFILE) blibdirs
$(NOECHO) $(NOOP)
';
- push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
-
- if (%{$self->{MAN1PODS}}) {
- push @m, q[
-config :: $(INST_MAN1DIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
- }
- if (%{$self->{MAN3PODS}}) {
- push @m, q[
-config :: $(INST_MAN3DIR)$(DIRFILESEP).exists
- $(NOECHO) $(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
- }
-
push @m, '
$(O_FILES): $(H_FILES)
' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
push @m, q{
-help:
+help :
perldoc ExtUtils::MakeMaker
};