2 # MakeMaker default methods for VMS
3 # This package is inserted into @ISA of MakeMaker's MM before the
4 # built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under VMS.
6 # Author: Charles Bailey bailey@genetics.upenn.edu
8 package ExtUtils::MM_VMS;
9 $ExtUtils::MM_VMS::Revision=$ExtUtils::MM_VMS::Revision = '5.26 (17-Mar-1996)';
10 unshift @MM::ISA, 'ExtUtils::MM_VMS';
17 Exporter::import('ExtUtils::MakeMaker', '$Verbose', '&neatvalue');
21 ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
25 use ExtUtils::MM_VMS; # Done internally by ExtUtils::MakeMaker if needed
29 See ExtUtils::MM_Unix for a documentation of the methods provided
30 there. This package overrides the implementation of these methods, not
33 =head2 Methods always loaded
35 =item eliminate_macros
37 Expands MM[KS]/Make macros in a text string, using the contents of
38 identically named elements of C<%$self>, and returns the result
39 as a file specification in Unix syntax.
43 sub eliminate_macros {
46 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
47 $self = $ExtUtils::MakeMaker::Parent[-1];
50 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
53 my($npath) = unixify($path);
54 my($head,$macro,$tail);
56 # perform m##g in scalar context so it acts as an iterator
57 while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) {
59 ($head,$macro,$tail) = ($1,$2,$3);
60 ($macro = unixify($self->{$macro})) =~ s#/$##;
61 $npath = "$head$macro$tail";
64 print "eliminate_macros($path) = |$npath|\n" if $Verbose >= 3;
70 Catchall routine to clean up problem MM[SK]/Make macros. Expands macros
71 in any directory specification, in order to avoid juxtaposing two
72 VMS-syntax directories when MM[SK] is run. Also expands expressions which
73 are all macro, so that we can tell how long the expansion is, and avoid
74 overrunning DCL's command buffer when MM[KS] is running.
76 If optional second argument has a TRUE value, then the return string is
77 a VMS-syntax directory specification, otherwise it is a VMS-syntax file
83 my($self,$path,$force_path) = @_;
85 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
86 $self = $ExtUtils::MakeMaker::Parent[-1];
89 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
92 my($fixedpath,$prefix,$name);
94 if ($path =~ m#^\$\(.+\)$# || $path =~ m#[/:>\]]#) {
95 if ($force_path or $path =~ /(?:DIR\)|\])$/) {
96 $fixedpath = vmspath($self->eliminate_macros($path));
99 $fixedpath = vmsify($self->eliminate_macros($path));
102 elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#)) && $self->{$prefix}) {
103 my($vmspre) = vmspath($self->{$prefix}) || ''; # is it a dir or just a name?
104 $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name;
105 $fixedpath = vmspath($fixedpath) if $force_path;
109 $fixedpath = vmspath($fixedpath) if $force_path;
111 # Convert names without directory or type to paths
112 if (!$force_path and $fixedpath !~ /[:>(.\]]/) { $fixedpath = vmspath($fixedpath); }
113 print "fixpath($path) = |$fixedpath|\n" if $Verbose >= 3;
119 Concatenates a list of file specifications, and returns the result as a
120 VMS-syntax directory specification.
125 my($self,@dirs) = @_;
127 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
128 $self = $ExtUtils::MakeMaker::Parent[-1];
130 my($dir) = pop @dirs;
131 @dirs = grep($_,@dirs);
134 my($path) = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
135 my($spath,$sdir) = ($path,$dir);
136 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
137 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
138 $rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
140 else { $rslt = vmspath($dir); }
141 print "catdir(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
147 Concatenates a list of file specifications, and returns the result as a
148 VMS-syntax directory specification.
153 my($self,@files) = @_;
155 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
156 $self = $ExtUtils::MakeMaker::Parent[-1];
158 my($file) = pop @files;
159 @files = grep($_,@files);
162 my($path) = (@files == 1 ? $files[0] : $self->catdir(@files));
165 if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
167 $rslt = $self->eliminate_macros($spath);
168 $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
171 else { $rslt = vmsify($file); }
172 print "catfile(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
176 package ExtUtils::MM_VMS;
178 sub ExtUtils::MM_VMS::guess_name;
179 sub ExtUtils::MM_VMS::find_perl;
180 sub ExtUtils::MM_VMS::path;
181 sub ExtUtils::MM_VMS::maybe_command;
182 sub ExtUtils::MM_VMS::maybe_command_in_dirs;
183 sub ExtUtils::MM_VMS::perl_script;
184 sub ExtUtils::MM_VMS::file_name_is_absolute;
185 sub ExtUtils::MM_VMS::replace_manpage_separator;
186 sub ExtUtils::MM_VMS::init_others;
187 sub ExtUtils::MM_VMS::constants;
188 sub ExtUtils::MM_VMS::const_loadlibs;
189 sub ExtUtils::MM_VMS::cflags;
190 sub ExtUtils::MM_VMS::const_cccmd;
191 sub ExtUtils::MM_VMS::pm_to_blib;
192 sub ExtUtils::MM_VMS::tool_autosplit;
193 sub ExtUtils::MM_VMS::tool_xsubpp;
194 sub ExtUtils::MM_VMS::xsubpp_version;
195 sub ExtUtils::MM_VMS::tools_other;
196 sub ExtUtils::MM_VMS::dist;
197 sub ExtUtils::MM_VMS::c_o;
198 sub ExtUtils::MM_VMS::xs_c;
199 sub ExtUtils::MM_VMS::xs_o;
200 sub ExtUtils::MM_VMS::top_targets;
201 sub ExtUtils::MM_VMS::dlsyms;
202 sub ExtUtils::MM_VMS::dynamic_lib;
203 sub ExtUtils::MM_VMS::dynamic_bs;
204 sub ExtUtils::MM_VMS::static_lib;
205 sub ExtUtils::MM_VMS::manifypods;
206 sub ExtUtils::MM_VMS::processPL;
207 sub ExtUtils::MM_VMS::installbin;
208 sub ExtUtils::MM_VMS::subdir_x;
209 sub ExtUtils::MM_VMS::clean;
210 sub ExtUtils::MM_VMS::realclean;
211 sub ExtUtils::MM_VMS::dist_basics;
212 sub ExtUtils::MM_VMS::dist_core;
213 sub ExtUtils::MM_VMS::dist_dir;
214 sub ExtUtils::MM_VMS::dist_test;
215 sub ExtUtils::MM_VMS::install;
216 sub ExtUtils::MM_VMS::perldepend;
217 sub ExtUtils::MM_VMS::makefile;
218 sub ExtUtils::MM_VMS::test;
219 sub ExtUtils::MM_VMS::test_via_harness;
220 sub ExtUtils::MM_VMS::test_via_script;
221 sub ExtUtils::MM_VMS::makeaperl;
222 sub ExtUtils::MM_VMS::ext;
223 sub ExtUtils::MM_VMS::nicetext;
228 if (defined fileno(DATA)) {
240 warn "AUTOLOAD called unexpectedly for $AUTOLOAD";
242 defined(&$AUTOLOAD) or die "Myloader inconsistency error";
250 =head2 SelfLoaded methods
252 Those methods which override default MM_Unix methods are marked
253 "(override)", while methods unique to MM_VMS are marked "(specific)".
254 For overridden methods, documentation is limited to an explanation
255 of why this method overrides the MM_Unix method; see the ExtUtils::MM_Unix
256 documentation for more details.
258 =item guess_name (override)
260 Try to determine name of extension being built. We begin with the name
261 of the current directory. Since VMS filenames are case-insensitive,
262 however, we look for a F<.pm> file whose name matches that of the current
263 directory (presumably the 'main' F<.pm> file for this extension), and try
264 to find a C<package> statement from which to obtain the Mixed::Case
272 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
273 $self = $ExtUtils::MakeMaker::Parent[-1];
278 $defname = $ENV{'DEFAULT'};
279 $defname =~ s:.*?([^.\]]+)\]:$1:
280 unless ($defname =~ s:.*[.\[]ext\.(.*)\]:$1:i);
281 $defname =~ s#[.\]]#::#g;
282 ($defpm = $defname) =~ s/.*:://;
283 if (open(PM,"${defpm}.pm")){
285 if (/^\s*package\s+([^;]+)/i) {
290 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
291 "defaulting package name to $defname\n"
296 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
297 "defaulting package name to $defname\n";
299 $defname =~ s#[\-_][\d.\-]+$##;
303 =item find_perl (override)
305 Use VMS file specification syntax and CLI commands to find and
311 my($self, $ver, $names, $dirs, $trace) = @_;
313 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
314 $self = $ExtUtils::MakeMaker::Parent[-1];
316 my($name,$dir,$vmsfile,@sdirs,@snames,@cand);
317 # Check in relative directories first, so we pick up the current
318 # version of Perl if we're running MakeMaker as part of the main build.
319 @sdirs = sort { my($absb) = file_name_is_absolute($a);
320 my($absb) = file_name_is_absolute($b);
321 if ($absa && $absb) { return $a cmp $b }
322 else { return $absa ? 1 : ($absb ? -1 : ($a cmp $b)); }
324 # Check miniperl before perl, and check names likely to contain
325 # version numbers before "generic" names, so we pick up an
326 # executable that's less likely to be from an old installation.
327 @snames = sort { my($ba) = $a =~ m!([^:>\]/]+)$!; # basename
328 my($bb) = $b =~ m!([^:>\]/]+)$!;
329 substr($ba,0,1) cmp substr($bb,0,1)
330 or -1*(length($ba) <=> length($bb)) } @$names;
332 print "Looking for perl $ver by these names:\n";
333 print "\t@snames,\n";
334 print "in these dirs:\n";
337 foreach $dir (@sdirs){
338 next unless defined $dir; # $self->{PERL_SRC} may be undefined
339 foreach $name (@snames){
340 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
341 else { push(@cand,$self->fixpath($name)); }
344 foreach $name (@cand) {
345 print "Checking $name\n" if ($trace >= 2);
346 next unless $vmsfile = $self->maybe_command($name);
347 print "Executing $vmsfile\n" if ($trace >= 2);
348 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
349 print "Using PERL=MCR $vmsfile\n" if $trace;
350 return "MCR $vmsfile"
353 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
354 0; # false and not empty
357 =item path (override)
359 Translate logical name DCL$PATH as a searchlist, rather than trying
360 to C<split> string value of C<$ENV{'PATH'}>.
366 while ($dir = $ENV{'DCL$PATH;' . $i++}) { push(@dirs,$dir); }
370 =item maybe_command (override)
372 Follows VMS naming conventions for executable files.
373 If the name passed in doesn't exactly match an executable file,
374 appends F<.Exe> to check for executable image, and F<.Com> to check
375 for DCL procedure. If this fails, checks F<Sys$Share:> for an
376 executable file having the name specified. Finally, appends F<.Exe>
382 my($self,$file) = @_;
383 return $file if -x $file && ! -d _;
384 return "$file.exe" if -x "$file.exe";
385 return "$file.com" if -x "$file.com";
386 if ($file !~ m![/:>\]]!) {
387 my($shrfile) = 'Sys$Share:' . $file;
388 return $file if -x $shrfile && ! -d _;
389 return "$file.exe" if -x "$shrfile.exe";
394 =item maybe_command_in_dirs (override)
396 Uses DCL argument quoting on test command line.
400 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
401 my($self, $names, $dirs, $trace, $ver) = @_;
403 foreach $dir (@$dirs){
404 next unless defined $dir; # $self->{PERL_SRC} may be undefined
405 foreach $name (@$names){
407 if ($self->file_name_is_absolute($name)) {
410 $abs = $self->catfile($dir, $name);
412 print "Checking $abs for $name\n" if ($trace >= 2);
413 next unless $tryabs = $self->maybe_command($abs);
414 print "Substituting $tryabs instead of $abs\n"
415 if ($trace >= 2 and $tryabs ne $abs);
418 print "Executing $abs\n" if ($trace >= 2);
419 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
420 print "Using PERL=$abs\n" if $trace;
423 } else { # Do not look for perl
430 =item perl_script (override)
432 If name passed in doesn't specify a readable file, appends F<.pl> and
433 tries again, since it's customary to have file types on all files
439 my($self,$file) = @_;
440 return $file if -r $file && ! -d _;
441 return "$file.pl" if -r "$file.pl" && ! -d _;
445 =item file_name_is_absolute (override)
447 Checks for VMS directory spec as well as Unix separators.
451 sub file_name_is_absolute {
453 $file =~ m!^/! or $file =~ m![:<\[][^.\-]!;
456 =item replace_manpage_separator
458 Use as separator a character which is legal in a VMS-syntax file name.
462 sub replace_manpage_separator {
464 $man = unixify($man);
469 =item init_others (override)
471 Provide VMS-specific forms of various utility commands, then hand
472 off to the default MM_Unix method.
479 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
480 $self = $ExtUtils::MakeMaker::Parent[-1];
483 $self->{NOOP} = "\t@ Continue";
484 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
485 $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
486 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
487 $self->{NOECHO} ||= '@ ';
488 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
489 $self->{RM_RF} = '$(PERL) "-I$(PERL_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
490 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
491 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
492 $self->{CP} = 'Copy/NoConfirm';
493 $self->{MV} = 'Rename/NoConfirm';
494 $self->{UMASK_NULL} = "\t!";
495 &ExtUtils::MM_Unix::init_others;
498 =item constants (override)
500 Fixes up numerous file and directory macros to insure VMS syntax
501 regardless of input syntax. Also adds a few VMS-specific macros
502 and makes lists of files comma-separated.
509 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
510 $self = $ExtUtils::MakeMaker::Parent[-1];
514 if ($self->{DEFINE} ne '') {
515 my(@defs) = split(/\s+/,$self->{DEFINE});
516 foreach $def (@defs) {
519 $def = "\"$def\"" if $def =~ /=/;
521 $self->{DEFINE} = join ',',@defs;
524 if ($self->{OBJECT} =~ /\s/) {
525 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
526 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
528 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
530 if ($self->{'INC'} && $self->{INC} !~ m!/Include=!i) {
531 my(@val) = ( '/Include=(' );
532 my(@includes) = split(/\s+/,$self->{INC});
534 foreach (@includes) {
536 push @val,', ' if $plural++;
537 push @val,$self->fixpath($_,1);
539 $self->{INC} = join('',@val,')');
542 # Fix up directory specs
543 $self->{ROOTEXT} = $self->{ROOTEXT} ? $self->fixpath($self->{ROOTEXT},1)
545 foreach $macro ( qw [
546 INST_LIB INST_ARCHLIB INST_EXE INSTALLPRIVLIB INSTALLARCHLIB
547 INSTALLBIN PERL_LIB PERL_ARCHLIB PERL_INC PERL_SRC FULLEXT
548 INST_MAN1DIR INSTALLMAN1DIR INST_MAN3DIR INSTALLMAN3DIR
549 INSTALLSITELIB INSTALLSITEARCH SITELIBEXP SITEARCHEXP ] ) {
550 next unless defined $self->{$macro};
551 $self->{$macro} = $self->fixpath($self->{$macro},1);
553 $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC},q(VMS))
554 if ($self->{PERL_SRC});
559 foreach $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKE_APERL_FILE MYEXTLIB] ) {
560 next unless defined $self->{$macro};
561 $self->{$macro} = $self->fixpath($self->{$macro});
565 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION
566 INST_LIB INST_ARCHLIB INST_EXE PREFIX INSTALLDIRS INSTALLPRIVLIB
567 INSTALLARCHLIB INSTALLSITELIB INSTALLSITEARCH INSTALLBIN PERL_LIB
568 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
569 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_VMS
570 PERL_INC PERL FULLPERL
572 next unless defined $self->{$tmp};
573 push @m, "$tmp = $self->{$tmp}\n";
578 VERSION_MACRO = VERSION
579 DEFINE_VERSION = "$(VERSION_MACRO)=""$(VERSION)"""
580 XS_VERSION_MACRO = XS_VERSION
581 XS_DEFINE_VERSION = "$(XS_VERSION_MACRO)=""$(XS_VERSION)"""
583 MAKEMAKER = ],$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),qq[
584 MM_VERSION = $ExtUtils::MakeMaker::VERSION
585 MM_REVISION = $ExtUtils::MakeMaker::Revision
586 MM_VMS_REVISION = $ExtUtils::MM_VMS::Revision
588 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
589 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
590 # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)
591 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
595 FULLEXT BASEEXT ROOTEXT DLBASE VERSION_FROM INC DEFINE OBJECT
598 next unless defined $self->{$tmp};
599 push @m, "$tmp = $self->{$tmp}\n";
604 # Handy lists of source code files:
605 XS_FILES = ',join(', ', sort keys %{$self->{XS}}),'
606 C_FILES = ',join(', ', @{$self->{C}}),'
607 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
608 H_FILES = ',join(', ', @{$self->{H}}),'
609 MAN1PODS = ',join(', ', sort keys %{$self->{MAN1PODS}}),'
610 MAN3PODS = ',join(', ', sort keys %{$self->{MAN3PODS}}),'
615 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
617 next unless defined $self->{$tmp};
618 push @m, "$tmp = $self->{$tmp}\n";
622 .SUFFIXES : .xs .c .cpp .cxx \$(OBJ_EXT)
624 # Here is the Config.pm that we are using/depend on
625 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
627 # Where to put things:
628 INST_LIBDIR = ",($self->{'INST_LIBDIR'} = $self->catdir($self->{INST_LIB},$self->{ROOTEXT})),"
629 INST_ARCHLIBDIR = ",($self->{'INST_ARCHLIBDIR'} = $self->catdir($self->{INST_ARCHLIB},$self->{ROOTEXT})),"
631 INST_AUTODIR = ",($self->{'INST_AUTODIR'} = $self->catdir($self->{INST_LIB},'auto',$self->{FULLEXT})),'
632 INST_ARCHAUTODIR = ',($self->{'INST_ARCHAUTODIR'} = $self->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT})),'
635 if ($self->has_link_code()) {
637 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
638 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
639 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
646 EXPORT_LIST = $(BASEEXT).opt
647 PERL_ARCHIVE = ',($ENV{'PERLSHR'} ? $ENV{'PERLSHR'} : 'Sys$Share:PerlShr.Exe'),'
651 $self->{TO_INST_PM} = [ map($self->fixpath($_),sort keys %{$self->{PM}}) ];
652 $self->{PM_TO_BLIB} = [ map($self->fixpath($_),%{$self->{PM}}) ];
654 TO_INST_PM = ',join(', ',@{$self->{TO_INST_PM}}),'
656 PM_TO_BLIB = ',join(', ',@{$self->{PM_TO_BLIB}}),'
662 =item const_loadlibs (override)
664 Basically a stub which passes through library specfications provided
665 by the caller. Will be updated or removed when VMS support is added
666 to ExtUtils::Liblist.
673 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
674 $self = $ExtUtils::MakeMaker::Parent[-1];
678 # $self->{NAME} might depend on some other libraries.
679 # (These comments may need revising:)
681 # Dependent libraries can be linked in one of three ways:
683 # 1. (For static extensions) by the ld command when the perl binary
684 # is linked with the extension library. See EXTRALIBS below.
686 # 2. (For dynamic extensions) by the ld command when the shared
687 # object is built/linked. See LDLOADLIBS below.
689 # 3. (For dynamic extensions) by the DynaLoader when the shared
690 # object is loaded. See BSLOADLIBS below.
692 # EXTRALIBS = List of libraries that need to be linked with when
693 # linking a perl binary which includes this extension
694 # Only those libraries that actually exist are included.
695 # These are written to a file and used when linking perl.
697 # LDLOADLIBS = List of those libraries which can or must be linked into
698 # the shared library when created using ld. These may be
699 # static or dynamic libraries.
700 # LD_RUN_PATH is a colon separated list of the directories
701 # in LDLOADLIBS. It is passed as an environment variable to
702 # the process that links the shared library.
704 # BSLOADLIBS = List of those libraries that are needed but can be
705 # linked in dynamically at run time on this platform.
706 # SunOS/Solaris does not need this because ld records
707 # the information (from LDLOADLIBS) into the object file.
708 # This list is used to create a .bs (bootstrap) file.
710 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
711 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
712 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
717 =item cflags (override)
719 Bypass shell script and produce qualifiers for CC directly (but warn
720 user if a shell script for this extension exists). Fold multiple
721 /Defines into one, and do the same with /Includes, since some C
722 compilers pay attention to only one instance of these qualifiers
728 my($self,$libperl) = @_;
730 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
731 $self = $ExtUtils::MakeMaker::Parent[-1];
733 my($quals) = $Config{'ccflags'};
735 my($optimize) = '/Optimize';
737 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
738 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
739 " required to modify CC command for $self->{'BASEEXT'}\n"
742 # Deal with $self->{DEFINE} here since some C compilers pay attention
743 # to only one /Define clause on command line, so we have to
744 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
745 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
746 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
747 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
750 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
751 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
754 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
755 if ($libperl =~ /libperl(\w+)\./i) {
757 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
758 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
759 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
760 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
763 # Likewise with $self->{INC} and /Include
764 my($incstr) = '/Include=($(PERL_INC)';
765 if ($self->{'INC'}) {
766 my(@includes) = split(/\s+/,$self->{INC});
767 foreach (@includes) {
769 $incstr .= ', '.$self->fixpath($_,1);
772 if ($quals =~ m:(.*)/include=\(?([^\(\/\)\s]+)\)?(.*):i) {
773 $quals = "$1$incstr,$2)$3";
775 else { $quals .= "$incstr)"; }
777 $optimize = '/Debug/NoOptimize'
778 if ($self->{OPTIMIZE} =~ /-g/ or $self->{OPTIMIZE} =~ m!/Debug!i);
780 return $self->{CFLAGS} = qq{
789 =item const_cccmd (override)
791 Adds directives to point C preprocessor to the right place when
792 handling #include <sys/foo.h> directives. Also constructs CC
793 command line a bit differently than MM_Unix method.
798 my($self,$libperl) = @_;
800 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
801 $self = $ExtUtils::MakeMaker::Parent[-1];
805 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
806 return '' unless $self->needs_linking();
807 if ($Config{'vms_cc_type'} eq 'gcc') {
810 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS GNU_CC_Include:[VMS]';
812 elsif ($Config{'vms_cc_type'} eq 'vaxc') {
815 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library
816 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include';
821 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ',
822 ($Config{'arch'} eq 'VMS_AXP' ? 'Sys$Library' : 'DECC$Library_Include'),'
823 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include';
826 push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n");
828 $self->{CONST_CCCMD} = join('',@m);
831 =item pm_to_blib (override)
833 DCL I<still> accepts a maximum of 255 characters on a command
834 line, so we write the (potentially) long list of file names
835 to a temp file, then persuade Perl to read it instead of the
836 command line to find args.
843 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
844 $self = $ExtUtils::MakeMaker::Parent[-1];
846 my($line,$from,$to,@m);
847 my($autodir) = $self->catdir('$(INST_LIB)','auto');
848 my(@files) = @{$self->{PM_TO_BLIB}};
851 # As always, keep under DCL's 255-char limit
852 pm_to_blib : $(TO_INST_PM)
853 },$self->{NOECHO},q{$(PERL) -e "print '},shift(@files),q{ },shift(@files),q{'" >.MM_tmp
856 $line = ''; # avoid uninitialized var warning
857 while ($from = shift(@files),$to = shift(@files)) {
858 $line .= " $from $to";
859 if (length($line) > 128) {
860 push(@m,"\t$self->{NOECHO}\$(PERL) -e \"print '$line'\" >>.MM_tmp\n");
865 push(@m,q[ $(PERL) "-I$(PERL_LIB)" "-MExtUtils::Install" -e "pm_to_blib({split(' ',<STDIN>)},'].$autodir.q[')" <.MM_tmp]);
867 $self->{NOECHO}Delete/NoLog/NoConfirm .MM_tmp;
868 $self->{NOECHO}\$(TOUCH) pm_to_blib.ts
874 =item tool_autosplit (override)
876 Use VMS-style quoting on command line.
881 my($self, %attribs) = @_;
883 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
884 $self = $ExtUtils::MakeMaker::Parent[-1];
887 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
889 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
890 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
894 =item tool_sxubpp (override)
896 Use VMS-style quoting on xsubpp command line.
903 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
904 $self = $ExtUtils::MakeMaker::Parent[-1];
906 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
907 # drop back to old location if xsubpp is not in new location yet
908 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
909 my(@tmdeps) = '$(XSUBPPDIR)typemap';
910 if( $self->{TYPEMAPS} ){
912 foreach $typemap (@{$self->{TYPEMAPS}}){
914 warn "Typemap $typemap not found.\n";
917 push(@tmdeps, $self->fixpath($typemap));
921 push(@tmdeps, "typemap") if -f "typemap";
922 my(@tmargs) = map("-typemap $_", @tmdeps);
923 if( exists $self->{XSOPT} ){
924 unshift( @tmargs, $self->{XSOPT} );
927 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
929 # What are the correct thresholds for version 1 && 2 Paul?
930 if ( $xsubpp_version > 1.923 ){
931 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
933 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
934 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
935 Your version of xsubpp is $xsubpp_version and cannot handle this.
936 Please upgrade to a more recent version of xsubpp.
939 $self->{XSPROTOARG} = "";
945 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
946 XSPROTOARG = $self->{XSPROTOARG}
952 =item xsubpp_version (override)
954 Test xsubpp exit status according to VMS rules ($sts & 1 ==> good)
955 rather than Unix rules ($sts == 0 ==> good).
961 my($self,$xsubpp) = @_;
964 # try to figure out the version number of the xsubpp on the system
966 # first try the -v flag, introduced in 1.921 & 2.000a2
968 my $command = "$self->{PERL} \"-I$self->{PERL_LIB}\" $xsubpp -v";
969 print "Running: $command\n" if $Verbose;
970 $version = `$command` ;
971 warn "Running '$command' exits with status " . $? unless ($? & 1);
974 return $1 if $version =~ /^xsubpp version (.*)/ ;
976 # nope, then try something else
979 my ($file) = 'temp' ;
980 $counter++ while -e "$file$counter"; # don't overwrite anything
984 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
986 MODULE = fred PACKAGE = fred
995 $command = "$self->{PERL} $xsubpp $file";
996 print "Running: $command\n" if $Verbose;
997 my $text = `$command` ;
998 warn "Running '$command' exits with status " . $? unless ($? & 1);
1001 # gets 1.2 -> 1.92 and 2.000a1
1002 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
1004 # it is either 1.0 or 1.1
1005 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
1007 # none of the above, so 1.0
1011 =item tools_other (override)
1013 Adds a few MM[SK] macros, and shortens some the installatin commands,
1014 in order to stay under DCL's 255-character limit. Also changes
1015 EQUALIZE_TIMESTAMP to set revision date of target file to one second
1016 later than source file, since MMK interprets precisely equal revision
1017 dates for a source and target file as a sign that the target needs
1025 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1026 $self = $ExtUtils::MakeMaker::Parent[-1];
1029 # Assumes \$(MMS) invokes MMS or MMK
1030 # (It is assumed in some cases later that the default makefile name
1031 # (Descrip.MMS for MM[SK]) is used.)
1032 USEMAKEFILE = /Descrip=
1033 USEMACROS = /Macro=(
1035 MAKEFILE = Descrip.MMS
1037 TOUCH = $self->{TOUCH}
1038 CHMOD = $self->{CHMOD}
1041 RM_F = $self->{RM_F}
1042 RM_RF = $self->{RM_RF}
1043 UMASK_NULL = $self->{UMASK_NULL}
1044 MKPATH = Create/Directory
1045 EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])"
1046 !. ($self->{PARENT} ? '' :
1047 q!WARN_IF_OLD_PACKLIST = \$(PERL) -e "if (-f \$ARGV[0]){print qq[WARNING: Old package found (\$ARGV[0]); please check for collisions\\n]}"
1048 MOD_INSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "install({split(' ',<STDIN>)},1);"
1049 DOC_INSTALL = \$(PERL) -e "@ARGV=split('|',<STDIN>);print '=head3 ',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]"
1050 UNINSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "uninstall(\$ARGV[0],1);"
1054 =item dist (override)
1056 Provide VMSish defaults for some values, then hand off to
1057 default MM_Unix method.
1062 my($self, %attribs) = @_;
1064 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1065 $self = $ExtUtils::MakeMaker::Parent[-1];
1067 $attribs{ZIPFLAGS} ||= '-Vu';
1068 $attribs{COMPRESS} ||= 'gzip';
1069 $attribs{SUFFIX} ||= '-gz';
1070 $attribs{SHAR} ||= 'vms_share';
1071 $attribs{DIST_DEFAULT} ||= 'zipdist';
1073 return ExtUtils::MM_Unix::dist($self,%attribs);
1076 =item c_o (override)
1078 Use VMS syntax on command line. In particular, $(DEFINE) and
1079 $(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros.
1086 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1087 $self = $ExtUtils::MakeMaker::Parent[-1];
1089 return '' unless $self->needs_linking();
1092 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1095 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cpp
1098 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cxx
1103 =item xs_c (override)
1112 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1113 $self = $ExtUtils::MakeMaker::Parent[-1];
1115 return '' unless $self->needs_linking();
1118 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
1122 =item xs_o (override)
1124 Use MM[SK] macros, and VMS command line for C compiler.
1128 sub xs_o { # many makes are too dumb to use xs_c then c_o
1131 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1132 $self = $ExtUtils::MakeMaker::Parent[-1];
1134 return '' unless $self->needs_linking();
1137 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
1138 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1142 =item top_targets (override)
1144 Use VMS quoting on command line for Version_check.
1151 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1152 $self = $ExtUtils::MakeMaker::Parent[-1];
1156 all :: pure_all manifypods
1159 pure_all :: config pm_to_blib subdirs linkext
1162 subdirs :: $(MYEXTLIB)
1165 config :: $(MAKEFILE) $(INST_LIBDIR).exists
1168 config :: $(INST_ARCHAUTODIR).exists
1171 config :: $(INST_AUTODIR).exists
1176 config :: Version_check
1179 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
1182 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
1183 if (%{$self->{MAN1PODS}}) {
1185 config :: $(INST_MAN1DIR).exists
1188 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
1190 if (%{$self->{MAN3PODS}}) {
1192 config :: $(INST_MAN3DIR).exists
1195 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
1199 $(O_FILES) : $(H_FILES)
1200 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
1204 perldoc ExtUtils::MakeMaker
1209 },$self->{NOECHO},q{$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1210 "-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')"
1216 =item dlsyms (override)
1218 Create VMS linker options files specifying universal symbols for this
1219 extension's shareable image, and listing other shareable images or
1220 libraries to which it should be linked.
1225 my($self,%attribs) = @_;
1227 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1228 $self = $ExtUtils::MakeMaker::Parent[-1];
1231 return '' unless $self->needs_linking();
1233 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
1234 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
1235 my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
1238 unless ($self->{SKIPHASH}{'dynamic'}) {
1240 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
1244 my($popt) = $self->catfile($srcdir,'perlshr.opt');
1245 my($lopt) = $self->catfile($srcdir,'crtl.opt');
1246 push(@m,"# Depend on $(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
1247 rtls.opt : $popt $lopt \$(BASEEXT).opt
1248 Copy/Log $popt Sys\$Disk:[]rtls.opt
1249 Append/Log $lopt Sys\$Disk:[]rtls.opt
1254 # rtls.opt is built in the same step as $(BASEEXT).opt
1255 rtls.opt : $(BASEEXT).opt
1256 $(TOUCH) $(MMS$TARGET)
1262 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
1264 ') unless $self->{SKIPHASH}{'static'};
1267 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
1268 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
1270 $(BASEEXT).opt : Makefile.PL
1271 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
1272 ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ],
1273 neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars),')"
1274 $(PERL) -e "print ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)
1280 =item dynamic_lib (override)
1282 Use VMS Link command.
1287 my($self, %attribs) = @_;
1289 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1290 $self = $ExtUtils::MakeMaker::Parent[-1];
1292 return '' unless $self->needs_linking(); #might be because of a subdir
1294 return '' unless $self->has_link_code();
1296 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
1297 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
1301 OTHERLDFLAGS = $otherldflags
1302 INST_DYNAMIC_DEP = $inst_dynamic_dep
1306 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
1307 ',$self->{NOECHO},'$(MKPATH) $(INST_ARCHAUTODIR)
1308 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
1311 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1315 =item dynamic_bs (override)
1317 Use VMS-style quoting on Mkbootstrap command line.
1322 my($self, %attribs) = @_;
1324 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1325 $self = $ExtUtils::MakeMaker::Parent[-1];
1329 ' unless $self->has_link_code();
1331 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
1333 # As MakeMaker mkbootstrap might not write a file (if none is required)
1334 # we use touch to prevent make continually trying to remake it.
1335 # The DynaLoader only reads a non-empty file.
1336 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
1337 '.$self->{NOECHO}.'Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
1338 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1339 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
1340 '.$self->{NOECHO}.' $(TOUCH) $(MMS$TARGET)
1342 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
1343 '.$self->{NOECHO}.'$(RM_RF) $(INST_BOOT)
1344 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
1348 =item static_lib (override)
1350 Use VMS commands to manipulate object library.
1357 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1358 $self = $ExtUtils::MakeMaker::Parent[-1];
1360 return '' unless $self->needs_linking();
1365 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
1369 # Rely on suffix rule for update action
1370 $(OBJECT) : $(INST_ARCHAUTODIR).exists
1372 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
1374 # If this extension has it's own library (eg SDBM_File)
1375 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
1376 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
1379 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
1380 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
1381 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
1383 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1388 # sub installpm_x { # called by installpm perl file
1389 # my($self, $dist, $inst, $splitlib) = @_;
1390 # unless (ref $self){
1391 # ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1392 # $self = $ExtUtils::MakeMaker::Parent[-1];
1394 # if ($inst =~ m!#!) {
1395 # warn "Warning: MM[SK] would have problems processing this file: $inst, SKIPPED\n";
1398 # $inst = $self->fixpath($inst);
1399 # $dist = $self->fixpath($dist);
1400 # my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
1404 # $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
1405 # ",' ',$self->{NOECHO},'$(RM_F) $(MMS$TARGET)
1406 # ',$self->{NOECHO},'$(CP) ',"$dist $inst",'
1407 # $(CHMOD) 644 $(MMS$TARGET)
1409 # push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1410 # $self->catdir($splitlib,'auto')."\n\n")
1411 # if ($splitlib and $inst =~ /\.pm$/);
1412 # push(@m,$self->dir_target($instdir));
1417 =item manifypods (override)
1419 Use VMS-style quoting on command line, and VMS logical name
1420 to specify fallback location at build time if we can't find pod2man.
1425 my($self, %attribs) = @_;
1427 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1428 $self = $ExtUtils::MakeMaker::Parent[-1];
1430 return "\nmanifypods :\n\t\$(NOOP)\n" unless %{$self->{MAN3PODS}};
1432 my($pod2man_exe,$found_pod2man);
1433 if (defined $self->{PERL_SRC}) {
1434 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1436 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
1438 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1440 # No pod2man but some MAN3PODS to be installed
1443 Warning: I could not locate your pod2man program. As a last choice,
1444 I will look for the file to which the logical name POD2MAN
1445 points when MMK is invoked.
1448 $pod2man_exe = "pod2man";
1452 qq[POD2MAN_EXE = $pod2man_exe\n],
1453 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1454 -e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1456 push @m, "\nmanifypods : ";
1457 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1459 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1461 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1462 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1463 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1465 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1466 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1467 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1473 =item processPL (override)
1475 Use VMS-style quoting on command line.
1482 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1483 $self = $ExtUtils::MakeMaker::Parent[-1];
1485 return "" unless $self->{PL_FILES};
1487 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1489 all :: $self->{PL_FILES}->{$plfile}
1492 $self->{PL_FILES}->{$plfile} :: $plfile
1493 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1499 =item installbin (override)
1501 Stay under DCL's 255 character command line limit once again by
1502 splitting potentially long list of files across multiple lines
1503 in C<realclean> target.
1510 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1511 $self = $ExtUtils::MakeMaker::Parent[-1];
1513 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1514 return '' unless @{$self->{EXE_FILES}};
1515 my(@m, $from, $to, %fromto, @to, $line);
1516 for $from (@{$self->{EXE_FILES}}) {
1517 my($path) = '$(INST_EXE)' . basename($from);
1518 local($_) = $path; # backward compatibility
1519 $to = $self->libscan($path);
1520 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1523 @to = values %fromto;
1525 EXE_FILES = @{$self->{EXE_FILES}}
1532 $line = ''; #avoid unitialized var warning
1534 if (length($line) + length($to) > 80) {
1535 push @m, "\t\$(RM_F) $line\n";
1538 else { $line .= " $to"; }
1540 push @m, "\t\$(RM_F) $line\n\n";
1542 while (($from,$to) = each %fromto) {
1543 last unless defined $from;
1545 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1546 else { ($todir = $to) =~ s/[^\)]+$//; }
1547 $todir = $self->fixpath($todir,1);
1549 $to : $from \$(MAKEFILE) ${todir}.exists
1552 ", $self->dir_target($todir);
1557 =item subdir_x (override)
1559 Use VMS commands to change default directory.
1564 my($self, $subdir) = @_;
1566 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1567 $self = $ExtUtils::MakeMaker::Parent[-1];
1570 $subdir = $self->fixpath($subdir,1);
1574 olddef = F$Environment("Default")
1575 Set Default ',$subdir,'
1576 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1577 Set Default \'olddef\'
1582 =item clean (override)
1584 Split potentially long list of files across multiple commands (in
1585 order to stay under the magic command line limit). Also use MM[SK]
1586 commands for handling subdirectories.
1591 my($self, %attribs) = @_;
1593 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1594 $self = $ExtUtils::MakeMaker::Parent[-1];
1598 # Delete temporary files but do not touch installed files. We don\'t delete
1599 # the Descrip.MMS here so that a later make realclean still has it to use.
1602 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1603 my($vmsdir) = $self->fixpath($dir,1);
1604 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1605 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1607 push @m, ' $(RM_F) *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso
1610 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1611 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1612 push(@otherfiles, qw[ blib $(MAKE_APERL_FILE) extralibs.ld perlmain.c pm_to_blib.ts ]);
1613 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1615 $line = ''; #avoid unitialized var warning
1616 foreach $file (@otherfiles) {
1617 $file = $self->fixpath($file);
1618 if (length($line) + length($file) > 80) {
1619 push @m, "\t\$(RM_RF) $line\n";
1622 else { $line .= " $file"; }
1624 push @m, "\t\$(RM_RF) $line\n\n";
1625 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1629 =item realclean (override)
1631 Guess what we're working around? Also, use MM[SK] for subdirectories.
1636 my($self, %attribs) = @_;
1638 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1639 $self = $ExtUtils::MakeMaker::Parent[-1];
1643 # Delete temporary files (via clean) and also delete installed files
1646 foreach(@{$self->{DIR}}){
1647 my($vmsdir) = $self->fixpath($_,1);
1648 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1649 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1651 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1653 # We can't expand several of the MMS macros here, since they don't have
1654 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1655 # combination of macros). In order to stay below DCL's 255 char limit,
1656 # we put only 2 on a line.
1657 my($file,$line,$fcnt);
1658 my(@files) = qw{ $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(OBJECT) $(MAKEFILE) $(MAKEFILE)_old };
1659 push(@files, values %{$self->{PM}});
1660 $line = ''; #avoid unitialized var warning
1661 foreach $file (@files) {
1662 $file = $self->fixpath($file);
1663 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1664 push @m, "\t\$(RM_F) $line\n";
1668 else { $line .= " $file"; }
1670 push @m, "\t\$(RM_F) $line\n";
1671 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1673 foreach $file (@{$attribs{'FILES'}}) {
1674 $file = $self->fixpath($file);
1675 if (length($line) + length($file) > 80) {
1676 push @m, "\t\$(RM_RF) $line\n";
1679 else { $line .= " $file"; }
1681 push @m, "\t\$(RM_RF) $line\n";
1683 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1687 =item dist_basics (override)
1689 Use VMS-style quoting on command line.
1696 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1697 $self = $ExtUtils::MakeMaker::Parent[-1];
1700 distclean :: realclean distcheck
1704 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1707 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1710 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1714 =sub dist_core (override)
1716 Syntax for invoking F<VMS_Share> differs from that for Unix F<shar>,
1717 so C<shdist> target actions are VMS-specific.
1724 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1725 $self = $ExtUtils::MakeMaker::Parent[-1];
1728 dist : $(DIST_DEFAULT)
1729 ].$self->{NOECHO}.q[$(PERL) -le "print 'Warning: $m older than $vf' if -e ($vf = '$(VERSION_FROM)') && -M $vf < -M ($m = '$(MAKEFILE)'"
1731 zipdist : $(DISTVNAME).zip
1734 $(DISTVNAME).zip : distdir
1736 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1737 $(RM_RF) $(DISTVNAME)
1742 $(SHARE) $(SRC) $(DISTVNAME).share
1743 $(RM_RF) $(DISTVNAME)
1748 =item dist_dir (override)
1750 Use VMS-style quoting on command line.
1757 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1758 $self = $ExtUtils::MakeMaker::Parent[-1];
1762 $(RM_RF) $(DISTVNAME)
1763 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1764 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1768 =item dist_test (override)
1770 Use VMS commands to change default directory, and use VMS-style
1771 quoting on command line.
1778 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1779 $self = $ExtUtils::MakeMaker::Parent[-1];
1783 startdir = F$Environment("Default")
1784 Set Default [.$(DISTVNAME)]
1785 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1788 Set Default 'startdir'
1792 # --- Test and Installation Sections ---
1794 =item install (override)
1796 Work around DCL's 255 character limit several times,and use
1797 VMS-style command line quoting in a few cases.
1802 my($self, %attribs) = @_;
1804 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1805 $self = $ExtUtils::MakeMaker::Parent[-1];
1809 if ($self->{EXE_FILES}) {
1810 my($line,$file) = ('','');
1811 foreach $file (@{$self->{EXE_FILES}}) {
1813 if (length($line) > 128) {
1814 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]);
1818 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]) if $line;
1822 install :: all pure_install doc_install
1825 install_perl :: all pure_perl_install doc_perl_install
1828 install_site :: all pure_site_install doc_site_install
1831 install_ :: install_site
1832 ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1834 pure_install :: pure_$(INSTALLDIRS)_install
1837 doc_install :: doc_$(INSTALLDIRS)_install
1838 ],$self->{NOECHO},q[Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
1840 pure__install : pure_site_install
1841 ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1843 doc__install : doc_site_install
1844 ],$self->{NOECHO},q[Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1846 # This hack brought to you by DCL's 255-character command line limit
1847 pure_perl_install ::
1848 ].$self->{NOECHO}.q[$(PERL) -e "print 'read ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1849 ].$self->{NOECHO}.q[$(PERL) -e "print 'write ].$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1850 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_LIB) $(INSTALLPRIVLIB) '" >>.MM_tmp
1851 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLARCHLIB) '" >>.MM_tmp
1852 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_EXE) $(INSTALLBIN) '" >>.MM_tmp
1853 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1854 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1855 $(MOD_INSTALL) <.MM_tmp
1856 ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
1857 ].$self->{NOECHO}.q[$(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[
1860 pure_site_install ::
1861 ].$self->{NOECHO}.q[$(PERL) -e "print 'read ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1862 ].$self->{NOECHO}.q[$(PERL) -e "print 'write ].$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1863 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_LIB) $(INSTALLSITELIB) '" >>.MM_tmp
1864 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLSITEARCH) '" >>.MM_tmp
1865 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_EXE) $(INSTALLBIN) '" >>.MM_tmp
1866 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1867 ].$self->{NOECHO}.q[$(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1868 $(MOD_INSTALL) <.MM_tmp
1869 ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
1870 ].$self->{NOECHO}.q[$(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1874 ].$self->{NOECHO}.q[$(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLPRIVLIB)|'" >.MM_tmp
1875 ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1876 ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1877 ],@docfiles,q[ $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1878 ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
1882 ].$self->{NOECHO}.q[$(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLSITELIB)|'" >.MM_tmp
1883 ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1884 ].$self->{NOECHO}.q[$(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1885 ],@docfiles,q[ $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1886 ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
1891 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1894 uninstall_from_perldirs ::
1895 ].$self->{NOECHO}.q[$(UNINSTALL) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1897 uninstall_from_sitedirs ::
1898 ].$self->{NOECHO}.q[$(UNINSTALL) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')."\n";
1903 =item perldepend (override)
1905 Use VMS-style syntax for files; it's cheaper to just do it directly here
1906 than to have the MM_Unix method call C<catfile> repeatedly. Also use
1907 config.vms as source of original config data if the Perl distribution
1908 is available; config.sh is an ancillary file under VMS. Finally, if
1909 we have to rebuild Config.pm, use MM[SK] to do it.
1916 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1917 $self = $ExtUtils::MakeMaker::Parent[-1];
1922 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1923 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1924 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1925 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1926 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1927 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1928 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1930 ' if $self->{OBJECT};
1932 if ($self->{PERL_SRC}) {
1934 my($mmsquals) = '$(USEMAKEFILE)[.vms]$(MAKEFILE)';
1935 push(@macros,'__AXP__=1') if $Config{'arch'} eq 'VMS_AXP';
1936 push(@macros,'DECC=1') if $Config{'vms_cc_type'} eq 'decc';
1937 push(@macros,'GNUC=1') if $Config{'vms_cc_type'} eq 'gcc';
1938 push(@macros,'SOCKET=1') if $Config{'d_has_sockets'};
1939 push(@macros,qq["CC=$Config{'cc'}"]) if $Config{'cc'} =~ m!/!;
1940 $mmsquals .= '$(USEMACROS)' . join(',',@macros) . '$(MACROEND)' if @macros;
1942 # Check for unpropagated config.sh changes. Should never happen.
1943 # We do NOT just update config.h because that is not sufficient.
1944 # An out of date config.h is not fatal but complains loudly!
1945 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1946 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1947 ],$self->{NOECHO},q[Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1949 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1950 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1951 ],$self->{NOECHO},q[Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1952 olddef = F$Environment("Default")
1953 Set Default $(PERL_SRC)
1954 $(MMS)],$mmsquals,q[ $(MMS$TARGET)
1955 Set Default 'olddef'
1959 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1965 =item makefile (override)
1967 Use VMS commands and quoting.
1974 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1975 $self = $ExtUtils::MakeMaker::Parent[-1];
1978 # We do not know what target was originally specified so we
1979 # must force a manual rerun to be sure. But as it should only
1980 # happen very rarely it is not a significant problem.
1982 $(OBJECT) : $(FIRST_MAKEFILE)
1983 ] if $self->{OBJECT};
1986 # We take a very conservative approach here, but it\'s worth it.
1987 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1988 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1989 ],$self->{NOECHO},q[Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1990 ],$self->{NOECHO},q[Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1991 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1992 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1993 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[
1994 ],$self->{NOECHO},q[Write Sys$Output "$(MAKEFILE) has been rebuilt."
1995 ],$self->{NOECHO},q[Write Sys$Output "Please run $(MMS) to build the extension."
2001 =item test (override)
2003 Use VMS commands for handling subdirectories.
2008 my($self, %attribs) = @_;
2010 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2011 $self = $ExtUtils::MakeMaker::Parent[-1];
2013 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
2017 TEST_TYPE = test_\$(LINKTYPE)
2019 test :: \$(TEST_TYPE)
2022 testdb :: testdb_\$(LINKTYPE)
2026 foreach(@{$self->{DIR}}){
2027 my($vmsdir) = $self->fixpath($_,1);
2028 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
2029 '; print `$(MMS) $(PASTHRU2) test`'."\n");
2031 push(@m, "\t$self->{NOECHO}Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
2032 unless $tests or -f "test.pl" or @{$self->{DIR}};
2035 push(@m, "test_dynamic :: pure_all\n");
2036 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
2037 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
2038 push(@m, " \$(NOOP)\n") if (!$tests && ! -f "test.pl");
2042 push(@m, "testdb_dynamic :: pure_all\n");
2043 push(@m, $self->test_via_script('$(FULLPERL) -d', 'test.pl'));
2047 # Occasionally we may face this degenerate target:
2048 push @m, "test_ : test_dynamic\n\n";
2050 if ($self->needs_linking()) {
2051 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
2052 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
2054 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl'));
2055 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
2056 push(@m, $self->test_via_script('$(MAP_TARGET) -d', 'test.pl'));
2059 push(@m, "\t$self->{NOECHO}\$(NOOP)\n") if (!$tests && ! -f "test.pl");
2063 push @m, "test_static :: test_dynamic\n\t$self->{NOECHO}\$(NOOP)\n\n";
2064 push @m, "testdb_static :: testdb_dynamic\n\t$self->{NOECHO}\$(NOOP)\n";
2070 =item test_via_harness (override)
2072 Use VMS-style quoting on command line.
2076 sub test_via_harness {
2077 my($self,$perl,$tests) = @_;
2079 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2080 $self = $ExtUtils::MakeMaker::Parent[-1];
2082 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
2083 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
2086 =item test_via_script (override)
2088 Use VMS-style quoting on command line.
2092 sub test_via_script {
2093 my($self,$perl,$script) = @_;
2095 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2096 $self = $ExtUtils::MakeMaker::Parent[-1];
2098 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '.$script.'
2102 =item makeaperl (override)
2104 Undertake to build a new set of Perl images using VMS commands. Since
2105 VMS does dynamic loading, it's not necessary to statically link each
2106 extension into the Perl image, so this isn't the normal build path.
2107 Consequently, it hasn't really been tested, and may well be incomplete.
2112 my($self, %attribs) = @_;
2114 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2115 $self = $ExtUtils::MakeMaker::Parent[-1];
2117 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2118 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2121 # --- MakeMaker makeaperl section ---
2122 MAP_TARGET = $target
2124 return join '', @m if $self->{PARENT};
2126 my($dir) = join ":", @{$self->{DIR}};
2128 unless ($self->{MAKEAPERL}) {
2130 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
2131 },$self->{NOECHO},q{Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
2132 },$self->{NOECHO},q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
2133 Makefile.PL DIR=}, $dir, q{ \
2134 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2135 MAKEAPERL=1 NORECURS=1
2137 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
2138 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
2140 push @m, map( " \\\n\t\t$_", @ARGV );
2147 my($linkcmd,@staticopts,@staticpkgs,$extralist,$target,$targdir,$libperldir);
2149 # The front matter of the linkcommand...
2150 $linkcmd = join ' ', $Config{'ld'},
2151 grep($_, @Config{qw(large split ldflags ccdlflags)});
2152 $linkcmd =~ s/\s+/ /g;
2154 # Which *.olb files could we make use of...
2156 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
2158 File::Find::find(sub {
2159 return unless m/\Q$self->{LIB_EXT}\E$/;
2160 return if m/^libperl/;
2161 $olbs{$ENV{DEFAULT}} = $_;
2162 }, grep( -d $_, @{$searchdirs || []}));
2164 # We trust that what has been handed in as argument will be buildable
2165 $static = [] unless $static;
2166 @olbs{@{$static}} = (1) x @{$static};
2168 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2169 # Sort the object libraries in inverse order of
2170 # filespec length to try to insure that dependent extensions
2171 # will appear before their parents, so the linker will
2172 # search the parent library to resolve references.
2173 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
2174 # references from [.intuit.dwim]dwim.obj can be found
2175 # in [.intuit]intuit.olb).
2176 for (sort keys %olbs) {
2177 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
2178 my($dir) = $self->fixpath($_,1);
2179 my($extralibs) = $dir . "extralibs.ld";
2180 my($extopt) = $dir . $olbs{$_};
2181 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
2182 if (-f $extralibs ) {
2183 open LIST,$extralibs or warn $!,next;
2184 push @$extra, <LIST>;
2188 open OPT,$extopt or die $!;
2190 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
2191 # ExtUtils::Miniperl expects Unix paths
2192 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
2193 push @staticpkgs,$pkg;
2195 push @staticopts, $extopt;
2199 $target = "Perl.Exe" unless $target;
2200 ($shrtarget,$targdir) = fileparse($target);
2201 $shrtarget =~ s/^([^.]*)/$1Shr/;
2202 $shrtarget = $targdir . $shrtarget;
2203 $target = "Perlshr.$Config{'dlext'}" unless $target;
2204 $tmp = "[]" unless $tmp;
2205 $tmp = $self->fixpath($tmp,1);
2207 $extralist = join(' ',@$extra);
2208 $extralist =~ s/[,\s\n]+/, /g;
2210 else { $extralist = ''; }
2212 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
2213 print STDOUT "Warning: $libperl not found\n";
2218 if (defined $self->{PERL_SRC}) {
2219 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
2220 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
2222 print STDOUT "Warning: $libperl not found
2223 If you're going to build a static perl binary, make sure perl is installed
2224 otherwise ignore this warning\n";
2227 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
2230 # Fill in the target you want to produce if it\'s not perl
2231 MAP_TARGET = ',$self->fixpath($target),'
2232 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
2233 MAP_LINKCMD = $linkcmd
2234 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
2235 # We use the linker options files created with each extension, rather than
2236 #specifying the object files directly on the command line.
2237 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
2238 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
2239 MAP_EXTRA = $extralist
2240 MAP_LIBPERL = ",$self->fixpath($libperl),'
2245 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
2246 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
2247 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
2248 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
2249 ',$self->{NOECHO},'Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
2250 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
2251 ',$self->{NOECHO},'Write Sys$Output "To remove the intermediate files, say
2252 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
2255 ',"${tmp}perlmain.c",' : $(MAKEFILE)
2256 ',$self->{NOECHO},'$(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
2260 # More from the 255-char line length limit
2262 ].$self->{NOECHO}.q[$(PERL) -e "print 'Perl binary $(MAP_TARGET)|'" >.MM_tmp
2263 ].$self->{NOECHO}.q[$(PERL) -e "print 'MAP_STATIC|$(MAP_STATIC)|'" >>.MM_tmp
2264 ].$self->{NOECHO}.q[$(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp
2265 ].$self->{NOECHO}.q[$(PERL) -e "print 'MAP_LIBPERL|$(MAP_LIBPERL)|'" >>.MM_tmp
2266 $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
2267 ].$self->{NOECHO}.q[Delete/NoLog/NoConfirm .MM_tmp;
2271 inst_perl : pure_inst_perl doc_inst_perl
2274 pure_inst_perl : \$(MAP_TARGET)
2275 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
2276 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
2282 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
2283 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
2289 =item ext (specific)
2291 Stub routine standing in for C<ExtUtils::LibList::ext> until VMS
2292 support is added to that package.
2299 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2300 $self = $ExtUtils::MakeMaker::Parent[-1];
2305 # --- Output postprocessing section ---
2307 =item nicetext (override)
2309 Insure that colons marking targets are preceded by space, in order
2310 to distinguish the target delimiter from a colon appearing as
2317 my($self,$text) = @_;
2319 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
2320 $self = $ExtUtils::MakeMaker::Parent[-1];
2322 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;