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.38 (02-Oct-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 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
49 my($npath) = unixify($path);
50 my($head,$macro,$tail);
52 # perform m##g in scalar context so it acts as an iterator
53 while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) {
55 ($head,$macro,$tail) = ($1,$2,$3);
56 ($macro = unixify($self->{$macro})) =~ s#/$##;
57 $npath = "$head$macro$tail";
60 print "eliminate_macros($path) = |$npath|\n" if $Verbose >= 3;
66 Catchall routine to clean up problem MM[SK]/Make macros. Expands macros
67 in any directory specification, in order to avoid juxtaposing two
68 VMS-syntax directories when MM[SK] is run. Also expands expressions which
69 are all macro, so that we can tell how long the expansion is, and avoid
70 overrunning DCL's command buffer when MM[KS] is running.
72 If optional second argument has a TRUE value, then the return string is
73 a VMS-syntax directory specification, otherwise it is a VMS-syntax file
79 my($self,$path,$force_path) = @_;
81 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
84 my($fixedpath,$prefix,$name);
86 if ($path =~ m#^\$\(.+\)$# || $path =~ m#[/:>\]]#) {
87 if ($force_path or $path =~ /(?:DIR\)|\])$/) {
88 $fixedpath = vmspath($self->eliminate_macros($path));
91 $fixedpath = vmsify($self->eliminate_macros($path));
94 elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#)) && $self->{$prefix}) {
95 my($vmspre) = vmspath($self->eliminate_macros("\$($prefix)")) || ''; # is it a dir or just a name?
96 $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name;
97 $fixedpath = vmspath($fixedpath) if $force_path;
101 $fixedpath = vmspath($fixedpath) if $force_path;
103 # Convert names without directory or type to paths
104 if (!$force_path and $fixedpath !~ /[:>(.\]]/) { $fixedpath = vmspath($fixedpath); }
105 # Trim off root dirname if it's had other dirs inserted in front of it.
106 $fixedpath =~ s/\.000000([\]>])/$1/;
107 print "fixpath($path) = |$fixedpath|\n" if $Verbose >= 3;
113 Concatenates a list of file specifications, and returns the result as a
114 VMS-syntax directory specification.
119 my($self,@dirs) = @_;
120 my($dir) = pop @dirs;
121 @dirs = grep($_,@dirs);
124 my($path) = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
125 my($spath,$sdir) = ($path,$dir);
126 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
127 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
128 $rslt = $self->fixpath($self->eliminate_macros($spath)."/$sdir",1);
131 if ($dir =~ /^\$\([^\)]+\)$/) { $rslt = $dir; }
132 else { $rslt = vmspath($dir); }
134 print "catdir(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
140 Concatenates a list of file specifications, and returns the result as a
141 VMS-syntax directory specification.
146 my($self,@files) = @_;
147 my($file) = pop @files;
148 @files = grep($_,@files);
151 my($path) = (@files == 1 ? $files[0] : $self->catdir(@files));
154 if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
156 $rslt = $self->eliminate_macros($spath);
157 $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
160 else { $rslt = vmsify($file); }
161 print "catfile(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
165 =item curdir (override)
167 Returns a string representing of the current directory.
175 =item rootdir (override)
177 Returns a string representing of the root directory.
185 =item updir (override)
187 Returns a string representing of the parent directory.
195 package ExtUtils::MM_VMS;
197 sub ExtUtils::MM_VMS::guess_name;
198 sub ExtUtils::MM_VMS::find_perl;
199 sub ExtUtils::MM_VMS::path;
200 sub ExtUtils::MM_VMS::maybe_command;
201 sub ExtUtils::MM_VMS::maybe_command_in_dirs;
202 sub ExtUtils::MM_VMS::perl_script;
203 sub ExtUtils::MM_VMS::file_name_is_absolute;
204 sub ExtUtils::MM_VMS::replace_manpage_separator;
205 sub ExtUtils::MM_VMS::init_others;
206 sub ExtUtils::MM_VMS::constants;
207 sub ExtUtils::MM_VMS::const_loadlibs;
208 sub ExtUtils::MM_VMS::cflags;
209 sub ExtUtils::MM_VMS::const_cccmd;
210 sub ExtUtils::MM_VMS::pm_to_blib;
211 sub ExtUtils::MM_VMS::tool_autosplit;
212 sub ExtUtils::MM_VMS::tool_xsubpp;
213 sub ExtUtils::MM_VMS::xsubpp_version;
214 sub ExtUtils::MM_VMS::tools_other;
215 sub ExtUtils::MM_VMS::dist;
216 sub ExtUtils::MM_VMS::c_o;
217 sub ExtUtils::MM_VMS::xs_c;
218 sub ExtUtils::MM_VMS::xs_o;
219 sub ExtUtils::MM_VMS::top_targets;
220 sub ExtUtils::MM_VMS::dlsyms;
221 sub ExtUtils::MM_VMS::dynamic_lib;
222 sub ExtUtils::MM_VMS::dynamic_bs;
223 sub ExtUtils::MM_VMS::static_lib;
224 sub ExtUtils::MM_VMS::manifypods;
225 sub ExtUtils::MM_VMS::processPL;
226 sub ExtUtils::MM_VMS::installbin;
227 sub ExtUtils::MM_VMS::subdir_x;
228 sub ExtUtils::MM_VMS::clean;
229 sub ExtUtils::MM_VMS::realclean;
230 sub ExtUtils::MM_VMS::dist_basics;
231 sub ExtUtils::MM_VMS::dist_core;
232 sub ExtUtils::MM_VMS::dist_dir;
233 sub ExtUtils::MM_VMS::dist_test;
234 sub ExtUtils::MM_VMS::install;
235 sub ExtUtils::MM_VMS::perldepend;
236 sub ExtUtils::MM_VMS::makefile;
237 sub ExtUtils::MM_VMS::test;
238 sub ExtUtils::MM_VMS::test_via_harness;
239 sub ExtUtils::MM_VMS::test_via_script;
240 sub ExtUtils::MM_VMS::makeaperl;
241 sub ExtUtils::MM_VMS::ext;
242 sub ExtUtils::MM_VMS::nicetext;
247 if (defined fileno(DATA)) {
248 my $fh = select DATA;
249 my $o = $/; # For future reads from the file.
261 warn "AUTOLOAD called unexpectedly for $AUTOLOAD";
263 defined(&$AUTOLOAD) or die "Myloader inconsistency error";
271 =head2 SelfLoaded methods
273 Those methods which override default MM_Unix methods are marked
274 "(override)", while methods unique to MM_VMS are marked "(specific)".
275 For overridden methods, documentation is limited to an explanation
276 of why this method overrides the MM_Unix method; see the ExtUtils::MM_Unix
277 documentation for more details.
279 =item guess_name (override)
281 Try to determine name of extension being built. We begin with the name
282 of the current directory. Since VMS filenames are case-insensitive,
283 however, we look for a F<.pm> file whose name matches that of the current
284 directory (presumably the 'main' F<.pm> file for this extension), and try
285 to find a C<package> statement from which to obtain the Mixed::Case
295 $defname = basename(fileify($ENV{'DEFAULT'}));
296 $defname =~ s![\d\-_]*\.dir.*$!!; # Clip off .dir;1 suffix, and package version
298 if (open(PM,"${defpm}.pm")){
300 if (/^\s*package\s+([^;]+)/i) {
305 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
306 "defaulting package name to $defname\n"
311 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
312 "defaulting package name to $defname\n";
314 $defname =~ s#[\d.\-_]+$##;
318 =item find_perl (override)
320 Use VMS file specification syntax and CLI commands to find and
326 my($self, $ver, $names, $dirs, $trace) = @_;
327 my($name,$dir,$vmsfile,@sdirs,@snames,@cand);
329 # Check in relative directories first, so we pick up the current
330 # version of Perl if we're running MakeMaker as part of the main build.
331 @sdirs = sort { my($absa) = $self->file_name_is_absolute($a);
332 my($absb) = $self->file_name_is_absolute($b);
333 if ($absa && $absb) { return $a cmp $b }
334 else { return $absa ? 1 : ($absb ? -1 : ($a cmp $b)); }
336 # Check miniperl before perl, and check names likely to contain
337 # version numbers before "generic" names, so we pick up an
338 # executable that's less likely to be from an old installation.
339 @snames = sort { my($ba) = $a =~ m!([^:>\]/]+)$!; # basename
340 my($bb) = $b =~ m!([^:>\]/]+)$!;
341 my($ahasdir) = (length($a) - length($ba) > 0);
342 my($bhasdir) = (length($b) - length($bb) > 0);
343 if ($ahasdir and not $bhasdir) { return 1; }
344 elsif ($bhasdir and not $ahasdir) { return -1; }
345 else { $bb =~ /\d/ <=> $ba =~ /\d/
346 or substr($ba,0,1) cmp substr($bb,0,1)
347 or length($bb) <=> length($ba) } } @$names;
348 # Image names containing Perl version use '_' instead of '.' under VMS
349 foreach $name (@snames) { $name =~ s/\.(\d+)$/_$1/; }
351 print "Looking for perl $ver by these names:\n";
352 print "\t@snames,\n";
353 print "in these dirs:\n";
356 foreach $dir (@sdirs){
357 next unless defined $dir; # $self->{PERL_SRC} may be undefined
358 $inabs++ if $self->file_name_is_absolute($dir);
360 # We've covered relative dirs; everything else is an absolute
361 # dir (probably an installed location). First, we'll try potential
362 # command names, to see whether we can avoid a long MCR expression.
363 foreach $name (@snames) { push(@cand,$name) if $name =~ /^[\w\-\$]+$/; }
364 $inabs++; # Should happen above in next $dir, but just in case . . .
366 foreach $name (@snames){
367 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
368 else { push(@cand,$self->fixpath($name)); }
371 foreach $name (@cand) {
372 print "Checking $name\n" if ($trace >= 2);
373 # If it looks like a potential command, try it without the MCR
374 if ($name =~ /^[\w\-\$]+$/ &&
375 `$name -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
376 print "Using PERL=$name\n" if $trace;
379 next unless $vmsfile = $self->maybe_command($name);
380 $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
381 print "Executing $vmsfile\n" if ($trace >= 2);
382 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
383 print "Using PERL=MCR $vmsfile\n" if $trace;
384 return "MCR $vmsfile";
387 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
388 0; # false and not empty
391 =item path (override)
393 Translate logical name DCL$PATH as a searchlist, rather than trying
394 to C<split> string value of C<$ENV{'PATH'}>.
400 while ($dir = $ENV{'DCL$PATH;' . $i++}) { push(@dirs,$dir); }
404 =item maybe_command (override)
406 Follows VMS naming conventions for executable files.
407 If the name passed in doesn't exactly match an executable file,
408 appends F<.Exe> to check for executable image, and F<.Com> to check
409 for DCL procedure. If this fails, checks F<Sys$Share:> for an
410 executable file having the name specified. Finally, appends F<.Exe>
416 my($self,$file) = @_;
417 return $file if -x $file && ! -d _;
418 return "$file.exe" if -x "$file.exe";
419 return "$file.com" if -x "$file.com";
420 if ($file !~ m![/:>\]]!) {
421 my($shrfile) = 'Sys$Share:' . $file;
422 return $file if -x $shrfile && ! -d _;
423 return "$file.exe" if -x "$shrfile.exe";
428 =item maybe_command_in_dirs (override)
430 Uses DCL argument quoting on test command line.
434 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
435 my($self, $names, $dirs, $trace, $ver) = @_;
437 foreach $dir (@$dirs){
438 next unless defined $dir; # $self->{PERL_SRC} may be undefined
439 foreach $name (@$names){
441 if ($self->file_name_is_absolute($name)) {
444 $abs = $self->catfile($dir, $name);
446 print "Checking $abs for $name\n" if ($trace >= 2);
447 next unless $tryabs = $self->maybe_command($abs);
448 print "Substituting $tryabs instead of $abs\n"
449 if ($trace >= 2 and $tryabs ne $abs);
452 print "Executing $abs\n" if ($trace >= 2);
453 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
454 print "Using $abs\n" if $trace;
457 } else { # Do not look for perl
464 =item perl_script (override)
466 If name passed in doesn't specify a readable file, appends F<.pl> and
467 tries again, since it's customary to have file types on all files
473 my($self,$file) = @_;
474 return $file if -r $file && ! -d _;
475 return "$file.pl" if -r "$file.pl" && ! -d _;
479 =item file_name_is_absolute (override)
481 Checks for VMS directory spec as well as Unix separators.
485 sub file_name_is_absolute {
486 my($self,$file) = @_;
487 $file =~ m!^/! or $file =~ m![<\[][^.\-\]>]! or $file =~ /:[^<\[]/;
490 =item replace_manpage_separator
492 Use as separator a character which is legal in a VMS-syntax file name.
496 sub replace_manpage_separator {
498 $man = unixify($man);
503 =item init_others (override)
505 Provide VMS-specific forms of various utility commands, then hand
506 off to the default MM_Unix method.
513 $self->{NOOP} = 'Continue';
514 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
515 $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
516 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
517 $self->{NOECHO} ||= '@ ';
518 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
519 $self->{RM_RF} = '$(PERL) "-I$(PERL_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
520 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
521 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
522 $self->{CP} = 'Copy/NoConfirm';
523 $self->{MV} = 'Rename/NoConfirm';
524 $self->{UMASK_NULL} = '! ';
525 &ExtUtils::MM_Unix::init_others;
528 =item constants (override)
530 Fixes up numerous file and directory macros to insure VMS syntax
531 regardless of input syntax. Also adds a few VMS-specific macros
532 and makes lists of files comma-separated.
540 if ($self->{DEFINE} ne '') {
541 my(@defs) = split(/\s+/,$self->{DEFINE});
542 foreach $def (@defs) {
545 $def = "\"$def\"" if $def =~ /=/;
547 $self->{DEFINE} = join ',',@defs;
550 if ($self->{OBJECT} =~ /\s/) {
551 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
552 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
554 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
557 # Fix up directory specs
558 $self->{ROOTEXT} = $self->{ROOTEXT} ? $self->fixpath($self->{ROOTEXT},1)
560 foreach $macro ( qw [
561 INST_BIN INST_SCRIPT INST_LIB INST_ARCHLIB INST_EXE INSTALLPRIVLIB
562 INSTALLARCHLIB INSTALLSCRIPT INSTALLBIN PERL_LIB PERL_ARCHLIB
563 PERL_INC PERL_SRC FULLEXT INST_MAN1DIR INSTALLMAN1DIR
564 INST_MAN3DIR INSTALLMAN3DIR INSTALLSITELIB INSTALLSITEARCH
565 SITELIBEXP SITEARCHEXP ] ) {
566 next unless defined $self->{$macro};
567 $self->{$macro} = $self->fixpath($self->{$macro},1);
569 $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC},q(VMS))
570 if ($self->{PERL_SRC});
575 foreach $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKE_APERL_FILE MYEXTLIB] ) {
576 next unless defined $self->{$macro};
577 $self->{$macro} = $self->fixpath($self->{$macro});
581 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION
582 INST_BIN INST_EXE INST_LIB INST_ARCHLIB INST_SCRIPT PREFIX
583 INSTALLDIRS INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
584 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
585 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
586 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_VMS
587 PERL_INC PERL FULLPERL
589 next unless defined $self->{$macro};
590 push @m, "$macro = $self->{$macro}\n";
595 VERSION_MACRO = VERSION
596 DEFINE_VERSION = "$(VERSION_MACRO)=""$(VERSION)"""
597 XS_VERSION_MACRO = XS_VERSION
598 XS_DEFINE_VERSION = "$(XS_VERSION_MACRO)=""$(XS_VERSION)"""
600 MAKEMAKER = ],$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),qq[
601 MM_VERSION = $ExtUtils::MakeMaker::VERSION
602 MM_REVISION = $ExtUtils::MakeMaker::Revision
603 MM_VMS_REVISION = $ExtUtils::MM_VMS::Revision
605 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
606 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
607 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
608 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
612 FULLEXT VERSION_FROM OBJECT LDFROM
614 next unless defined $self->{$tmp};
615 push @m, "$tmp = ",$self->fixpath($self->{$tmp}),"\n";
619 BASEEXT PARENT_NAME DLBASE INC DEFINE LINKTYPE
621 next unless defined $self->{$tmp};
622 push @m, "$tmp = $self->{$tmp}\n";
625 for $tmp (qw/ XS MAN1PODS MAN3PODS PM /) {
626 next unless defined $self->{$tmp};
628 for $key (keys %{$self->{$tmp}}) {
629 $tmp{$self->fixpath($key)} = $self->fixpath($self->{$tmp}{$key});
631 $self->{$tmp} = \%tmp;
634 for $tmp (qw/ C O_FILES H /) {
635 next unless defined $self->{$tmp};
637 for $val (@{$self->{$tmp}}) {
638 push(@tmp,$self->fixpath($val));
640 $self->{$tmp} = \@tmp;
645 # Handy lists of source code files:
646 XS_FILES = ',join(', ', sort keys %{$self->{XS}}),'
647 C_FILES = ',join(', ', @{$self->{C}}),'
648 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
649 H_FILES = ',join(', ', @{$self->{H}}),'
650 MAN1PODS = ',join(', ', sort keys %{$self->{MAN1PODS}}),'
651 MAN3PODS = ',join(', ', sort keys %{$self->{MAN3PODS}}),'
656 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
658 next unless defined $self->{$tmp};
659 push @m, "$tmp = $self->{$tmp}\n";
663 .SUFFIXES : \$(OBJ_EXT) .c .cpp .cxx .xs
665 # Here is the Config.pm that we are using/depend on
666 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
668 # Where to put things:
669 INST_LIBDIR = $self->{INST_LIBDIR}
670 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
672 INST_AUTODIR = $self->{INST_AUTODIR}
673 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
676 if ($self->has_link_code()) {
678 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
679 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
680 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
687 EXPORT_LIST = $(BASEEXT).opt
688 PERL_ARCHIVE = ',($ENV{'PERLSHR'} ? $ENV{'PERLSHR'} : 'Sys$Share:PerlShr.Exe'),'
692 $self->{TO_INST_PM} = [ sort keys %{$self->{PM}} ];
693 $self->{PM_TO_BLIB} = [ %{$self->{PM}} ];
695 TO_INST_PM = ',join(', ',@{$self->{TO_INST_PM}}),'
697 PM_TO_BLIB = ',join(', ',@{$self->{PM_TO_BLIB}}),'
703 =item const_loadlibs (override)
705 Basically a stub which passes through library specfications provided
706 by the caller. Will be updated or removed when VMS support is added
707 to ExtUtils::Liblist.
715 # $self->{NAME} might depend on some other libraries.
716 # (These comments may need revising:)
718 # Dependent libraries can be linked in one of three ways:
720 # 1. (For static extensions) by the ld command when the perl binary
721 # is linked with the extension library. See EXTRALIBS below.
723 # 2. (For dynamic extensions) by the ld command when the shared
724 # object is built/linked. See LDLOADLIBS below.
726 # 3. (For dynamic extensions) by the DynaLoader when the shared
727 # object is loaded. See BSLOADLIBS below.
729 # EXTRALIBS = List of libraries that need to be linked with when
730 # linking a perl binary which includes this extension
731 # Only those libraries that actually exist are included.
732 # These are written to a file and used when linking perl.
734 # LDLOADLIBS = List of those libraries which can or must be linked into
735 # the shared library when created using ld. These may be
736 # static or dynamic libraries.
737 # LD_RUN_PATH is a colon separated list of the directories
738 # in LDLOADLIBS. It is passed as an environment variable to
739 # the process that links the shared library.
741 # BSLOADLIBS = List of those libraries that are needed but can be
742 # linked in dynamically at run time on this platform.
743 # SunOS/Solaris does not need this because ld records
744 # the information (from LDLOADLIBS) into the object file.
745 # This list is used to create a .bs (bootstrap) file.
747 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
748 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
749 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
754 =item cflags (override)
756 Bypass shell script and produce qualifiers for CC directly (but warn
757 user if a shell script for this extension exists). Fold multiple
758 /Defines into one, since some C compilers pay attention to only one
759 instance of this qualifier on the command line.
764 my($self,$libperl) = @_;
765 my($quals) = $Config{'ccflags'};
767 my($optimize) = '/Optimize';
769 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
770 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
771 " required to modify CC command for $self->{'BASEEXT'}\n"
774 # Deal with $self->{DEFINE} here since some C compilers pay attention
775 # to only one /Define clause on command line, so we have to
776 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
777 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
778 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
779 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
782 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
783 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
786 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
787 if ($libperl =~ /libperl(\w+)\./i) {
789 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
790 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
791 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
792 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
795 # Likewise with $self->{INC} and /Include
796 my($incstr) = '/Include=($(PERL_INC)';
797 if ($self->{'INC'}) {
798 my(@includes) = split(/\s+/,$self->{INC});
799 foreach (@includes) {
801 $incstr .= ', '.$self->fixpath($_,1);
804 $quals .= "$incstr)";
806 $optimize = '/Debug/NoOptimize'
807 if ($self->{OPTIMIZE} =~ /-g/ or $self->{OPTIMIZE} =~ m!/Debug!i);
809 return $self->{CFLAGS} = qq{
818 =item const_cccmd (override)
820 Adds directives to point C preprocessor to the right place when
821 handling #include E<lt>sys/foo.hE<gt> directives. Also constructs CC
822 command line a bit differently than MM_Unix method.
827 my($self,$libperl) = @_;
830 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
831 return '' unless $self->needs_linking();
832 if ($Config{'vms_cc_type'} eq 'gcc') {
835 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS GNU_CC_Include:[VMS]';
837 elsif ($Config{'vms_cc_type'} eq 'vaxc') {
840 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library
841 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include';
846 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ',
847 ($Config{'arch'} eq 'VMS_AXP' ? 'Sys$Library' : 'DECC$Library_Include'),'
848 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include';
851 push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n");
853 $self->{CONST_CCCMD} = join('',@m);
856 =item pm_to_blib (override)
858 DCL I<still> accepts a maximum of 255 characters on a command
859 line, so we write the (potentially) long list of file names
860 to a temp file, then persuade Perl to read it instead of the
861 command line to find args.
867 my($line,$from,$to,@m);
868 my($autodir) = $self->catdir('$(INST_LIB)','auto');
869 my(@files) = @{$self->{PM_TO_BLIB}};
873 # Dummy target to match Unix target name; we use pm_to_blib.ts as
874 # timestamp file to avoid repeated invocations under VMS
875 pm_to_blib : pm_to_blib.ts
878 # As always, keep under DCL's 255-char limit
879 pm_to_blib.ts : $(TO_INST_PM)
880 $(NOECHO) $(PERL) -e "print '},shift(@files),q{ },shift(@files),q{'" >.MM_tmp
883 $line = ''; # avoid uninitialized var warning
884 while ($from = shift(@files),$to = shift(@files)) {
885 $line .= " $from $to";
886 if (length($line) > 128) {
887 push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n");
891 push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n") if $line;
893 push(@m,q[ $(PERL) "-I$(PERL_LIB)" "-MExtUtils::Install" -e "pm_to_blib({split(' ',<STDIN>)},'].$autodir.q[')" <.MM_tmp]);
895 \$(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
896 \$(NOECHO) \$(TOUCH) pm_to_blib.ts
902 =item tool_autosplit (override)
904 Use VMS-style quoting on command line.
909 my($self, %attribs) = @_;
911 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
913 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
914 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
918 =item tool_sxubpp (override)
920 Use VMS-style quoting on xsubpp command line.
926 return '' unless $self->needs_linking;
927 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
928 # drop back to old location if xsubpp is not in new location yet
929 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
930 my(@tmdeps) = '$(XSUBPPDIR)typemap';
931 if( $self->{TYPEMAPS} ){
933 foreach $typemap (@{$self->{TYPEMAPS}}){
935 warn "Typemap $typemap not found.\n";
938 push(@tmdeps, $self->fixpath($typemap));
942 push(@tmdeps, "typemap") if -f "typemap";
943 my(@tmargs) = map("-typemap $_", @tmdeps);
944 if( exists $self->{XSOPT} ){
945 unshift( @tmargs, $self->{XSOPT} );
948 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
950 # What are the correct thresholds for version 1 && 2 Paul?
951 if ( $xsubpp_version > 1.923 ){
952 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
954 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
955 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
956 Your version of xsubpp is $xsubpp_version and cannot handle this.
957 Please upgrade to a more recent version of xsubpp.
960 $self->{XSPROTOARG} = "";
966 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
967 XSPROTOARG = $self->{XSPROTOARG}
973 =item xsubpp_version (override)
975 Test xsubpp exit status according to VMS rules ($sts & 1 ==E<gt> good)
976 rather than Unix rules ($sts == 0 ==E<gt> good).
982 my($self,$xsubpp) = @_;
984 return '' unless $self->needs_linking;
986 # try to figure out the version number of the xsubpp on the system
988 # first try the -v flag, introduced in 1.921 & 2.000a2
990 my $command = "$self->{PERL} \"-I$self->{PERL_LIB}\" $xsubpp -v";
991 print "Running: $command\n" if $Verbose;
992 $version = `$command` ;
993 warn "Running '$command' exits with status " . $? unless ($? & 1);
996 return $1 if $version =~ /^xsubpp version (.*)/ ;
998 # nope, then try something else
1000 my $counter = '000';
1001 my ($file) = 'temp' ;
1002 $counter++ while -e "$file$counter"; # don't overwrite anything
1006 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
1008 MODULE = fred PACKAGE = fred
1017 $command = "$self->{PERL} $xsubpp $file";
1018 print "Running: $command\n" if $Verbose;
1019 my $text = `$command` ;
1020 warn "Running '$command' exits with status " . $? unless ($? & 1);
1023 # gets 1.2 -> 1.92 and 2.000a1
1024 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
1026 # it is either 1.0 or 1.1
1027 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
1029 # none of the above, so 1.0
1033 =item tools_other (override)
1035 Adds a few MM[SK] macros, and shortens some the installatin commands,
1036 in order to stay under DCL's 255-character limit. Also changes
1037 EQUALIZE_TIMESTAMP to set revision date of target file to one second
1038 later than source file, since MMK interprets precisely equal revision
1039 dates for a source and target file as a sign that the target needs
1047 # Assumes \$(MMS) invokes MMS or MMK
1048 # (It is assumed in some cases later that the default makefile name
1049 # (Descrip.MMS for MM[SK]) is used.)
1050 USEMAKEFILE = /Descrip=
1051 USEMACROS = /Macro=(
1053 MAKEFILE = Descrip.MMS
1055 TOUCH = $self->{TOUCH}
1056 CHMOD = $self->{CHMOD}
1059 RM_F = $self->{RM_F}
1060 RM_RF = $self->{RM_RF}
1061 UMASK_NULL = $self->{UMASK_NULL}
1062 NOOP = $self->{NOOP}
1063 NOECHO = $self->{NOECHO}
1064 MKPATH = Create/Directory
1065 EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])"
1066 !. ($self->{PARENT} ? '' :
1067 qq!WARN_IF_OLD_PACKLIST = \$(PERL) -e "if (-f \$ARGV[0]){print qq[WARNING: Old package found (\$ARGV[0]); please check for collisions\\n]}"
1068 MOD_INSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "install({split(' ',<STDIN>)},1);"
1069 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]"
1070 UNINSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "uninstall(\$ARGV[0],1);"
1074 =item dist (override)
1076 Provide VMSish defaults for some values, then hand off to
1077 default MM_Unix method.
1082 my($self, %attribs) = @_;
1083 $attribs{VERSION} ||= $self->{VERSION_SYM};
1084 $attribs{ZIPFLAGS} ||= '-Vu';
1085 $attribs{COMPRESS} ||= 'gzip';
1086 $attribs{SUFFIX} ||= '-gz';
1087 $attribs{SHAR} ||= 'vms_share';
1088 $attribs{DIST_DEFAULT} ||= 'zipdist';
1090 return ExtUtils::MM_Unix::dist($self,%attribs);
1093 =item c_o (override)
1095 Use VMS syntax on command line. In particular, $(DEFINE) and
1096 $(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros.
1102 return '' unless $self->needs_linking();
1105 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1108 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cpp
1111 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cxx
1116 =item xs_c (override)
1124 return '' unless $self->needs_linking();
1127 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
1131 =item xs_o (override)
1133 Use MM[SK] macros, and VMS command line for C compiler.
1137 sub xs_o { # many makes are too dumb to use xs_c then c_o
1139 return '' unless $self->needs_linking();
1142 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
1143 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1147 =item top_targets (override)
1149 Use VMS quoting on command line for Version_check.
1157 all :: pure_all manifypods
1160 pure_all :: config pm_to_blib subdirs linkext
1163 subdirs :: $(MYEXTLIB)
1166 config :: $(MAKEFILE) $(INST_LIBDIR).exists
1169 config :: $(INST_ARCHAUTODIR).exists
1172 config :: $(INST_AUTODIR).exists
1177 config :: Version_check
1180 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
1183 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
1184 if (%{$self->{MAN1PODS}}) {
1186 config :: $(INST_MAN1DIR).exists
1189 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
1191 if (%{$self->{MAN3PODS}}) {
1193 config :: $(INST_MAN3DIR).exists
1196 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
1200 $(O_FILES) : $(H_FILES)
1201 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
1205 perldoc ExtUtils::MakeMaker
1210 $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1211 "-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')"
1217 =item dlsyms (override)
1219 Create VMS linker options files specifying universal symbols for this
1220 extension's shareable image, and listing other shareable images or
1221 libraries to which it should be linked.
1226 my($self,%attribs) = @_;
1228 return '' unless $self->needs_linking();
1230 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
1231 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
1232 my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
1235 unless ($self->{SKIPHASH}{'dynamic'}) {
1237 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
1241 my($popt) = $self->catfile($srcdir,'perlshr.opt');
1242 my($lopt) = $self->catfile($srcdir,'crtl.opt');
1243 push(@m,"# Depend on \$(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
1244 rtls.opt : $popt $lopt \$(BASEEXT).opt
1245 Copy/Log $popt Sys\$Disk:[]rtls.opt
1246 Append/Log $lopt Sys\$Disk:[]rtls.opt
1251 # rtls.opt is built in the same step as $(BASEEXT).opt
1252 rtls.opt : $(BASEEXT).opt
1253 $(TOUCH) $(MMS$TARGET)
1259 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
1261 ') unless $self->{SKIPHASH}{'static'};
1264 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
1265 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
1267 $(BASEEXT).opt : Makefile.PL
1268 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
1269 ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ],
1270 neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars),')"
1271 $(PERL) -e "print ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)
1277 =item dynamic_lib (override)
1279 Use VMS Link command.
1284 my($self, %attribs) = @_;
1285 return '' unless $self->needs_linking(); #might be because of a subdir
1287 return '' unless $self->has_link_code();
1289 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
1290 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
1294 OTHERLDFLAGS = $otherldflags
1295 INST_DYNAMIC_DEP = $inst_dynamic_dep
1299 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
1300 $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
1301 $(NOECHO) If F$TrnLNm("PerlShr").eqs."" Then Define/NoLog/User PerlShr Sys$Share:PerlShr.Exe
1302 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
1305 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1309 =item dynamic_bs (override)
1311 Use VMS-style quoting on Mkbootstrap command line.
1316 my($self, %attribs) = @_;
1319 ' unless $self->has_link_code();
1321 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
1323 # As MakeMaker mkbootstrap might not write a file (if none is required)
1324 # we use touch to prevent make continually trying to remake it.
1325 # The DynaLoader only reads a non-empty file.
1326 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
1327 $(NOECHO) Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
1328 $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1329 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
1330 $(NOECHO) $(TOUCH) $(MMS$TARGET)
1332 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
1333 $(NOECHO) $(RM_RF) $(INST_BOOT)
1334 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
1338 =item static_lib (override)
1340 Use VMS commands to manipulate object library.
1346 return '' unless $self->needs_linking();
1351 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
1355 # Rely on suffix rule for update action
1356 $(OBJECT) : $(INST_ARCHAUTODIR).exists
1358 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
1360 # If this extension has it's own library (eg SDBM_File)
1361 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
1362 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
1365 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
1366 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
1367 $(NOECHO) $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
1369 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1374 # sub installpm_x { # called by installpm perl file
1375 # my($self, $dist, $inst, $splitlib) = @_;
1376 # if ($inst =~ m!#!) {
1377 # warn "Warning: MM[SK] would have problems processing this file: $inst, SKIPPED\n";
1380 # $inst = $self->fixpath($inst);
1381 # $dist = $self->fixpath($dist);
1382 # my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
1386 # $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
1387 # ",' $(NOECHO) $(RM_F) $(MMS$TARGET)
1388 # $(NOECHO) $(CP) ',"$dist $inst",'
1389 # $(CHMOD) 644 $(MMS$TARGET)
1391 # push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1392 # $self->catdir($splitlib,'auto')."\n\n")
1393 # if ($splitlib and $inst =~ /\.pm$/);
1394 # push(@m,$self->dir_target($instdir));
1399 =item manifypods (override)
1401 Use VMS-style quoting on command line, and VMS logical name
1402 to specify fallback location at build time if we can't find pod2man.
1408 my($self, %attribs) = @_;
1409 return "\nmanifypods :\n\t\$(NOECHO) \$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
1412 if (defined $self->{PERL_SRC}) {
1413 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1415 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
1417 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1419 # No pod2man but some MAN3PODS to be installed
1422 Warning: I could not locate your pod2man program. As a last choice,
1423 I will look for the file to which the logical name POD2MAN
1424 points when MMK is invoked.
1427 $pod2man_exe = "pod2man";
1431 qq[POD2MAN_EXE = $pod2man_exe\n],
1432 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1433 -e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1435 push @m, "\nmanifypods : ";
1436 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1438 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1440 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1441 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1442 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1444 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1445 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1446 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1452 =item processPL (override)
1454 Use VMS-style quoting on command line.
1460 return "" unless $self->{PL_FILES};
1462 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1464 all :: $self->{PL_FILES}->{$plfile}
1467 $self->{PL_FILES}->{$plfile} :: $plfile
1468 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1474 =item installbin (override)
1476 Stay under DCL's 255 character command line limit once again by
1477 splitting potentially long list of files across multiple lines
1478 in C<realclean> target.
1484 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1485 return '' unless @{$self->{EXE_FILES}};
1486 my(@m, $from, $to, %fromto, @to, $line);
1487 for $from (@{$self->{EXE_FILES}}) {
1488 my($path) = '$(INST_SCRIPT)' . basename($from);
1489 local($_) = $path; # backward compatibility
1490 $to = $self->libscan($path);
1491 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1494 @to = values %fromto;
1496 EXE_FILES = @{$self->{EXE_FILES}}
1503 $line = ''; #avoid unitialized var warning
1505 if (length($line) + length($to) > 80) {
1506 push @m, "\t\$(RM_F) $line\n";
1509 else { $line .= " $to"; }
1511 push @m, "\t\$(RM_F) $line\n\n" if $line;
1513 while (($from,$to) = each %fromto) {
1514 last unless defined $from;
1516 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1517 else { ($todir = $to) =~ s/[^\)]+$//; }
1518 $todir = $self->fixpath($todir,1);
1520 $to : $from \$(MAKEFILE) ${todir}.exists
1523 ", $self->dir_target($todir);
1528 =item subdir_x (override)
1530 Use VMS commands to change default directory.
1535 my($self, $subdir) = @_;
1537 $subdir = $self->fixpath($subdir,1);
1541 olddef = F$Environment("Default")
1542 Set Default ',$subdir,'
1543 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1544 Set Default \'olddef\'
1549 =item clean (override)
1551 Split potentially long list of files across multiple commands (in
1552 order to stay under the magic command line limit). Also use MM[SK]
1553 commands for handling subdirectories.
1558 my($self, %attribs) = @_;
1561 # Delete temporary files but do not touch installed files. We don\'t delete
1562 # the Descrip.MMS here so that a later make realclean still has it to use.
1565 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1566 my($vmsdir) = $self->fixpath($dir,1);
1567 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1568 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1570 push @m, ' $(RM_F) *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso .MM_Tmp
1573 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1574 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1575 push(@otherfiles, qw[ blib $(MAKE_APERL_FILE) extralibs.ld perlmain.c pm_to_blib.ts ]);
1576 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1578 $line = ''; #avoid unitialized var warning
1579 foreach $file (@otherfiles) {
1580 $file = $self->fixpath($file);
1581 if (length($line) + length($file) > 80) {
1582 push @m, "\t\$(RM_RF) $line\n";
1585 else { $line .= " $file"; }
1587 push @m, "\t\$(RM_RF) $line\n" if $line;
1588 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1592 =item realclean (override)
1594 Guess what we're working around? Also, use MM[SK] for subdirectories.
1599 my($self, %attribs) = @_;
1602 # Delete temporary files (via clean) and also delete installed files
1605 foreach(@{$self->{DIR}}){
1606 my($vmsdir) = $self->fixpath($_,1);
1607 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1608 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1610 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1612 # We can't expand several of the MMS macros here, since they don't have
1613 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1614 # combination of macros). In order to stay below DCL's 255 char limit,
1615 # we put only 2 on a line.
1616 my($file,$line,$fcnt);
1617 my(@files) = qw{ $(MAKEFILE) $(MAKEFILE)_old };
1618 if ($self->has_link_code) {
1619 push(@files,qw{ $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(OBJECT) });
1621 push(@files, values %{$self->{PM}});
1622 $line = ''; #avoid unitialized var warning
1623 foreach $file (@files) {
1624 $file = $self->fixpath($file);
1625 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1626 push @m, "\t\$(RM_F) $line\n";
1630 else { $line .= " $file"; }
1632 push @m, "\t\$(RM_F) $line\n" if $line;
1633 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1635 foreach $file (@{$attribs{'FILES'}}) {
1636 $file = $self->fixpath($file);
1637 if (length($line) + length($file) > 80) {
1638 push @m, "\t\$(RM_RF) $line\n";
1641 else { $line .= " $file"; }
1643 push @m, "\t\$(RM_RF) $line\n" if $line;
1645 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1649 =item dist_basics (override)
1651 Use VMS-style quoting on command line.
1658 distclean :: realclean distcheck
1662 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1665 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1668 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1672 =item dist_core (override)
1674 Syntax for invoking F<VMS_Share> differs from that for Unix F<shar>,
1675 so C<shdist> target actions are VMS-specific.
1682 dist : $(DIST_DEFAULT)
1683 $(NOECHO) $(PERL) -le "print 'Warning: $m older than $vf' if -e ($vf = '$(VERSION_FROM)') && -M $vf < -M ($m = '$(MAKEFILE)'"
1685 zipdist : $(DISTVNAME).zip
1688 $(DISTVNAME).zip : distdir
1690 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1691 $(RM_RF) $(DISTVNAME)
1694 $(DISTVNAME).tar$(SUFFIX) : distdir
1697 $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar $(SRC)
1698 $(RM_RF) $(DISTVNAME)
1699 $(COMPRESS) $(DISTVNAME).tar
1704 $(SHARE) $(SRC) $(DISTVNAME).share
1705 $(RM_RF) $(DISTVNAME)
1710 =item dist_dir (override)
1712 Use VMS-style quoting on command line.
1720 $(RM_RF) $(DISTVNAME)
1721 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1722 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1726 =item dist_test (override)
1728 Use VMS commands to change default directory, and use VMS-style
1729 quoting on command line.
1737 startdir = F$Environment("Default")
1738 Set Default [.$(DISTVNAME)]
1739 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1742 Set Default 'startdir'
1746 # --- Test and Installation Sections ---
1748 =item install (override)
1750 Work around DCL's 255 character limit several times,and use
1751 VMS-style command line quoting in a few cases.
1756 my($self, %attribs) = @_;
1759 if ($self->{EXE_FILES}) {
1760 my($line,$file) = ('','');
1761 foreach $file (@{$self->{EXE_FILES}}) {
1763 if (length($line) > 128) {
1764 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]);
1768 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]) if $line;
1772 install :: all pure_install doc_install
1775 install_perl :: all pure_perl_install doc_perl_install
1778 install_site :: all pure_site_install doc_site_install
1781 install_ :: install_site
1782 $(NOECHO) Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1784 pure_install :: pure_$(INSTALLDIRS)_install
1787 doc_install :: doc_$(INSTALLDIRS)_install
1788 $(NOECHO) Write Sys$Output "Appending installation info to $(INSTALLARCHLIB)perllocal.pod"
1790 pure__install : pure_site_install
1791 $(NOECHO) Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1793 doc__install : doc_site_install
1794 $(NOECHO} Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1796 # This hack brought to you by DCL's 255-character command line limit
1797 pure_perl_install ::
1798 $(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1799 $(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1800 $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLPRIVLIB) '" >>.MM_tmp
1801 $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLARCHLIB) '" >>.MM_tmp
1802 $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp
1803 $(NOECHO) $(PERL) -e "print '$(INST_SCRIPT) $(INSTALLSCRIPT) '" >>.MM_tmp
1804 $(NOECHO) $(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1805 $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1806 $(MOD_INSTALL) <.MM_tmp
1807 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
1808 $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[
1811 pure_site_install ::
1812 $(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1813 $(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1814 $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLSITELIB) '" >>.MM_tmp
1815 $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLSITEARCH) '" >>.MM_tmp
1816 $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp
1817 $(NOECHO) $(PERL) -e "print '$(INST_SCRIPT) $(INSTALLSCRIPT) '" >>.MM_tmp
1818 $(NOECHO) $(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1819 $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1820 $(MOD_INSTALL) <.MM_tmp
1821 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
1822 $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1826 $(NOECHO) $(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLPRIVLIB)|'" >.MM_tmp
1827 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1828 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1830 q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,<STDIN>);]" >.MM2_tmp
1831 $(NOECHO) $(PERL) -e "print q[print '=head3 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
1832 $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp
1833 $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
1834 $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1835 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp;
1839 $(NOECHO) $(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLSITELIB)|'" >.MM_tmp
1840 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1841 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1843 q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,<STDIN>);]" >.MM2_tmp
1844 $(NOECHO) $(PERL) -e "print q[print '=head3 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
1845 $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp
1846 $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
1847 $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1848 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp;
1853 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1856 uninstall_from_perldirs ::
1857 $(NOECHO) $(UNINSTALL) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1859 uninstall_from_sitedirs ::
1860 $(NOECHO) $(UNINSTALL) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')."\n";
1865 =item perldepend (override)
1867 Use VMS-style syntax for files; it's cheaper to just do it directly here
1868 than to have the MM_Unix method call C<catfile> repeatedly. Also use
1869 config.vms as source of original config data if the Perl distribution
1870 is available; config.sh is an ancillary file under VMS. Finally, if
1871 we have to rebuild Config.pm, use MM[SK] to do it.
1880 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1881 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1882 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1883 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1884 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1885 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1886 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1888 ' if $self->{OBJECT};
1890 if ($self->{PERL_SRC}) {
1892 my($mmsquals) = '$(USEMAKEFILE)[.vms]$(MAKEFILE)';
1893 push(@macros,'__AXP__=1') if $Config{'arch'} eq 'VMS_AXP';
1894 push(@macros,'DECC=1') if $Config{'vms_cc_type'} eq 'decc';
1895 push(@macros,'GNUC=1') if $Config{'vms_cc_type'} eq 'gcc';
1896 push(@macros,'SOCKET=1') if $Config{'d_has_sockets'};
1897 push(@macros,qq["CC=$Config{'cc'}"]) if $Config{'cc'} =~ m!/!;
1898 $mmsquals .= '$(USEMACROS)' . join(',',@macros) . '$(MACROEND)' if @macros;
1900 # Check for unpropagated config.sh changes. Should never happen.
1901 # We do NOT just update config.h because that is not sufficient.
1902 # An out of date config.h is not fatal but complains loudly!
1903 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1904 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1905 $(NOECHO) Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1907 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1908 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1909 $(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1910 olddef = F$Environment("Default")
1911 Set Default $(PERL_SRC)
1912 $(MMS)],$mmsquals,q[ $(MMS$TARGET)
1913 Set Default 'olddef'
1917 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1923 =item makefile (override)
1925 Use VMS commands and quoting.
1932 # We do not know what target was originally specified so we
1933 # must force a manual rerun to be sure. But as it should only
1934 # happen very rarely it is not a significant problem.
1936 $(OBJECT) : $(FIRST_MAKEFILE)
1937 ] if $self->{OBJECT};
1940 # We take a very conservative approach here, but it\'s worth it.
1941 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1942 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1943 $(NOECHO) Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1944 $(NOECHO) Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1945 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1946 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1947 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[
1948 $(NOECHO) Write Sys$Output "$(MAKEFILE) has been rebuilt."
1949 $(NOECHO) Write Sys$Output "Please run $(MMS) to build the extension."
1955 =item test (override)
1957 Use VMS commands for handling subdirectories.
1962 my($self, %attribs) = @_;
1963 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1967 TEST_TYPE = test_\$(LINKTYPE)
1971 test :: \$(TEST_TYPE)
1974 testdb :: testdb_\$(LINKTYPE)
1978 foreach(@{$self->{DIR}}){
1979 my($vmsdir) = $self->fixpath($_,1);
1980 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1981 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1983 push(@m, "\t\$(NOECHO) Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
1984 unless $tests or -f "test.pl" or @{$self->{DIR}};
1987 push(@m, "test_dynamic :: pure_all\n");
1988 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1989 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1990 push(@m, "\t\$(NOECHO) \$(NOOP)\n") if (!$tests && ! -f "test.pl");
1993 push(@m, "testdb_dynamic :: pure_all\n");
1994 push(@m, $self->test_via_script('$(FULLPERL) "$(TESTDB_SW)"', '$(TEST_FILE)'));
1997 # Occasionally we may face this degenerate target:
1998 push @m, "test_ : test_dynamic\n\n";
2000 if ($self->needs_linking()) {
2001 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
2002 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
2003 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f 'test.pl';
2005 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
2006 push(@m, $self->test_via_script('$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
2010 push @m, "test_static :: test_dynamic\n\t\$(NOECHO) \$(NOOP)\n\n";
2011 push @m, "testdb_static :: testdb_dynamic\n\t\$(NOECHO) \$(NOOP)\n";
2017 =item test_via_harness (override)
2019 Use VMS-style quoting on command line.
2023 sub test_via_harness {
2024 my($self,$perl,$tests) = @_;
2025 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
2026 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
2029 =item test_via_script (override)
2031 Use VMS-style quoting on command line.
2035 sub test_via_script {
2036 my($self,$perl,$script) = @_;
2037 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '.$script.'
2041 =item makeaperl (override)
2043 Undertake to build a new set of Perl images using VMS commands. Since
2044 VMS does dynamic loading, it's not necessary to statically link each
2045 extension into the Perl image, so this isn't the normal build path.
2046 Consequently, it hasn't really been tested, and may well be incomplete.
2051 my($self, %attribs) = @_;
2052 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2053 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2056 # --- MakeMaker makeaperl section ---
2057 MAP_TARGET = $target
2059 return join '', @m if $self->{PARENT};
2061 my($dir) = join ":", @{$self->{DIR}};
2063 unless ($self->{MAKEAPERL}) {
2065 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
2066 $(NOECHO) Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
2067 $(NOECHO) $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
2068 Makefile.PL DIR=}, $dir, q{ \
2069 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2070 MAKEAPERL=1 NORECURS=1
2072 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
2073 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
2075 push @m, map( " \\\n\t\t$_", @ARGV );
2082 my($linkcmd,@staticopts,@staticpkgs,$extralist,$targdir,$libperldir);
2084 # The front matter of the linkcommand...
2085 $linkcmd = join ' ', $Config{'ld'},
2086 grep($_, @Config{qw(large split ldflags ccdlflags)});
2087 $linkcmd =~ s/\s+/ /g;
2089 # Which *.olb files could we make use of...
2091 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
2093 File::Find::find(sub {
2094 return unless m/\Q$self->{LIB_EXT}\E$/;
2095 return if m/^libperl/;
2097 if( exists $self->{INCLUDE_EXT} ){
2102 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2106 # Throw away anything not explicitly marked for inclusion.
2107 # DynaLoader is implied.
2108 foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2114 return unless $found;
2116 elsif( exists $self->{EXCLUDE_EXT} ){
2120 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2124 # Throw away anything explicitly marked for exclusion
2125 foreach $excl (@{$self->{EXCLUDE_EXT}}){
2126 return if( $xx eq $excl );
2130 $olbs{$ENV{DEFAULT}} = $_;
2131 }, grep( -d $_, @{$searchdirs || []}));
2133 # We trust that what has been handed in as argument will be buildable
2134 $static = [] unless $static;
2135 @olbs{@{$static}} = (1) x @{$static};
2137 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2138 # Sort the object libraries in inverse order of
2139 # filespec length to try to insure that dependent extensions
2140 # will appear before their parents, so the linker will
2141 # search the parent library to resolve references.
2142 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
2143 # references from [.intuit.dwim]dwim.obj can be found
2144 # in [.intuit]intuit.olb).
2145 for (sort keys %olbs) {
2146 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
2147 my($dir) = $self->fixpath($_,1);
2148 my($extralibs) = $dir . "extralibs.ld";
2149 my($extopt) = $dir . $olbs{$_};
2150 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
2151 if (-f $extralibs ) {
2152 open LIST,$extralibs or warn $!,next;
2153 push @$extra, <LIST>;
2157 open OPT,$extopt or die $!;
2159 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
2160 # ExtUtils::Miniperl expects Unix paths
2161 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
2162 push @staticpkgs,$pkg;
2164 push @staticopts, $extopt;
2168 $target = "Perl.Exe" unless $target;
2169 ($shrtarget,$targdir) = fileparse($target);
2170 $shrtarget =~ s/^([^.]*)/$1Shr/;
2171 $shrtarget = $targdir . $shrtarget;
2172 $target = "Perlshr.$Config{'dlext'}" unless $target;
2173 $tmp = "[]" unless $tmp;
2174 $tmp = $self->fixpath($tmp,1);
2176 $extralist = join(' ',@$extra);
2177 $extralist =~ s/[,\s\n]+/, /g;
2179 else { $extralist = ''; }
2181 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
2182 print STDOUT "Warning: $libperl not found\n";
2187 if (defined $self->{PERL_SRC}) {
2188 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
2189 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
2191 print STDOUT "Warning: $libperl not found
2192 If you're going to build a static perl binary, make sure perl is installed
2193 otherwise ignore this warning\n";
2196 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
2199 # Fill in the target you want to produce if it\'s not perl
2200 MAP_TARGET = ',$self->fixpath($target),'
2201 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
2202 MAP_LINKCMD = $linkcmd
2203 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
2204 # We use the linker options files created with each extension, rather than
2205 #specifying the object files directly on the command line.
2206 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
2207 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
2208 MAP_EXTRA = $extralist
2209 MAP_LIBPERL = ",$self->fixpath($libperl),'
2214 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
2215 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
2216 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
2217 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
2218 $(NOECHO) Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
2219 $(NOECHO) Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
2220 $(NOECHO) Write Sys$Output "To remove the intermediate files, say
2221 $(NOECHO) Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
2224 ',"${tmp}perlmain.c",' : $(MAKEFILE)
2225 $(NOECHO) $(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
2229 # More from the 255-char line length limit
2231 $(NOECHO) $(PERL) -e "print 'Perl binary $(MAP_TARGET)|'" >.MM_tmp
2232 $(NOECHO) $(PERL) -e "print 'MAP_STATIC|$(MAP_STATIC)|'" >>.MM_tmp
2233 $(NOECHO) $(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp
2234 $(NOECHO) $(PERL) -e "print 'MAP_LIBPERL|$(MAP_LIBPERL)|'" >>.MM_tmp
2235 $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
2236 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
2240 inst_perl : pure_inst_perl doc_inst_perl
2243 pure_inst_perl : \$(MAP_TARGET)
2244 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
2245 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
2251 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
2252 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
2258 =item ext (specific)
2260 Stub routine standing in for C<ExtUtils::LibList::ext> until VMS
2261 support is added to that package.
2270 # --- Output postprocessing section ---
2272 =item nicetext (override)
2274 Insure that colons marking targets are preceded by space, in order
2275 to distinguish the target delimiter from a colon appearing as
2282 my($self,$text) = @_;
2283 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;