use strict;
-use Exporter ();
use Carp;
-use Config qw(%Config);
-use File::Basename qw(basename dirname fileparse);
+use ExtUtils::MakeMaker::Config;
+use File::Basename qw(basename dirname);
use DirHandle;
-use Text::ParseWords;
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_BSD
- $Is_SunOS4 $Is_Solaris $Is_SunOS
- $Verbose %pm %static
+ $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos
+ $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD
+ $Is_SunOS4 $Is_Solaris $Is_SunOS $Is_Interix
%Config_Override
);
use ExtUtils::MakeMaker qw($Verbose neatvalue);
-$VERSION = '1.41';
+$VERSION = '1.51_02';
require ExtUtils::MM_Any;
@ISA = qw(ExtUtils::MM_Any);
-$Is_OS2 = $^O eq 'os2';
-$Is_Mac = $^O eq 'MacOS';
-$Is_Win32 = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
-$Is_Win95 = $Is_Win32 && Win32::IsWin95();
-$Is_Dos = $^O eq 'dos';
-$Is_VOS = $^O eq 'vos';
-$Is_VMS = $^O eq 'VMS';
-$Is_QNX = $^O eq 'qnx';
-$Is_AIX = $^O eq 'aix';
-$Is_OSF = $^O eq 'dec_osf';
-$Is_IRIX = $^O eq 'irix';
-$Is_NetBSD = $^O eq 'netbsd';
-$Is_SunOS4 = $^O eq 'sunos';
-$Is_Solaris = $^O eq 'solaris';
-$Is_SunOS = $Is_SunOS4 || $Is_Solaris;
-$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos$/;
+BEGIN {
+ $Is_OS2 = $^O eq 'os2';
+ $Is_Win32 = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
+ $Is_Dos = $^O eq 'dos';
+ $Is_VMS = $^O eq 'VMS';
+ $Is_OSF = $^O eq 'dec_osf';
+ $Is_IRIX = $^O eq 'irix';
+ $Is_NetBSD = $^O eq 'netbsd';
+ $Is_Interix = $^O eq 'interix';
+ $Is_SunOS4 = $^O eq 'sunos';
+ $Is_Solaris = $^O eq 'solaris';
+ $Is_SunOS = $Is_SunOS4 || $Is_Solaris;
+ $Is_BSD = $^O =~ /^(?:free|net|open)bsd$/ or
+ $^O eq 'bsdos' or $^O eq 'interix';
+}
+
+BEGIN {
+ if( $Is_VMS ) {
+ # For things like vmsify()
+ require VMS::Filespec;
+ VMS::Filespec->import;
+ }
+}
=head1 NAME
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>).
+overridable by a platform specific MM_*.pm file.
+
+Cross-platform methods are being moved into MM_Any. If you can't find
+something that used to be in here, look in MM_Any.
=cut
=over 4
-=item os_flavor (o)
+=item os_flavor
Simply says that we're Unix.
$cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/;
push @m, '
.c.i:
- '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c > $*.i
+ '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i
';
}
push @m, '
.c.s:
- $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c
+ $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
push @m, '
.c$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c
+ $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
push @m, '
.C$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.C
+ $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.C
' if !$Is_OS2 and !$Is_Win32 and !$Is_Dos; #Case-specific
push @m, '
.cpp$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cpp
+ $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp
.cxx$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cxx
+ $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx
.cc$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cc
+ $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc
';
join "", @m;
}
}
-=item clean (o)
-
-Defines the clean target.
-
-=cut
-
-sub clean {
-# --- Cleanup and Distribution Sections ---
-
- my($self, %attribs) = @_;
- 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_subdirs
-');
-
- my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
- if ( $Is_QNX ) {
- my @errfiles = @{$self->{C}};
- for ( @errfiles ) {
- s/.c$/.err/;
- }
- push( @otherfiles, @errfiles, 'perlmain.err' );
- }
- push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
- push(@otherfiles, qw[./blib $(MAKE_APERL_FILE)
- $(INST_ARCHAUTODIR)/extralibs.all
- $(INST_ARCHAUTODIR)/extralibs.ld
- perlmain.c tmon.out mon.out so_locations pm_to_blib
- *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
- $(BOOTSTRAP) $(BASEEXT).bso
- $(BASEEXT).def lib$(BASEEXT).def
- $(BASEEXT).exp $(BASEEXT).x
- ]);
- if( $Is_VOS ) {
- push(@otherfiles, qw[*.kp]);
- }
- 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";
- # See realclean and ext/utils/make_ext for usage of Makefile.old
- push(@m,
- "\t-\$(MV) \$(FIRST_MAKEFILE) \$(MAKEFILE_OLD) \$(DEV_NULL)\n");
- push(@m,
- "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
- join("", @m);
-}
-
-
-=item clean_subdirs_target
-
- my $make_frag = $MM->clean_subdirs_target;
-
-Returns the clean_subdirs target. This is used by the clean target to
-call clean on any subdirectories which contain Makefiles.
-
-=cut
-
-sub clean_subdirs_target {
- my($self) = shift;
-
- # No subdirectories, no cleaning.
- return <<'NOOP_FRAG' unless @{$self->{DIR}};
-clean_subdirs :
- $(NOECHO) $(NOOP)
-NOOP_FRAG
-
-
- my $clean = "clean_subdirs :\n";
-
- for my $dir (@{$self->{DIR}}) {
- $clean .= sprintf <<'MAKE_FRAG', $dir;
- -cd %s && $(TEST_F) $(FIRST_MAKEFILE) && $(MAKE) clean
-MAKE_FRAG
- }
-
- return $clean;
-}
-
=item const_cccmd (o)
my($self,$libperl)=@_;
return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
return '' unless $self->needs_linking();
- # PASTHRU_INC is defined explicitly by extensions
- # wanting to do complex things.
return $self->{CONST_CCCMD} =
- q{CCCMD = $(CC) -c $(INC) $(PASTHRU_INC) \\
+ q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\
$(CCFLAGS) $(OPTIMIZE) \\
$(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\
$(XS_DEFINE_VERSION)};
};
my($tmp);
for $tmp (qw/
- EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH
+ EXTRALIBS LDLOADLIBS BSLOADLIBS
/) {
next unless defined $self->{$tmp};
push @m, "$tmp = $self->{$tmp}\n";
}
+ # don't set LD_RUN_PATH if empty
+ for $tmp (qw/
+ LD_RUN_PATH
+ /) {
+ next unless $self->{$tmp};
+ push @m, "$tmp = $self->{$tmp}\n";
+ }
return join "", @m;
}
my($self) = @_;
my @m = ();
+ $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use
+
for my $macro (qw(
- AR_STATIC_ARGS DIRFILESEP
+ AR_STATIC_ARGS DIRFILESEP DFSEP
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
+ INSTALLDIRS INSTALL_BASE DESTDIR PREFIX
PERLPREFIX SITEPREFIX VENDORPREFIX
),
(map { ("INSTALL".$_,
};
for my $macro (qw/
+ MAKE
FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
- LDFROM LINKTYPE PM_FILTER
+ LDFROM LINKTYPE BOOTDEP
/ )
{
next unless defined $self->{$macro};
push @m, q{
# Where is the Config information that we are using/depend on
-CONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h
+CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
};
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 "::".
-
-=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
- \$(NOECHO) \$(MKPATH) $targdir
- \$(NOECHO) \$(EQUALIZE_TIMESTAMP) $src $targ
-};
- push(@m, qq{
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir
-}) unless $Is_VMS;
- }
- join "", @m;
-}
=item init_DEST
MAKE_FRAG
}
-=item distdir
-
-Defines the scratch directory target that will hold the distribution
-before tar-ing (or shar-ing).
-
-=cut
-
-# For backwards compatibility.
-*dist_dir = *distdir;
-
-sub distdir {
- my($self) = shift;
-
- return <<'MAKE_FRAG';
-distdir : metafile metafile_addtomanifest
- $(RM_RF) $(DISTVNAME)
- $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
- -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
-
-MAKE_FRAG
-
-}
-
-=item dist_test
-
-Defines a target that produces the distribution in the
-scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that
-subdirectory.
-
-=cut
-
-sub dist_test {
- my($self) = shift;
- my @m;
- push @m, q{
-disttest : distdir
- cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
- cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
- cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
-};
- join "", @m;
-}
=item dlsyms (o)
-Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp
-files.
+Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.
+
+Normally just returns an empty string.
=cut
sub dlsyms {
- my($self,%attribs) = @_;
-
- return '' unless ($Is_AIX && $self->needs_linking() );
-
- my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
- my(@m);
-
- push(@m,"
-dynamic :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...
-
- push(@m,"
-static :: $self->{BASEEXT}.exp
-
-") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them
-
- push(@m,"
-$self->{BASEEXT}.exp: Makefile.PL
-",' $(PERLRUN) -e \'use ExtUtils::Mksymlists; \\
- Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',
- neatvalue($funcs), ', "FUNCLIST" => ', neatvalue($funclist),
- ', "DL_VARS" => ', neatvalue($vars), ');\'
-');
-
- join('',@m);
+ return '';
}
-=item dynamic (o)
-
-Defines the dynamic target.
-
-=cut
-
-sub dynamic {
-# --- Dynamic Loading Sections ---
-
- my($self) = shift;
- '
-dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
- $(NOECHO) $(NOOP)
-';
-}
=item dynamic_bs (o)
BOOTSTRAP =
' unless $self->has_link_code();
- return <<'MAKE_FRAG';
+ my $target = $Is_VMS ? '$(MMS$TARGET)' : '$@';
+
+ return sprintf <<'MAKE_FRAG', ($target) x 5;
BOOTSTRAP = $(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): $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) \
"-MExtUtils::Mkbootstrap" \
-e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
- $(NOECHO) $(TOUCH) $(BOOTSTRAP)
- $(CHMOD) $(PERM_RW) $@
+ $(NOECHO) $(TOUCH) %s
+ $(CHMOD) $(PERM_RW) %s
-$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
- $(NOECHO) $(RM_RF) $(INST_BOOT)
- -$(CP) $(BOOTSTRAP) $(INST_BOOT)
- $(CHMOD) $(PERM_RW) $@
+$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
+ $(NOECHO) $(RM_RF) %s
+ - $(CP) $(BOOTSTRAP) %s
+ $(CHMOD) $(PERM_RW) %s
MAKE_FRAG
}
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) $(INST_ARCHAUTODIR)$(DFSEP).exists $(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 || $Is_Interix) && $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,
-' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
-' $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) '.$libs.' $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(INST_DYNAMIC_FIX)');
- push @m, '
+ my $ld_run_path_shell = "";
+ if ($self->{LD_RUN_PATH} ne "") {
+ $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
+ }
+
+ push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $ldfrom, $libs;
+ %s$(LD) %s $(LDDLFLAGS) %s $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \
+ $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \
+ $(INST_DYNAMIC_FIX)
+MAKE
+
+ push @m, <<'MAKE';
$(CHMOD) $(PERM_RWX) $@
-';
+MAKE
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('',@m);
+ return join('',@m);
}
=item exescan
next unless $self->maybe_command($abs);
print "Executing $abs\n" if ($trace >= 2);
- my $version_check = qq{$abs -e "require $ver; print qq{VER_OK\n}"};
- # To avoid using the unportable 2>&1 to supress STDERR,
+ my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
+ # To avoid using the unportable 2>&1 to suppress STDERR,
# we close it before running the command.
# However, thanks to a thread library bug in many BSDs
# ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
print "Using PERL=$abs\n" if $trace;
return $abs;
} elsif ($trace >= 2) {
- print "Result: '$val'\n";
+ print "Result: '$val' ".($? >> 8)."\n";
}
}
}
0; # false and not empty
}
-=item find_tests
-
- my $test = $mm->find_tests;
-
-Returns a string suitable for feeding to the shell to return all
-tests in t/*.t.
-
-=cut
-
-sub find_tests {
- my($self) = shift;
- return 't/*.t';
-}
-
-=back
-
-=head2 Methods to actually produce chunks of text for the Makefile
-
-The methods here are called for each MakeMaker object in the order
-specified by @ExtUtils::MakeMaker::MM_Sections.
-
-=over 2
=item fixin
# Print out the new #! line (or equivalent).
local $\;
- undef $/;
+ local $/;
print FIXOUT $shb, <FIXIN>;
close FIXIN;
close FIXOUT;
chmod 0666, $file_bak;
unlink $file_bak;
- unless ( rename($file, $file_bak) ) {
+ unless ( _rename($file, $file_bak) ) {
warn "Can't rename $file to $file_bak: $!";
next;
}
- unless ( rename($file_new, $file) ) {
+ unless ( _rename($file_new, $file) ) {
warn "Can't rename $file_new to $file: $!";
- unless ( rename($file_bak, $file) ) {
+ unless ( _rename($file_bak, $file) ) {
warn "Can't rename $file_bak back to $file either: $!";
warn "Leaving $file renamed as $file_bak\n";
}
}
}
+
+sub _rename {
+ my($old, $new) = @_;
+
+ foreach my $file ($old, $new) {
+ if( $Is_VMS and basename($file) !~ /\./ ) {
+ # rename() in 5.8.0 on VMS will not rename a file if it
+ # does not contain a dot yet it returns success.
+ $file = "$file.";
+ }
+ }
+
+ return rename($old, $new);
+}
+
+
=item force (o)
-Just writes FORCE:
+Writes an empty FORCE: target.
=cut
=item init_dirscan
-Scans the directory structure and initializes DIR, XS, XS_FILES, PM,
-C, C_FILES, O_FILES, H, H_FILES, PL_FILES, MAN*PODS, EXE_FILES.
+Scans the directory structure and initializes DIR, XS, XS_FILES,
+C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
Called by init_main.
sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
my($self) = @_;
- my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods);
- my %pm;
+ my($name, %dir, %xs, %c, %h, %pl_files, %pm);
- @ignore{qw(Makefile.PL test.pl t)} = (1,1,1);
+ my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t);
# ignore the distdir
$Is_VMS ? $ignore{"$self->{DISTVNAME}.dir"} = 1
}
}
+ $self->{PL_FILES} ||= \%pl_files;
+ $self->{DIR} ||= [sort keys %dir];
+ $self->{XS} ||= \%xs;
+ $self->{C} ||= [sort keys %c];
+ $self->{H} ||= [sort keys %h];
+ $self->{PM} ||= \%pm;
+
+ my @o_files = @{$self->{C}};
+ $self->{O_FILES} = [grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files];
+}
+
+
+=item init_MANPODS
+
+Determines if man pages should be generated and initializes MAN1PODS
+and MAN3PODS as appropriate.
+
+=cut
+
+sub init_MANPODS {
+ my $self = shift;
+
+ # Set up names of manual pages to generate from pods
+ foreach my $man (qw(MAN1 MAN3)) {
+ if ( $self->{"${man}PODS"}
+ or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
+ ) {
+ $self->{"${man}PODS"} ||= {};
+ }
+ else {
+ my $init_method = "init_${man}PODS";
+ $self->$init_method();
+ }
+ }
+}
+
+
+sub _has_pod {
+ my($self, $file) = @_;
+
+ local *FH;
+ my($ispod)=0;
+ if (open(FH,"<$file")) {
+ while (<FH>) {
+ if (/^=(?:head\d+|item|pod)\b/) {
+ $ispod=1;
+ last;
+ }
+ }
+ close FH;
+ } else {
+ # If it doesn't exist yet, we assume, it has pods in it
+ $ispod = 1;
+ }
+
+ return $ispod;
+}
+
+
+=item init_MAN1PODS
+
+Initializes MAN1PODS from the list of EXE_FILES.
+
+=cut
+
+sub init_MAN1PODS {
+ my($self) = @_;
+
+ if ( exists $self->{EXE_FILES} ) {
+ foreach my $name (@{$self->{EXE_FILES}}) {
+ next unless $self->_has_pod($name);
+
+ $self->{MAN1PODS}->{$name} =
+ $self->catfile("\$(INST_MAN1DIR)",
+ basename($name).".\$(MAN1EXT)");
+ }
+ }
+}
+
+
+=item init_MAN3PODS
+
+Initializes MAN3PODS from the list of PM files.
+
+=cut
+
+sub init_MAN3PODS {
+ my $self = shift;
+
+ my %manifypods = (); # we collect the keys first, i.e. the files
+ # we have to convert to pod
+
+ foreach my $name (keys %{$self->{PM}}) {
+ if ($name =~ /\.pod\z/ ) {
+ $manifypods{$name} = $self->{PM}{$name};
+ } elsif ($name =~ /\.p[ml]\z/ ) {
+ if( $self->_has_pod($name) ) {
+ $manifypods{$name} = $self->{PM}{$name};
+ }
+ }
+ }
+
+ my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
+
+ # Remove "Configure.pm" and similar, if it's not the only pod listed
+ # To force inclusion, just name it "Configure.pod", or override
+ # MAN3PODS
+ foreach my $name (keys %manifypods) {
+ if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) {
+ delete $manifypods{$name};
+ next;
+ }
+ my($manpagename) = $name;
+ $manpagename =~ s/\.p(od|m|l)\z//;
+ # everything below lib is ok
+ unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) {
+ $manpagename = $self->catfile(
+ split(/::/,$self->{PARENT_NAME}),$manpagename
+ );
+ }
+ $manpagename = $self->replace_manpage_separator($manpagename);
+ $self->{MAN3PODS}->{$name} =
+ $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)");
+ }
+}
+
+
+=item init_PM
+
+Initializes PMLIBDIRS and PM from PMLIBDIRS.
+
+=cut
+
+sub init_PM {
+ my $self = shift;
+
# Some larger extensions often wish to install a number of *.pm/pl
# files into the library in various locations.
# Avoid $_ wherever possible:
# @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
- my ($pmlibdir);
@{$self->{PMLIBDIRS}} = ();
- foreach $pmlibdir (@pmlibdirs) {
+ my %dir = map { ($_ => $_) } @{$self->{DIR}};
+ foreach my $pmlibdir (@pmlibdirs) {
-d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
}
+ unless( $self->{PMLIBPARENTDIRS} ) {
+ @{$self->{PMLIBPARENTDIRS}} = ('lib');
+ }
+
+ return if $self->{PM} and $self->{ARGS}{PM};
+
if (@{$self->{PMLIBDIRS}}){
print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
if ($Verbose >= 2);
my $prefix = $self->{INST_LIBDIR};
my $striplibpath;
+ my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
$prefix = $self->{INST_LIB}
- if ($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i;
+ if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W}
+ {$1}i;
my($inst) = $self->catfile($prefix,$striplibpath);
local($_) = $inst; # for backwards compatibility
$inst = $self->libscan($inst);
print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
return unless $inst;
- $pm{$path} = $inst;
+ $self->{PM}{$path} = $inst;
}, @{$self->{PMLIBDIRS}});
}
-
- $self->{PM} ||= \%pm;
- $self->{PL_FILES} ||= \%pl_files;
-
- $self->{DIR} ||= [sort keys %dir];
-
- $self->{XS} ||= \%xs;
- $self->{C} ||= [sort keys %c];
- my @o_files = @{$self->{C}};
- $self->{O_FILES} = [grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files];
-
- $self->{H} ||= [sort keys %h];
-
- # Set up names of manual pages to generate from pods
- my %pods;
- foreach my $man (qw(MAN1 MAN3)) {
- unless ($self->{"${man}PODS"}) {
- $self->{"${man}PODS"} = {};
- $pods{$man} = 1 unless
- $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/;
- }
- }
-
- if ($pods{MAN1}) {
- if ( exists $self->{EXE_FILES} ) {
- foreach $name (@{$self->{EXE_FILES}}) {
- local *FH;
- my($ispod)=0;
- if (open(FH,"<$name")) {
- while (<FH>) {
- if (/^=(?:head\d+|item|pod)\b/) {
- $ispod=1;
- last;
- }
- }
- close FH;
- } else {
- # If it doesn't exist yet, we assume, it has pods in it
- $ispod = 1;
- }
- next unless $ispod;
- if ($pods{MAN1}) {
- $self->{MAN1PODS}->{$name} =
- $self->catfile("\$(INST_MAN1DIR)", basename($name).".\$(MAN1EXT)");
- }
- }
- }
- }
- if ($pods{MAN3}) {
- 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\z/ ) {
- $manifypods{$name} = $self->{PM}{$name};
- } elsif ($name =~ /\.p[ml]\z/ ) {
- local *FH;
- my($ispod)=0;
- if (open(FH,"<$name")) {
- while (<FH>) {
- if (/^=head1\s+\w+/) {
- $ispod=1;
- last;
- }
- }
- close FH;
- } else {
- $ispod = 1;
- }
- if( $ispod ) {
- $manifypods{$name} = $self->{PM}{$name};
- }
- }
- }
-
- # Remove "Configure.pm" and similar, if it's not the only pod listed
- # To force inclusion, just name it "Configure.pod", or override
- # MAN3PODS
- foreach $name (keys %manifypods) {
- if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) {
- delete $manifypods{$name};
- next;
- }
- my($manpagename) = $name;
- $manpagename =~ s/\.p(od|m|l)\z//;
- # everything below lib is ok
- unless($manpagename =~ s!^\W*lib\W+!!s) {
- $manpagename = $self->catfile(
- split(/::/,$self->{PARENT_NAME}),$manpagename
- );
- }
- if ($pods{MAN3}) {
- $manpagename = $self->replace_manpage_separator($manpagename);
- $self->{MAN3PODS}->{$name} =
- $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)");
- }
- }
- }
}
+
=item init_DIRFILESEP
Using / for Unix. Called by init_main.
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.
&&
-s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt')
or
- $Is_Mac
- or
$Is_Win32
){
warn qq{
and not $old){
# Maybe somebody tries to build an extension with an
# uninstalled Perl outside of Perl build tree
- my $found;
+ my $lib;
for my $dir (@INC) {
- $found = $dir, last if -e $self->catdir($dir, "Config.pm");
+ $lib = $dir, last if -e $self->catdir($dir, "Config.pm");
}
- if ($found) {
- my $inc = dirname $found;
+ if ($lib) {
+ # Win32 puts its header files in /perl/src/lib/CORE.
+ # Unix leaves them in /perl/src.
+ my $inc = $Is_Win32 ? $self->catdir($lib, "CORE" )
+ : dirname $lib;
if (-e $self->catdir($inc, "perl.h")) {
- $self->{PERL_LIB} = $found;
- $self->{PERL_ARCHLIB} = $found;
+ $self->{PERL_LIB} = $lib;
+ $self->{PERL_ARCHLIB} = $lib;
$self->{PERL_INC} = $inc;
$self->{UNINSTALLED_PERL} = 1;
print STDOUT <<EOP;
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, ECHO, ECHO_N
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} ||= $self->{MAKEFILE} || 'Makefile';
+ $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
+ $self->{MAKEFILE_OLD} ||= $self->{MAKEFILE}.'.old';
+ $self->{MAKE_APERL_FILE} ||= $self->{MAKEFILE}.'.aperl';
+
+ # Some makes require a wrapper around macros passed in on the command
+ # line.
+ $self->{MACROSTART} ||= '';
+ $self->{MACROEND} ||= '';
+
+ # Not everybody uses -f to indicate "use this Makefile instead"
+ $self->{USEMAKEFILE} ||= '-f';
$self->{SHELL} ||= $Config{sh} || '/bin/sh';
$self->{CP} ||= "cp";
$self->{MV} ||= "mv";
$self->{CHMOD} ||= "chmod";
- $self->{MKPATH} ||= '$(PERLRUN) "-MExtUtils::Command" -e mkpath';
+ $self->{MKPATH} ||= '$(ABSPERLRUN) "-MExtUtils::Command" -e mkpath';
$self->{EQUALIZE_TIMESTAMP} ||=
- '$(PERLRUN) "-MExtUtils::Command" -e eqtime';
+ '$(ABSPERLRUN) "-MExtUtils::Command" -e eqtime';
$self->{UNINST} ||= 0;
$self->{VERBINST} ||= 0;
$self->oneliner(<<'CODE', ['-MExtUtils::Install']);
install({@ARGV}, '$(VERBINST)', 0, '$(UNINST)');
CODE
- $self->{DOC_INSTALL} ||=
- '$(PERLRUN) "-MExtUtils::Command::MM" -e perllocal_install';
- $self->{UNINSTALL} ||=
- '$(PERLRUN) "-MExtUtils::Command::MM" -e uninstall';
+ $self->{DOC_INSTALL} ||=
+ '$(ABSPERLRUN) "-MExtUtils::Command::MM" -e perllocal_install';
+ $self->{UNINSTALL} ||=
+ '$(ABSPERLRUN) "-MExtUtils::Command::MM" -e uninstall';
$self->{WARN_IF_OLD_PACKLIST} ||=
- '$(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist';
+ '$(ABSPERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist';
+ $self->{FIXIN} ||=
+ q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"};
$self->{UMASK_NULL} ||= "umask 0";
$self->{DEV_NULL} ||= "> /dev/null 2>&1";
return 1;
}
-=item init_INST
-
- $mm->init_INST;
-
-Called by init_main. Sets up all INST_* variables except those related
-to XS code. Those are handled in init_xs.
-
-=cut
-
-sub init_INST {
- my($self) = shift;
-
- $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch");
- $self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin');
-
- # 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{privlibexp}.
- unless ($self->{INST_LIB}){
- if ($self->{PERL_CORE}) {
- if (defined $Cross::platform) {
- $self->{INST_LIB} = $self->{INST_ARCHLIB} =
- $self->catdir($self->{PERL_LIB},"..","xlib",
- $Cross::platform);
- }
- else {
- $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB};
- }
- } else {
- $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib");
- }
- }
-
- my @parentdir = split(/::/, $self->{PARENT_NAME});
- $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_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1');
- $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3');
-
- return 1;
-}
-
-=item init_INSTALL
-
- $mm->init_INSTALL;
-
-Called by init_main. Sets up all INSTALL_* variables (except
-INSTALLDIRS) and *PREFIX.
-
-=cut
-
-sub init_INSTALL {
- my($self) = shift;
-
- $self->init_lib2arch;
-
- # Initialize installvendorman*dir if necessary
- foreach my $num (1, 3) {
- my $k = 'installvendorman'.$num.'dir';
-
- unless ($Config{$k}) {
- $Config_Override{$k} = $Config{usevendorprefix} ?
- $self->catdir($Config{vendorprefixexp}, 'man', "man$num") :
- '';
- }
- }
-
- my $iprefix = $Config{installprefixexp} || $Config{installprefix} ||
- $Config{prefixexp} || $Config{prefix} || '';
- my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : '';
- my $sprefix = $Config{siteprefixexp} || '';
-
- # 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} ||= '';
-
- if( $self->{PREFIX} ) {
- @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} =
- ('$(PREFIX)') x 3;
- }
- else {
- $self->{PERLPREFIX} ||= $iprefix;
- $self->{SITEPREFIX} ||= $sprefix;
- $self->{VENDORPREFIX} ||= $vprefix;
- }
-
- my $arch = $Config{archname};
- my $version = $Config{version};
-
- # default style
- my $libstyle = $Config{installstyle} || 'lib/perl5';
- my $manstyle = '';
-
- if( $self->{LIBSTYLE} ) {
- $libstyle = $self->{LIBSTYLE};
- $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : '';
- }
-
- # Some systems, like VOS, set installman*dir to '' if they can't
- # read man pages.
- for my $num (1, 3) {
- $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none'
- unless $Config{'installman'.$num.'dir'};
- }
-
- my %bin_layouts =
- (
- bin => { s => $iprefix,
- t => 'perl',
- d => 'bin' },
- vendorbin => { s => $vprefix,
- t => 'vendor',
- d => 'bin' },
- sitebin => { s => $sprefix,
- t => 'site',
- d => 'bin' },
- script => { s => $iprefix,
- t => 'perl',
- d => 'bin' },
- );
-
- my %man_layouts =
- (
- man1dir => { s => $iprefix,
- t => 'perl',
- d => 'man/man1',
- style => $manstyle, },
- siteman1dir => { s => $sprefix,
- t => 'site',
- d => 'man/man1',
- style => $manstyle, },
- vendorman1dir => { s => $vprefix,
- t => 'vendor',
- d => 'man/man1',
- style => $manstyle, },
-
- man3dir => { s => $iprefix,
- t => 'perl',
- d => 'man/man3',
- style => $manstyle, },
- siteman3dir => { s => $sprefix,
- t => 'site',
- d => 'man/man3',
- style => $manstyle, },
- vendorman3dir => { s => $vprefix,
- t => 'vendor',
- d => 'man/man3',
- style => $manstyle, },
- );
-
- my %lib_layouts =
- (
- privlib => { s => $iprefix,
- t => 'perl',
- d => '',
- style => $libstyle, },
- vendorlib => { s => $vprefix,
- t => 'vendor',
- d => '',
- style => $libstyle, },
- sitelib => { s => $sprefix,
- t => 'site',
- d => 'site_perl',
- style => $libstyle, },
-
- archlib => { s => $iprefix,
- t => 'perl',
- d => "$version/$arch",
- style => $libstyle },
- vendorarch => { s => $vprefix,
- t => 'vendor',
- d => "$version/$arch",
- style => $libstyle },
- sitearch => { s => $sprefix,
- t => 'site',
- d => "site_perl/$version/$arch",
- style => $libstyle },
- );
-
-
- # Special case for LIB.
- if( $self->{LIB} ) {
- foreach my $var (keys %lib_layouts) {
- my $Installvar = uc "install$var";
-
- if( $var =~ /arch/ ) {
- $self->{$Installvar} ||=
- $self->catdir($self->{LIB}, $Config{archname});
- }
- else {
- $self->{$Installvar} ||= $self->{LIB};
- }
- }
- }
-
- my %type2prefix = ( perl => 'PERLPREFIX',
- site => 'SITEPREFIX',
- vendor => 'VENDORPREFIX'
- );
-
- my %layouts = (%bin_layouts, %man_layouts, %lib_layouts);
- while( my($var, $layout) = each(%layouts) ) {
- my($s, $t, $d, $style) = @{$layout}{qw(s t d style)};
- my $r = '$('.$type2prefix{$t}.')';
-
- print STDERR "Prefixing $var\n" if $Verbose >= 2;
-
- my $installvar = "install$var";
- my $Installvar = uc $installvar;
- next if $self->{$Installvar};
-
- $d = "$style/$d" if $style;
- $self->prefixify($installvar, $s, $r, $d);
-
- print STDERR " $Installvar == $self->{$Installvar}\n"
- if $Verbose >= 2;
- }
-
- # Generate these if they weren't figured out.
- $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH};
- $self->{VENDORLIBEXP} ||= $self->{INSTALLVENDORLIB};
-
- return 1;
-}
=item init_linker
# 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
}
# Are we building the core?
- $self->{PERL_CORE} = 0 unless exists $self->{PERL_CORE};
+ $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE};
+ $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE};
# How do we run perl?
foreach my $perl (qw(PERL FULLPERL ABSPERL)) {
}
-=item init_platform (o)
+=item init_platform
-Add MM_Unix_VERSION.
+=item platform_constants
-=item platform_constants (o)
+Add MM_Unix_VERSION.
=cut
push @m, q{
install :: all pure_install doc_install
+ $(NOECHO) $(NOOP)
install_perl :: all pure_perl_install doc_perl_install
+ $(NOECHO) $(NOOP)
install_site :: all pure_site_install doc_site_install
+ $(NOECHO) $(NOOP)
install_vendor :: all pure_vendor_install doc_vendor_install
+ $(NOECHO) $(NOOP)
pure_install :: pure_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
doc_install :: doc_$(INSTALLDIRS)_install
+ $(NOECHO) $(NOOP)
pure__install : pure_site_install
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
$(INST_LIB) $(DESTINSTALLSITELIB) \
$(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
$(INST_BIN) $(DESTINSTALLSITEBIN) \
- $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \
$(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
$(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
$(INST_LIB) $(DESTINSTALLVENDORLIB) \
$(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
$(INST_BIN) $(DESTINSTALLVENDORBIN) \
- $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \
$(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
$(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
push @m, q{
uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
uninstall_from_perldirs ::
$(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
sub installbin {
my($self) = shift;
+
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 @exefiles = @{$self->{EXE_FILES}};
+ return "" unless @exefiles;
+
+ @exefiles = map vmsify($_), @exefiles if $Is_VMS;
+
+ my %fromto;
+ for my $from (@exefiles) {
my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
+
local($_) = $path; # for backwards compatibility
- $to = $self->libscan($path);
+ my $to = $self->libscan($path);
print "libscan($from) => '$to'\n" if ($Verbose >=2);
- $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)"};
+ $to = vmsify($to) if $Is_VMS;
+ $fromto{$from} = $to;
}
+ my @to = values %fromto;
+ my @m;
push(@m, qq{
-EXE_FILES = @{$self->{EXE_FILES}}
-
-FIXIN = $fixin
+EXE_FILES = @exefiles
pure_all :: @to
\$(NOECHO) \$(NOOP)
realclean ::
- \$(RM_F) @to
});
- while (($from,$to) = each %fromto) {
+ # realclean can get rather large.
+ push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to);
+ push @m, "\n";
+
+
+ # A target for each exe file.
+ while (my($from,$to) = each %fromto) {
last unless defined $from;
- my $todir = dirname($to);
- push @m, "
-$to: $from \$(FIRST_MAKEFILE) " . $self->catdir($todir,'.exists') . "
- \$(NOECHO) \$(RM_F) $to
- \$(CP) $from $to
- \$(FIXIN) $to
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $to
-";
+
+ push @m, sprintf <<'MAKE', $to, $from, $to, $from, $to, $to, $to;
+%s : %s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists
+ $(NOECHO) $(RM_F) %s
+ $(CP) %s %s
+ $(FIXIN) %s
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) %s
+
+MAKE
+
}
+
join "", @m;
}
unless ($self->{MAKEAPERL}) {
push @m, q{
$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
- $(MAKE) -f $(MAKE_APERL_FILE) $@
+ $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
-$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
$(NOECHO) $(PERLRUNINST) \
Makefile.PL DIR=}, $dir, q{ \
$linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
# Which *.a files could we make use of...
- local(%static);
+ my %static;
require File::Find;
File::Find::find(sub {
return unless m/\Q$self->{LIB_EXT}\E$/;
- return if m/^libperl/;
- # Skip purified versions of libraries (e.g., DynaLoader_pure_p1_c0_032.a)
+
+ # Skip perl's libraries.
+ 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";
if( exists $self->{INCLUDE_EXT} ){
LLIBPERL = $llibperl
";
- push @m, "
-\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)\$(DIRFILESEP).exists ".join(" \\\n\t", @$extra).'
+ push @m, '
+$(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
$(NOECHO) $(RM_F) $@
$(NOECHO) $(TOUCH) $@
';
\$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
\$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) \$(LLIBPERL) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
\$(NOECHO) \$(ECHO) 'To install the new \"\$(MAP_TARGET)\" binary, call'
- \$(NOECHO) \$(ECHO) ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
+ \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
\$(NOECHO) \$(ECHO) 'To remove the intermediate files say'
- \$(NOECHO) \$(ECHO) ' make -f $makefilename map_clean'
+ \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename map_clean'
$tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
";
- push @m, qq{\tcd $tmp && $cccmd "-I\$(PERL_INC)" perlmain.c\n};
+ push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n";
push @m, qq{
$tmp/perlmain.c: $makefilename}, q{
MAP_LIBPERL "$(MAP_LIBPERL)" \
>> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
-};
+} if -f 'Makefile.PL';
push @m, q{
inst_perl: pure_inst_perl doc_inst_perl
sub makefile {
my($self) = shift;
- my @m;
+ 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, '
+ $m = '
$(OBJECT) : $(FIRST_MAKEFILE)
+
' if $self->{OBJECT};
- push @m, q{
+ my $newer_than_target = $Is_VMS ? '$(MMS$SOURCE_LIST)' : '$?';
+ my $mpl_args = join " ", map qq["$_"], @ARGV;
+
+ $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args;
# 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) "Makefile out-of-date with respect to %s"
$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
- $(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) $(RM_F) $(MAKEFILE_OLD)
+ -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+ - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
+ $(PERLRUN) Makefile.PL %s
$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
- $(NOECHO) $(ECHO) "==> Please rerun the make command. <=="
+ $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
false
-};
+MAKE_FRAG
- join "", @m;
+ return $m;
}
my $result;
local *FH;
local $/ = "\n";
+ local $_;
open(FH,$parsefile) or die "Could not open '$parsefile': $!";
my $inpod = 0;
while (<FH>) {
my($sep) = $Is_VMS ? ',' : '';
$sep .= "\\\n\t";
- foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE INC DEFINE)) {
- next unless defined $self->{$key};
- if ($key eq 'INC') {
- # For INC we need to prepend parent directory but
- # only iff the parent directory is not absolute.
- my ($o, $i) = $Is_VMS ? ('/Include=', 'i') : ('-I', '');
- my $inc = '';
- foreach (grep { /\S/ } parse_line(qr/\s*(?$i)$o/, 1, $self->{INC})) {
- s/^"(.+)"\s*$/$1/o;
- my $dir = File::Spec->file_name_is_absolute($_) ? $_ : File::Spec->catdir(File::Spec->updir, $_);
- $dir = qq["$dir"] if $dir =~ / /;
- $inc .= " $o$dir";
- }
- push @pasthru, "INC=\"$inc\"";
- } else {
- push @pasthru, "$key=\"\$($key)\"";
- }
+ foreach $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
+ PREFIX INSTALL_BASE)
+ )
+ {
+ next unless defined $self->{$key};
+ push @pasthru, "$key=\"\$($key)\"";
}
- # PASTHRU_DEFINE and PASTHRU_INC are defined explicitly
- # by extensions wanting to do really complex things.
foreach $key (qw(DEFINE INC)) {
+ next unless defined $self->{$key};
push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\"";
}
sub perldepend {
my($self) = shift;
my(@m);
- push @m, q{
+
+ my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
+
+ push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
# 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_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
$(NOECHO) $(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};
+ %s
+MAKE_FRAG
return join "", @m unless $self->needs_linking;
my $self = shift;
my($autodir) = $self->catdir('$(INST_LIB)','auto');
my $r = q{
-pm_to_blib: $(TO_INST_PM)
+pm_to_blib : $(TO_INST_PM)
};
my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}});
$r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
- $r .= q{ $(NOECHO) $(TOUCH) $@};
+ $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};
return $r;
}
sub ppd {
my($self) = @_;
- if ($self->{ABSTRACT_FROM}){
- $self->{ABSTRACT} = $self->parse_abstract($self->{ABSTRACT_FROM}) or
- carp "WARNING: Setting ABSTRACT via file ".
- "'$self->{ABSTRACT_FROM}' failed\n";
- }
-
my ($pack_ver) = join ",", (split (/\./, $self->{VERSION}), (0)x4)[0..3];
my $abstract = $self->{ABSTRACT} || '';
}
- $ppd_xml .= sprintf <<'PPD_OUT', $Config{archname};
+ my $archname = $Config{archname};
+ if ($] >= 5.008) {
+ # archname did not change from 5.6 to 5.8, but those versions may
+ # not be not binary compatible so now we append the part of the
+ # version that changes when binary compatibility may change
+ $archname .= "-". substr($Config{version},0,3);
+ }
+ $ppd_xml .= sprintf <<'PPD_OUT', $archname;
<OS NAME="$(OSNAME)" />
<ARCHITECTURE NAME="%s" />
PPD_OUT
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;
=cut
sub processPL {
- my($self) = shift;
- return "" unless $self->{PL_FILES};
- my(@m, $plfile);
- foreach $plfile (sort keys %{$self->{PL_FILES}}) {
- my $list = ref($self->{PL_FILES}->{$plfile})
- ? $self->{PL_FILES}->{$plfile}
- : [$self->{PL_FILES}->{$plfile}];
- my $target;
- foreach $target (@$list) {
- push @m, "
+ my $self = shift;
+ my $pl_files = $self->{PL_FILES};
+
+ return "" unless $pl_files;
+
+ my $m = '';
+ foreach my $plfile (sort keys %$pl_files) {
+ my $list = ref($pl_files->{$plfile})
+ ? $pl_files->{$plfile}
+ : [$pl_files->{$plfile}];
+
+ foreach my $target (@$list) {
+ if( $Is_VMS ) {
+ $plfile = vmsify($self->eliminate_macros($plfile));
+ $target = vmsify($self->eliminate_macros($target));
+ }
+
+ # Normally a .PL file runs AFTER pm_to_blib so it can have
+ # blib in its @INC and load the just built modules. BUT if
+ # the generated module is something in $(TO_INST_PM) which
+ # pm_to_blib depends on then it can't depend on pm_to_blib
+ # else we have a dependency loop.
+ my $pm_dep;
+ my $perlrun;
+ if( defined $self->{PM}{$target} ) {
+ $pm_dep = '';
+ $perlrun = 'PERLRUN';
+ }
+ else {
+ $pm_dep = 'pm_to_blib';
+ $perlrun = 'PERLRUNINST';
+ }
+
+ $m .= <<MAKE_FRAG;
+
all :: $target
\$(NOECHO) \$(NOOP)
-$target :: $plfile
- \$(PERLRUNINST) $plfile $target
-";
+$target :: $plfile $pm_dep
+ \$($perlrun) $plfile $target
+MAKE_FRAG
+
}
}
- join "", @m;
+
+ return $m;
}
=item quote_paren
sub quote_paren {
my $arg = shift;
- $arg =~ s/\$\((.+?)\)/\$\\\\($1\\\\)/g; # protect $(...)
- $arg =~ s/(?<!\\)([()])/\\$1/g; # quote unprotected
- $arg =~ s/\$\\\\\((.+?)\\\\\)/\$($1)/g; # unprotect $(...)
+ $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...)
+ $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected
+ $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...)
return $arg;
}
-=item realclean (o)
-
-Defines the realclean target.
-
-=cut
-
-sub realclean {
- my($self, %attribs) = @_;
- my(@m);
-
- push(@m,'
-# Delete temporary files (via clean) and also delete installed files
-realclean purge :: clean realclean_subdirs
- $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
- $(RM_RF) $(DISTVNAME)
-');
-
- if( $self->has_link_code ){
- push(@m, " \$(RM_F) \$(INST_DYNAMIC) \$(INST_BOOT)\n");
- push(@m, " \$(RM_F) \$(INST_STATIC)\n");
- }
-
- my @files = values %{$self->{PM}};
- push @files, $attribs{FILES} if $attribs{FILES};
- push @files, '$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)';
-
- # Occasionally files are repeated several times from different sources
- { my(%f) = map { ($_,1) } @files; @files = keys %f; }
-
- # Issue a several little RM_F commands rather than risk creating a
- # very long command line (useful for extensions such as Encode
- # that have many files).
- my $line = "";
- foreach my $file (@files) {
- if (length($line) + length($file) > 200) {
- push @m, "\t\$(RM_F) $line\n";
- $line = $file;
- }
- else {
- $line .= " $file";
- }
- }
- push @m, "\t\$(RM_F) $line\n" if $line;
- push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP};
-
- join("", @m);
-}
-
-
-=item realclean_subdirs_target
-
- my $make_frag = $MM->realclean_subdirs_target;
-
-Returns the realclean_subdirs target. This is used by the realclean
-target to call realclean on any subdirectories which contain Makefiles.
-
-=cut
-
-sub realclean_subdirs_target {
- my $self = shift;
-
- return <<'NOOP_FRAG' unless @{$self->{DIR}};
-realclean_subdirs :
- $(NOECHO) $(NOOP)
-NOOP_FRAG
-
- my $rclean = "realclean_subdirs :\n";
-
- foreach my $dir (@{$self->{DIR}}){
- $rclean .= sprintf <<'RCLEAN', $dir, $dir;
- -cd %s && $(TEST_F) $(MAKEFILE_OLD) && $(MAKE) -f $(MAKEFILE_OLD) realclean
- -cd %s && $(TEST_F) $(FIRST_MAKEFILE) && $(MAKE) realclean
-RCLEAN
-
- }
-
- return $rclean;
-}
-
-
=item replace_manpage_separator
my $man_name = $MM->replace_manpage_separator($file_path);
}
-=item oneliner (o)
+=item cd
+
+=cut
+
+sub cd {
+ my($self, $dir, @cmds) = @_;
+
+ # No leading tab and no trailing newline makes for easier embedding
+ my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds;
+
+ return $make_frag;
+}
+
+=item oneliner
=cut
$cmd =~ s{\n+$}{};
my @cmds = split /\n/, $cmd;
- $cmd = join " \n\t-e ", map $self->quote_literal($_), @cmds;
+ $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds;
$cmd = $self->escape_newlines($cmd);
$switches = join ' ', @$switches;
- return qq{\$(PERLRUN) $switches -e $cmd};
+ return qq{\$(ABSPERLRUN) $switches -e $cmd --};
}
my(@m);
push(@m, <<'END');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
MAKE_FRAG
- push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)');
join('', @m);
}
sub subdir_x {
my($self, $subdir) = @_;
- return sprintf <<'EOT', $subdir;
+
+ my $subdir_cmd = $self->cd($subdir,
+ '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)'
+ );
+ return sprintf <<'EOT', $subdir_cmd;
subdirs ::
- $(NOECHO)cd %s && $(MAKE) -f $(FIRST_MAKEFILE) all $(PASTHRU)
+ $(NOECHO) %s
EOT
+
}
=item subdirs (o)
}
# note: 'test.pl' name is also hardcoded in init_dirscan()
my(@m);
+ my $subdirs_test = ($self->{DIR} && @{$self->{DIR}} ? 'subdirs-test' : '');
push(@m,"
TEST_VERBOSE=0
TEST_TYPE=test_\$(LINKTYPE)
testdb :: testdb_\$(LINKTYPE)
-test :: \$(TEST_TYPE)
+test :: \$(TEST_TYPE) $subdirs_test
");
- 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}}));
- }
- else {
- push(@m, map("\t\$(NOECHO) cd $_ && \$(TEST_F) \$(FIRST_MAKEFILE) && \$(MAKE) test \$(PASTHRU)\n", @{$self->{DIR}}));
+ foreach my $dir (@{ $self->{DIR} }) {
+ my $test = $self->oneliner(sprintf <<'CODE', $dir);
+chdir '%s';
+system '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) test $(PASTHRU)'
+ if -f '$(FIRST_MAKEFILE)';
+CODE
+
+ push(@m, "\nsubdirs-test ::\n\t\$(NOECHO) $test\n");
}
push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
my $make_frag = $MM->tools_other;
-Returns a make fragment containing definitions for:
-
-SHELL, CHMOD, CP, MV, NOOP, NOECHO, RM_F, RM_RF, TEST_F, TOUCH,
-DEV_NULL, UMASK_NULL, MKPATH, EQUALIZE_TIMESTAMP,
-WARN_IF_OLD_PACKLIST, UNINST, VERBINST, MOD_INSTALL, DOC_INSTALL and
-UNINSTALL
-
-init_others() initializes all these values.
+Returns a make fragment containing definitions for the macros init_others()
+initializes.
=cut
my($self) = shift;
my @m;
+ # We set PM_FILTER as late as possible so it can see all the earlier
+ # on macro-order sensitive makes such as nmake.
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 ECHO_N
UNINST VERBINST
MOD_INSTALL DOC_INSTALL UNINSTALL
WARN_IF_OLD_PACKLIST
+ MACROSTART MACROEND
+ USEMAKEFILE
+ PM_FILTER
+ FIXIN
} )
{
next unless defined $self->{$tool};
return "" unless $self->needs_linking;
my $xsdir;
- foreach my $dir (@INC) {
+ my @xsubpp_dirs = @INC;
+
+ # Make sure we pick up the new xsubpp if we're building perl.
+ unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE};
+
+ foreach my $dir (@xsubpp_dirs) {
$xsdir = $self->catdir($dir, 'ExtUtils');
if( -r $self->catfile($xsdir, "xsubpp") ) {
last;
unshift( @tmargs, $self->{XSOPT} );
}
+ if ($Is_VMS &&
+ $Config{'ldflags'} &&
+ $Config{'ldflags'} =~ m!/Debug!i &&
+ (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)
+ )
+ {
+ unshift(@tmargs,'-nolinenumbers');
+ }
+
$self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
return qq{
XSUBPPDIR = $xsdir
-XSUBPP = \$(XSUBPPDIR)/xsubpp
+XSUBPP = \$(XSUBPPDIR)\$(DFSEP)xsubpp
+XSUBPPRUN = \$(PERLRUN) \$(XSUBPP)
XSPROTOARG = $self->{XSPROTOARG}
XSUBPPDEPS = @tmdeps \$(XSUBPP)
XSUBPPARGS = @tmargs
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
};
return '' unless $self->needs_linking();
'
.xs.c:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
';
}
return '' unless $self->needs_linking();
'
.xs.cpp:
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
';
}
return '' unless $self->needs_linking();
'
.xs$(OBJ_EXT):
- $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
+ $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
';
}