MM_VMS.pm revision 7c478bd95313f5f23a4c958a745db2134aa03244
# MakeMaker default methods for VMS
# This package is inserted into @ISA of MakeMaker's MM before the
# built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under VMS.
#
# Author: Charles Bailey bailey@newman.upenn.edu
use Config;
require Exporter;
$Revision = '5.56 (27-Apr-1999)';
=head1 NAME
ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
=head1 SYNOPSIS
use ExtUtils::MM_VMS; # Done internally by ExtUtils::MakeMaker if needed
=head1 DESCRIPTION
See ExtUtils::MM_Unix for a documentation of the methods provided
there. This package overrides the implementation of these methods, not
the semantics.
=head2 Methods always loaded
=over
=item wraplist
Converts a list into a string wrapped at approximately 80 columns.
=cut
sub wraplist {
my($self) = shift;
my($word);
foreach $word (@_) {
# Perl bug -- seems to occasionally insert extra elements when
# traversing array (scalar(@array) doesn't show them, but
# foreach(@array) does) (5.00307)
next unless $word =~ /\w/;
}
$line;
}
=item rootdir (override)
Returns a string representing of the root directory.
=cut
sub rootdir {
return '';
}
#use SelfLoader;
sub AUTOLOAD {
my $code;
if (defined fileno(DATA)) {
my $o = $/; # For future reads from the file.
$/ = "\n__END__\n";
$/ = $o;
select $fh;
close DATA;
eval $code;
if ($@) {
$@ =~ s/ at .*\n//;
Carp::croak $@;
}
} else {
warn "AUTOLOAD called unexpectedly for $AUTOLOAD";
}
defined(&$AUTOLOAD) or die "Myloader inconsistency error";
goto &$AUTOLOAD;
}
1;
#__DATA__
# This isn't really an override. It's just here because ExtUtils::MM_VMS
# appears in @MM::ISA before ExtUtils::Liblist::Kid, so if there isn't an ext()
# in MM_VMS, then AUTOLOAD is called, and bad things happen. So, we just
# mimic inheritance here and hand off to ExtUtils::Liblist::Kid.
sub ext {
}
=back
=head2 SelfLoaded methods
Those methods which override default MM_Unix methods are marked
"(override)", while methods unique to MM_VMS are marked "(specific)".
For overridden methods, documentation is limited to an explanation
of why this method overrides the MM_Unix method; see the ExtUtils::MM_Unix
documentation for more details.
=over
=item guess_name (override)
Try to determine name of extension being built. We begin with the name
of the current directory. Since VMS filenames are case-insensitive,
however, we look for a F<.pm> file whose name matches that of the current
directory (presumably the 'main' F<.pm> file for this extension), and try
to find a C<package> statement from which to obtain the Mixed::Case
package name.
=cut
sub guess_name {
my($self) = @_;
local *PM;
# Fallback in case for some reason a user has copied the files for an
# extension into a working directory whose name doesn't reflect the
# extension's name. We'll use the name of a unique .pm file, or the
# first .pm file with a matching .xs file.
if (not -e "${defpm}.pm") {
elsif (@pm) {
}
}
if (open(PM,"${defpm}.pm")){
while (<PM>) {
if (/^\s*package\s+([^;]+)/i) {
$defname = $1;
last;
}
}
print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
"defaulting package name to $defname\n"
if eof(PM);
close PM;
}
else {
print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
"defaulting package name to $defname\n";
}
$defname =~ s#[\d.\-_]+$##;
$defname;
}
=item find_perl (override)
Use VMS file specification syntax and CLI commands to find and
invoke Perl images.
=cut
sub find_perl {
my($rslt);
my($inabs) = 0;
local *TCF;
# Check in relative directories first, so we pick up the current
# version of Perl if we're running MakeMaker as part of the main build.
} @$dirs;
# Check miniperl before perl, and check names likely to contain
# version numbers before "generic" names, so we pick up an
# executable that's less likely to be from an old installation.
my($bb) = $b =~ m!([^:>\]/]+)$!;
# Image names containing Perl version use '_' instead of '.' under VMS
if ($trace >= 2){
print "Looking for perl $ver by these names:\n";
print "\t@snames,\n";
print "in these dirs:\n";
print "\t@sdirs\n";
}
next unless defined $dir; # $self->{PERL_SRC} may be undefined
if ($inabs == 1) {
# We've covered relative dirs; everything else is an absolute
# dir (probably an installed location). First, we'll try potential
# command names, to see whether we can avoid a long MCR expression.
$inabs++; # Should happen above in next $dir, but just in case . . .
}
}
}
# If it looks like a potential command, try it without the MCR
if ($name =~ /^[\w\-\$]+$/) {
print TCF "\$ $name -e \"require $ver; print \"\"VER_OK\\n\"\"\"\n";
close TCF;
unlink('temp_mmvms.com');
print "Using PERL=$name\n" if $trace;
return $name;
}
}
$vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
print TCF "\$ mcr $vmsfile -e \"require $ver; print \"\"VER_OK\\n\"\"\" \n";
close TCF;
unlink('temp_mmvms.com');
print "Using PERL=MCR $vmsfile\n" if $trace;
return "MCR $vmsfile";
}
}
print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
0; # false and not empty
}
=item path (override)
Translate logical name DCL$PATH as a searchlist, rather than trying
to C<split> string value of C<$ENV{'PATH'}>.
=cut
sub path {
@dirs;
}
=item maybe_command (override)
Follows VMS naming conventions for executable files.
If the name passed in doesn't exactly match an executable file,
appends F<.Exe> (or equivalent) to check for executable image, and F<.Com>
to check for DCL procedure. If this fails, checks directories in DCL$PATH
and finally F<Sys$System:> for an executable file having the name specified,
with or without the F<.Exe>-equivalent suffix.
=cut
sub maybe_command {
my(@dirs) = ('');
if ($file !~ m![/:>\]]!) {
}
push(@dirs,'Sys$System:');
my $sysfile = "$dir$file";
return $file if -x "$sysfile$ext" && ! -d _;
}
}
}
return 0;
}
=item maybe_command_in_dirs (override)
Uses DCL argument quoting on test command line.
=cut
sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
next unless defined $dir; # $self->{PERL_SRC} may be undefined
} else {
}
print "Substituting $tryabs instead of $abs\n"
if (defined $ver) {
print "Using $abs\n" if $trace;
return $abs;
}
} else { # Do not look for perl
return $abs;
}
}
}
}
=item perl_script (override)
If name passed in doesn't specify a readable file, appends F<.com> or
F<.pl> and tries again, since it's customary to have file types on all files
under VMS.
=cut
sub perl_script {
return "$file.com" if -r "$file.com";
return '';
}
=item file_name_is_absolute (override)
Checks for VMS directory spec as well as Unix separators.
=cut
sub file_name_is_absolute {
# If it's a logical name, expand it.
}
=item replace_manpage_separator
Use as separator a character which is legal in a VMS-syntax file name.
=cut
$man =~ s#/+#__#g;
$man;
}
=item init_others (override)
Provide VMS-specific forms of various utility commands, then hand
off to the default MM_Unix method.
=cut
sub init_others {
my($self) = @_;
$self->{RM_RF} = '$(PERL) "-I$(PERL_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
$self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
}
=item constants (override)
Fixes up numerous file and directory macros to insure VMS syntax
regardless of input syntax. Also adds a few VMS-specific macros
and makes lists of files comma-separated.
=cut
sub constants {
my($self) = @_;
# Be kind about case for pollution
next unless $def;
}
if ($def =~ /=/) {
}
}
}
}
# Fix up directory specs
: '[]';
foreach $macro ( qw [
SITELIBEXP SITEARCHEXP ] ) {
}
# Fix up file specs
}
foreach $macro (qw/
/ ) {
push @m, "$macro = $self->{$macro}\n";
}
push @m, q[
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
];
for $tmp (qw/
/ ) {
}
for $tmp (qw/
/ ) {
push @m, "$tmp = $self->{$tmp}\n";
}
}
}
}
}
push @m,'
# Handy lists of source code files:
XS_FILES = ',$self->wraplist(sort keys %{$self->{XS}}),'
C_FILES = ',$self->wraplist(@{$self->{C}}),'
O_FILES = ',$self->wraplist(@{$self->{O_FILES}} ),'
H_FILES = ',$self->wraplist(@{$self->{H}}),'
MAN1PODS = ',$self->wraplist(sort keys %{$self->{MAN1PODS}}),'
MAN3PODS = ',$self->wraplist(sort keys %{$self->{MAN3PODS}}),'
';
for $tmp (qw/
/) {
push @m, "$tmp = $self->{$tmp}\n";
}
push @m,"
.SUFFIXES :
# Where to put things:
";
if ($self->has_link_code()) {
push @m,'
';
} else {
push @m,'
';
}
push @m,'
TO_INST_PM = ',$self->wraplist(@{$self->{TO_INST_PM}}),'
PM_TO_BLIB = ',$self->wraplist(@{$self->{PM_TO_BLIB}}),'
';
join('',@m);
}
=item cflags (override)
Bypass shell script and produce qualifiers for CC directly (but warn
user if a shell script for this extension exists). Fold multiple
/Defines into one, since some C compilers pay attention to only one
instance of this qualifier on the command line.
=cut
sub cflags {
my($incstr) = '/Include=($(PERL_INC)';
" required to modify CC command for $self->{'BASEEXT'}\n"
}
else { $undefstr .= qq["$def",]; }
}
}
warn "MM_VMS: Ignoring unrecognized CCFLAGS elements \"$quals\"\n";
$quals = '';
}
# Deal with $self->{DEFINE} here since some C compilers pay attention
# to only one /Define clause on command line, so we have to
# conflate the ones from $Config{'ccflags'} and $self->{DEFINE}
# ($self->{DEFINE} has already been VMSified in constants() above)
my(@terms);
my $term = $1;
$term =~ s:^\((.+)\)$:$1:;
}
if ($type eq 'Def') {
}
if (@terms) {
}
}
# Likewise with $self->{INC} and /Include
if ($self->{'INC'}) {
foreach (@includes) {
s/^-I//;
}
}
$quals .= "$incstr)";
# $quals =~ s/,,/,/g; $quals =~ s/\(,/(/g;
}
else {
warn "MM_VMS: Can't parse OPTIMIZE \"$self->{OPTIMIZE}\"; using default\n" if length $self->{OPTIMIZE};
}
}
SPLIT =
LARGE =
};
}
=item const_cccmd (override)
Adds directives to point C preprocessor to the right place when
command line a bit differently than MM_Unix method.
=cut
sub const_cccmd {
my(@m);
push @m,'
}
push @m,'
',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library
',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include';
}
else {
push @m,'
',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ',
',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include';
}
push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n");
}
=item pm_to_blib (override)
DCL I<still> accepts a maximum of 255 characters on a command
line, so we write the (potentially) long list of file names
to a temp file, then persuade Perl to read it instead of the
command line to find args.
=cut
sub pm_to_blib {
my($self) = @_;
push @m, q{
# Dummy target to match Unix target name; we use pm_to_blib.ts as
# timestamp file to avoid repeated invocations under VMS
# As always, keep under DCL's 255-char limit
};
$line .= " $from $to";
if (length($line) > 128) {
push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n");
$line = '';
}
}
push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n") if $line;
push(@m,q[ $(PERL) "-I$(PERL_LIB)" "-MExtUtils::Install" -e "pm_to_blib({split(' ',<STDIN>)},'].$autodir.q[','$(PM_FILTER)')" <.MM_tmp]);
push(@m,qq[
]);
join('',@m);
}
=item tool_autosplit (override)
Use VMS-style quoting on command line.
=cut
sub tool_autosplit{
my($asl) = "";
q{
# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
};
}
=item tool_sxubpp (override)
Use VMS-style quoting on xsubpp command line.
=cut
sub tool_xsubpp {
my($self) = @_;
# drop back to old location if xsubpp is not in new location yet
my(@tmdeps) = '$(XSUBPPDIR)typemap';
my $typemap;
if( ! -f $typemap ){
warn "Typemap $typemap not found.\n";
}
else{
}
}
}
}
if ($Config{'ldflags'} &&
unshift(@tmargs,'-nolinenumbers');
}
# What are the correct thresholds for version 1 && 2 Paul?
if ( $xsubpp_version > 1.923 ){
} else {
};
} else {
}
}
"
XSUBPPDEPS = @tmdeps
XSUBPPARGS = @tmargs
";
}
=item xsubpp_version (override)
Test xsubpp exit status according to VMS rules ($sts & 1 ==E<gt> good)
rather than Unix rules ($sts == 0 ==E<gt> good).
=cut
sub xsubpp_version
{
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
my $command = "$self->{PERL} \"-I$self->{PERL_LIB}\" $xsubpp -v";
print "Running: $command\n" if $Verbose;
if ($?) {
use vmsish 'status';
warn "Running '$command' exits with status $?";
}
chop $version ;
# nope, then try something else
my $counter = '000';
my ($file) = 'temp' ;
local(*F);
open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
print F <<EOM ;
int
fred(a)
int a;
close F ;
$command = "$self->{PERL} $xsubpp $file";
print "Running: $command\n" if $Verbose;
if ($?) {
use vmsish 'status';
warn "Running '$command' exits with status $?";
}
unlink $file ;
# gets 1.2 -> 1.92 and 2.000a1
# it is either 1.0 or 1.1
# none of the above, so 1.0
return "1.0" ;
}
=item tools_other (override)
Adds a few MM[SK] macros, and shortens some the installatin commands,
in order to stay under DCL's 255-character limit. Also changes
EQUALIZE_TIMESTAMP to set revision date of target file to one second
later than source file, since MMK interprets precisely equal revision
dates for a source and target file as a sign that the target needs
to be updated.
=cut
sub tools_other {
my($self) = @_;
qq!
# Assumes \$(MMS) invokes MMS or MMK
# (It is assumed in some cases later that the default makefile name
# (Descrip.MMS for MM[SK]) is used.)
USEMAKEFILE = /Descrip=
MACROEND = )
EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])"
qq!WARN_IF_OLD_PACKLIST = \$(PERL) -e "if (-f \$ARGV[0]){print qq[WARNING: Old package found (\$ARGV[0]); please check for collisions\\n]}"
DOC_INSTALL = \$(PERL) -e "\@ARGV=split(/\\|/,<STDIN>);print '=head2 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];while(\$key=shift && \$val=shift){print qq[=item *\\n\\nC<\$key: \$val>\\n\\n];}print qq[=back\\n\\n]"
!);
}
=item dist (override)
Provide VMSish defaults for some values, then hand off to
default MM_Unix method.
=cut
sub dist {
# Sanitize these for use in $(DISTVNAME) filespec
}
=item c_o (override)
Use VMS syntax on command line. In particular, $(DEFINE) and
$(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros.
=cut
sub c_o {
my($self) = @_;
'
.c$(OBJ_EXT) :
';
}
=item xs_c (override)
Use MM[SK] macros.
=cut
sub xs_c {
my($self) = @_;
'
.xs.c :
';
}
=item xs_o (override)
Use MM[SK] macros, and VMS command line for C compiler.
=cut
sub xs_o { # many makes are too dumb to use xs_c then c_o
my($self) = @_;
'
';
}
=item top_targets (override)
Use VMS quoting on command line for Version_check.
=cut
sub top_targets {
my($self) = shift;
my(@m);
push @m, '
config :: $(INST_ARCHAUTODIR).exists
config :: $(INST_AUTODIR).exists
';
push @m, q[
config :: $(INST_MAN1DIR).exists
];
}
push @m, q[
config :: $(INST_MAN3DIR).exists
];
}
push @m, '
' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
push @m, q{
help :
};
push @m, q{
"-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')"
};
join('',@m);
}
=item dlsyms (override)
Create VMS linker options files specifying universal symbols for this
extension's shareable image, and listing other shareable images or
libraries to which it should be linked.
=cut
sub dlsyms {
my(@m);
push(@m,'
');
}
push(@m,'
push @m,'
push @m, ' $(PERL) -e "print ""$(INST_STATIC)/Include=';
push @m, ($Config{d_vms_case_sensitive_symbols}
}
else { # We don't have a "main" object file, so pull 'em all in
# Upcase module names if linker is being case-sensitive
my(@omods) = map { s/\.[^.]*$//; # Trim off file type
s[\$\(\w+_EXT\)][]; # even as a macro
s/.*[:>\/\]]//; # Trim off dir spec
$upcase ? uc($_) : $_;
$tmp .= ",$elt";
}
}
push @m, '\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)',"\n";
if (length $self->{LDLOADLIBS}) {
$lib =~ s%\$%\\\$%g; # Escape '$' in VMS filespecs
push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n";
}
}
push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n" if $line;
}
join('',@m);
}
=item dynamic_lib (override)
Use VMS Link command.
=cut
sub dynamic_lib {
my(@m);
push @m,"
";
push @m, '
$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,$(PERL_INC)perlshr_attr.opt/Option
';
join('',@m);
}
=item dynamic_bs (override)
Use VMS-style quoting on Mkbootstrap command line.
=cut
sub dynamic_bs {
return '
' unless $self->has_link_code();
'
BOOTSTRAP = '."$self->{BASEEXT}.bs".'
# As MakeMaker 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.
-e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
';
}
=item static_lib (override)
Use VMS commands to manipulate object library.
=cut
sub static_lib {
my($self) = @_;
return '
$(INST_STATIC) :
' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
my(@m,$lib);
push @m,'
# Rely on suffix rule for update action
$(OBJECT) : $(INST_ARCHAUTODIR).exists
';
# If this extension has it's own library (eg SDBM_File)
# then copy that to $(INST_STATIC) and add $(OBJECT) into it.
# if there was a library to copy, then we can't use MMS$SOURCE_LIST,
# 'cause it's a library and you can't stick them in other libraries.
# In that case, we use $OBJECT instead and hope for the best
} else {
}
push @m, "\t\$(NOECHO) \$(PERL) -e 1 >\$(INST_ARCHAUTODIR)extralibs.ld\n";
}
join('',@m);
}
=item manifypods (override)
Use VMS-style quoting on command line, and VMS logical name
to specify fallback location at build time if we can't find pod2man.
=cut
sub manifypods {
return "\nmanifypods :\n\t\$(NOECHO) \$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
my($dist);
my($pod2man_exe);
} else {
}
# No pod2man but some MAN3PODS to be installed
print <<END;
END
$pod2man_exe = "pod2man";
}
my(@m);
push @m,
qq[POD2MAN_EXE = $pod2man_exe\n],
-e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
];
push @m, "\nmanifypods : \$(MAN1PODS) \$(MAN3PODS)\n";
my($pod);
push @m, "$pod $self->{MAN1PODS}{$pod}\n";
}
push @m, "$pod $self->{MAN3PODS}{$pod}\n";
}
}
join('', @m);
}
=item processPL (override)
Use VMS-style quoting on command line.
=cut
sub processPL {
my($self) = @_;
my(@m, $plfile);
push @m, "
",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $vmsplfile $vmsfile
";
}
}
join "", @m;
}
=item installbin (override)
Stay under DCL's 255 character command line limit once again by
splitting potentially long list of files across multiple lines
in C<realclean> target.
=cut
sub installbin {
my($self) = @_;
local($_) = $path; # backward compatibility
}
push @m, "
realclean ::
";
push @m, "\t\$(RM_F) $line\n";
}
else { $line .= " $to"; }
}
push @m, "\t\$(RM_F) $line\n\n" if $line;
last unless defined $from;
my $todir;
if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
push @m, "
", $self->dir_target($todir);
}
join "", @m;
}
=item subdir_x (override)
Use VMS commands to change default directory.
=cut
sub subdir_x {
my(@m,$key);
push @m, '
subdirs ::
';
join('',@m);
}
=item clean (override)
Split potentially long list of files across multiple commands (in
order to stay under the magic command line limit). Also use MM[SK]
commands for handling subdirectories.
=cut
sub clean {
my(@m,$dir);
push @m, '
# Delete temporary files but do not touch installed files. We don\'t delete
# the Descrip.MMS here so that a later make realclean still has it to use.
clean ::
';
'$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS)$(MMSQUALIFIERS) clean`;"',"\n");
}
push @m, ' $(RM_F) *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso .MM_Tmp
';
# Unlink realclean, $attribs{FILES} is a string here; it may contain
# a list or a macro that expands to a list.
}
else { push(@otherfiles, $word); }
}
}
# Occasionally files are repeated several times from different sources
foreach $file (@otherfiles) {
push @m, "\t\$(RM_RF) $line\n";
$line = "$file";
}
else { $line .= " $file"; }
}
push @m, "\t\$(RM_RF) $line\n" if $line;
join('', @m);
}
=item realclean (override)
Guess what we're working around? Also, use MM[SK] for subdirectories.
=cut
sub realclean {
my(@m);
push(@m,'
# Delete temporary files (via clean) and also delete installed files
');
push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
'$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS)$(MMSQUALIFIERS) realclean`;"',"\n");
}
push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
';
# We can't expand several of the MMS macros here, since they don't have
# corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
# combination of macros). In order to stay below DCL's 255 char limit,
# we put only 2 on a line.
if ($self->has_link_code) {
}
# Occasionally files are repeated several times from different sources
push @m, "\t\$(RM_F) $line\n";
$line = "$file";
$fcnt = 0;
}
else { $line .= " $file"; }
}
push @m, "\t\$(RM_F) $line\n" if $line;
}
}
$line = '';
# Occasionally files are repeated several times from different sources
push @m, "\t\$(RM_RF) $line\n";
$line = "$file";
}
else { $line .= " $file"; }
}
push @m, "\t\$(RM_RF) $line\n" if $line;
}
join('', @m);
}
=item dist_basics (override)
Use VMS-style quoting on command line.
=cut
sub dist_basics {
my($self) = @_;
'
manifest :
$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
';
}
=item dist_core (override)
Syntax for invoking F<VMS_Share> differs from that for Unix F<shar>,
so C<shdist> target actions are VMS-specific.
=cut
sub dist_core {
my($self) = @_;
q[
dist : $(DIST_DEFAULT)
$(NOECHO) $(PERL) -le "print 'Warning: $m older than $vf' if -e ($vf = '$(VERSION_FROM)') && -M $vf < -M ($m = '$(MAKEFILE)')"
$(PREOP)
$(POSTOP)
$(PREOP)
$(TO_UNIX)
$(POSTOP)
$(PREOP)
$(POSTOP)
];
}
=item dist_dir (override)
Use VMS-style quoting on command line.
=cut
sub dist_dir {
my($self) = @_;
q{
distdir :
-e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
};
}
=item dist_test (override)
Use VMS commands to change default directory, and use VMS-style
quoting on command line.
=cut
sub dist_test {
my($self) = @_;
q{
$(MMS)$(MMSQUALIFIERS)
};
}
# --- Test and Installation Sections ---
=item install (override)
Work around DCL's 255 character limit several times,and use
VMS-style command line quoting in a few cases.
=cut
sub install {
my(@m,@docfiles);
$line .= "$file ";
if (length($line) > 128) {
$line = '';
}
}
}
push @m, q[
# This hack brought to you by DCL's 255-character command line limit
$(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
$(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
$(MOD_INSTALL) <.MM_tmp
$(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[
# Likewise
$(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
$(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
$(MOD_INSTALL) <.MM_tmp
$(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
# Ditto
$(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES)|'" >>.MM_tmp
],@docfiles,
$(NOECHO) $(PERL) -e "print q[print '=head2 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
$(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
# And again
$(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES)|'" >>.MM_tmp
],@docfiles,
$(NOECHO) $(PERL) -e "print q[print '=head2 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
$(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
];
push @m, q[
];
join('',@m);
}
=item perldepend (override)
Use VMS-style syntax for files; it's cheaper to just do it directly here
than to have the MM_Unix method call C<catfile> repeatedly. Also, if
we have to rebuild Config.pm, use MM[SK] to do it.
=cut
sub perldepend {
my($self) = @_;
my(@m);
push @m, '
' if $self->{OBJECT};
my(@macros);
my($mmsquals) = '$(USEMAKEFILE)[.vms]$(MAKEFILE)';
push(@m,q[
# Check for unpropagated 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!
$(NOOP)
$(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.h or genconfig.pl"
push(@m," $target");
}
else { push(@m,' $(MMS$TARGET)'); }
push(@m,q[
]);
}
join('',@m);
}
=item makefile (override)
Use VMS commands and quoting.
=cut
sub makefile {
my($self) = @_;
my(@m,@cmd);
# 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, q[
$(OBJECT) : $(FIRST_MAKEFILE)
push @m,q[
# We take a very conservative approach here, but it\'s worth it.
# We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
];
join('',@m);
}
=item test (override)
Use VMS commands for handling subdirectories.
=cut
sub test {
my(@m);
push @m,"
TEST_VERBOSE = 0
TESTDB_SW = -d
";
'; print `$(MMS)$(MMSQUALIFIERS) $(PASTHRU2) test`'."\n");
}
push(@m, "\t\$(NOECHO) \$(SAY) \"No tests defined for \$(NAME) extension.\"\n")
push(@m, "\n");
push(@m, "test_dynamic :: pure_all\n");
push(@m, "\n");
push(@m, "testdb_dynamic :: pure_all\n");
push(@m, "\n");
# Occasionally we may face this degenerate target:
push @m, "test_ : test_dynamic\n\n";
if ($self->needs_linking()) {
push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
push(@m, "\n");
push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
push(@m, "\n");
}
else {
push @m, "test_static :: test_dynamic\n\t\$(NOECHO) \$(NOOP)\n\n";
push @m, "testdb_static :: testdb_dynamic\n\t\$(NOECHO) \$(NOOP)\n";
}
join('',@m);
}
=item test_via_harness (override)
Use VMS-style quoting on command line.
=cut
sub test_via_harness {
" $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
'-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
}
=item test_via_script (override)
Use VMS-style quoting on command line.
=cut
sub test_via_script {
';
}
=item makeaperl (override)
Undertake to build a new set of Perl images using VMS commands. Since
VMS does dynamic loading, it's not necessary to statically link each
extension into the Perl image, so this isn't the normal build path.
Consequently, it hasn't really been tested, and may well be incomplete.
=cut
sub makeaperl {
my(@m);
push @m, "
# --- MakeMaker makeaperl section ---
MAP_TARGET = $target
";
push @m, q{
$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
push @m, map(q[ \\\n\t\t"$_"], @ARGV),q{
$(MAP_TARGET) :: $(MAKE_APERL_FILE)
};
push @m, "\n";
return join '', @m;
}
local($_);
# The front matter of the linkcommand...
$linkcmd =~ s/\s+/ /g;
# Which *.olb files could we make use of...
local(%olbs);
return if m/^libperl/;
if( exists $self->{INCLUDE_EXT} ){
my $found = 0;
my $incl;
my $xx;
$xx =~ s,/?$_,,;
$xx =~ s,/,::,g;
# Throw away anything not explicitly marked for inclusion.
# DynaLoader is implied.
$found++;
last;
}
}
return unless $found;
}
elsif( exists $self->{EXCLUDE_EXT} ){
my $excl;
my $xx;
$xx =~ s,/?$_,,;
$xx =~ s,/,::,g;
# Throw away anything explicitly marked for exclusion
}
}
}, grep( -d $_, @{$searchdirs || []}));
# We trust that what has been handed in as argument will be buildable
# Sort the object libraries in inverse order of
# filespec length to try to insure that dependent extensions
# will appear before their parents, so the linker will
# search the parent library to resolve references.
# (e.g. Intuit::DWIM will precede Intuit, so unresolved
# references from [.intuit.dwim]dwim.obj can be found
# in [.intuit]intuit.olb).
for (sort { length($a) <=> length($b) } keys %olbs) {
push @optlibs, "$dir$olbs{$_}";
# Get external libraries this extension will need
if (-f $extralibs ) {
my %seenthis;
while (<LIST>) {
chomp;
# Include a library in the link only once, unless it's mentioned
# multiple times within a single extension's options file, in which
# case we assume the builder needed to search it again later in the
# link.
next if $skip;
push @$extra,$_;
}
close LIST;
}
# Get full name of extension for ExtUtils::Miniperl
if (-f $extopt) {
while (<OPT>) {
my $pkg = $1;
$pkg =~ s#__*#::#g;
push @staticpkgs,$pkg;
}
}
}
# Place all of the external libraries after all of the Perl extension
# libraries in the final link, in order to maximize the opportunity
# for XS code from multiple extensions to resolve symbols against the
# same external library while only including that library once.
else { $extralist = ''; }
# Let ExtUtils::Liblist find the necessary libs for us (but skip PerlShr)
# that's what we're building here).
if ($libperl) {
print STDOUT "Warning: $libperl not found\n";
undef $libperl;
}
}
unless ($libperl) {
} elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
} else {
print STDOUT "Warning: $libperl not found
}
}
push @m, '
# Fill in the target you want to produce if it\'s not perl
MAP_TARGET = ',$self->fixpath($target,0),'
MAP_SHRTARGET = ',$self->fixpath($shrtarget,0),"
MAP_LIBPERL = ",$self->fixpath($libperl,0),'
';
push @m,"\n${tmp}Makeaperl.Opt : \$(MAP_EXTRA)\n";
foreach (@optlibs) {
push @m,' $(NOECHO) $(PERL) -e "print q{',$_,'}" >>$(MMS$TARGET)',"\n";
}
push @m,"\n${tmp}PerlShr.Opt :\n\t";
push @m,'$(NOECHO) $(PERL) -e "print q{$(MAP_SHRTARGET)}" >$(MMS$TARGET)',"\n";
push @m,'
$(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_LIBPERL), Makeaperl.Opt/Option ',"${libperldir}Perlshr_Attr.Opt/Option",'
$(NOECHO) $(SAY) " $(MMS)$(MMSQUALIFIERS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
';
push @m,"\n${tmp}perlmain.c : \$(MAKEFILE)\n\t\$(NOECHO) \$(PERL) -e 1 >${tmp}Writemain.tmp\n";
push @m, "# More from the 255-char line length limit\n";
foreach (@staticpkgs) {
push @m,' $(NOECHO) $(PERL) -e "print q{',$_,qq[}" >>${tmp}Writemain.tmp\n];
}
push @m,'
$(NOECHO) $(PERL) $(MAP_PERLINC) -ane "use ExtUtils::Miniperl; writemain(@F)" ',$tmp,'Writemain.tmp >$(MMS$TARGET)
push @m, q[
# Still more from the 255-char line length limit
$(NOECHO) $(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp
];
push @m, "
pure_inst_perl : \$(MAP_TARGET)
";
join '', @m;
}
# --- Output postprocessing section ---
=item nicetext (override)
Insure that colons marking targets are preceded by space, in order
to distinguish the target delimiter from a colon appearing as
part of a filespec.
=cut
sub nicetext {
$text;
}
1;
=back
=cut