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 (22-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::ext;
198 sub ExtUtils::MM_VMS::guess_name;
199 sub ExtUtils::MM_VMS::find_perl;
200 sub ExtUtils::MM_VMS::path;
201 sub ExtUtils::MM_VMS::maybe_command;
202 sub ExtUtils::MM_VMS::maybe_command_in_dirs;
203 sub ExtUtils::MM_VMS::perl_script;
204 sub ExtUtils::MM_VMS::file_name_is_absolute;
205 sub ExtUtils::MM_VMS::replace_manpage_separator;
206 sub ExtUtils::MM_VMS::init_others;
207 sub ExtUtils::MM_VMS::constants;
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";
272 # This isn't really an override. It's just here because ExtUtils::MM_VMS
273 # appears in @MM::ISA before ExtUtils::Liblist, so if there isn't an ext()
274 # in MM_VMS, then AUTOLOAD is called, and bad things happen. So, we just
275 # mimic inheritance here and hand off to ExtUtils::Liblist.
277 ExtUtils::Liblist::ext(@_);
281 =head2 SelfLoaded methods
283 Those methods which override default MM_Unix methods are marked
284 "(override)", while methods unique to MM_VMS are marked "(specific)".
285 For overridden methods, documentation is limited to an explanation
286 of why this method overrides the MM_Unix method; see the ExtUtils::MM_Unix
287 documentation for more details.
289 =item guess_name (override)
291 Try to determine name of extension being built. We begin with the name
292 of the current directory. Since VMS filenames are case-insensitive,
293 however, we look for a F<.pm> file whose name matches that of the current
294 directory (presumably the 'main' F<.pm> file for this extension), and try
295 to find a C<package> statement from which to obtain the Mixed::Case
302 my($defname,$defpm,@pm,%xs,$pm);
305 $defname = basename(fileify($ENV{'DEFAULT'}));
306 $defname =~ s![\d\-_]*\.dir.*$!!; # Clip off .dir;1 suffix, and package version
308 # Fallback in case for some reason a user has copied the files for an
309 # extension into a working directory whose name doesn't reflect the
310 # extension's name. We'll use the name of a unique .pm file, or the
311 # first .pm file with a matching .xs file.
312 if (not -e "${defpm}.pm") {
313 @pm = map { s/.pm$//; $_ } glob('*.pm');
314 if (@pm == 1) { ($defpm = $pm[0]) =~ s/.pm$//; }
316 %xs = map { s/.xs$//; ($_,1) } glob('*.xs');
317 if (%xs) { foreach $pm (@pm) { $defpm = $pm, last if exists $xs{$pm}; } }
320 if (open(PM,"${defpm}.pm")){
322 if (/^\s*package\s+([^;]+)/i) {
327 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
328 "defaulting package name to $defname\n"
333 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
334 "defaulting package name to $defname\n";
336 $defname =~ s#[\d.\-_]+$##;
340 =item find_perl (override)
342 Use VMS file specification syntax and CLI commands to find and
348 my($self, $ver, $names, $dirs, $trace) = @_;
349 my($name,$dir,$vmsfile,@sdirs,@snames,@cand);
351 # Check in relative directories first, so we pick up the current
352 # version of Perl if we're running MakeMaker as part of the main build.
353 @sdirs = sort { my($absa) = $self->file_name_is_absolute($a);
354 my($absb) = $self->file_name_is_absolute($b);
355 if ($absa && $absb) { return $a cmp $b }
356 else { return $absa ? 1 : ($absb ? -1 : ($a cmp $b)); }
358 # Check miniperl before perl, and check names likely to contain
359 # version numbers before "generic" names, so we pick up an
360 # executable that's less likely to be from an old installation.
361 @snames = sort { my($ba) = $a =~ m!([^:>\]/]+)$!; # basename
362 my($bb) = $b =~ m!([^:>\]/]+)$!;
363 my($ahasdir) = (length($a) - length($ba) > 0);
364 my($bhasdir) = (length($b) - length($bb) > 0);
365 if ($ahasdir and not $bhasdir) { return 1; }
366 elsif ($bhasdir and not $ahasdir) { return -1; }
367 else { $bb =~ /\d/ <=> $ba =~ /\d/
368 or substr($ba,0,1) cmp substr($bb,0,1)
369 or length($bb) <=> length($ba) } } @$names;
370 # Image names containing Perl version use '_' instead of '.' under VMS
371 foreach $name (@snames) { $name =~ s/\.(\d+)$/_$1/; }
373 print "Looking for perl $ver by these names:\n";
374 print "\t@snames,\n";
375 print "in these dirs:\n";
378 foreach $dir (@sdirs){
379 next unless defined $dir; # $self->{PERL_SRC} may be undefined
380 $inabs++ if $self->file_name_is_absolute($dir);
382 # We've covered relative dirs; everything else is an absolute
383 # dir (probably an installed location). First, we'll try potential
384 # command names, to see whether we can avoid a long MCR expression.
385 foreach $name (@snames) { push(@cand,$name) if $name =~ /^[\w\-\$]+$/; }
386 $inabs++; # Should happen above in next $dir, but just in case . . .
388 foreach $name (@snames){
389 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
390 else { push(@cand,$self->fixpath($name)); }
393 foreach $name (@cand) {
394 print "Checking $name\n" if ($trace >= 2);
395 # If it looks like a potential command, try it without the MCR
396 if ($name =~ /^[\w\-\$]+$/ &&
397 `$name -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
398 print "Using PERL=$name\n" if $trace;
401 next unless $vmsfile = $self->maybe_command($name);
402 $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
403 print "Executing $vmsfile\n" if ($trace >= 2);
404 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
405 print "Using PERL=MCR $vmsfile\n" if $trace;
406 return "MCR $vmsfile";
409 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
410 0; # false and not empty
413 =item path (override)
415 Translate logical name DCL$PATH as a searchlist, rather than trying
416 to C<split> string value of C<$ENV{'PATH'}>.
422 while ($dir = $ENV{'DCL$PATH;' . $i++}) { push(@dirs,$dir); }
426 =item maybe_command (override)
428 Follows VMS naming conventions for executable files.
429 If the name passed in doesn't exactly match an executable file,
430 appends F<.Exe> to check for executable image, and F<.Com> to check
431 for DCL procedure. If this fails, checks F<Sys$Share:> for an
432 executable file having the name specified. Finally, appends F<.Exe>
438 my($self,$file) = @_;
439 return $file if -x $file && ! -d _;
440 return "$file.exe" if -x "$file.exe";
441 return "$file.com" if -x "$file.com";
442 if ($file !~ m![/:>\]]!) {
443 my($shrfile) = 'Sys$Share:' . $file;
444 return $file if -x $shrfile && ! -d _;
445 return "$file.exe" if -x "$shrfile.exe";
450 =item maybe_command_in_dirs (override)
452 Uses DCL argument quoting on test command line.
456 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
457 my($self, $names, $dirs, $trace, $ver) = @_;
459 foreach $dir (@$dirs){
460 next unless defined $dir; # $self->{PERL_SRC} may be undefined
461 foreach $name (@$names){
463 if ($self->file_name_is_absolute($name)) {
466 $abs = $self->catfile($dir, $name);
468 print "Checking $abs for $name\n" if ($trace >= 2);
469 next unless $tryabs = $self->maybe_command($abs);
470 print "Substituting $tryabs instead of $abs\n"
471 if ($trace >= 2 and $tryabs ne $abs);
474 print "Executing $abs\n" if ($trace >= 2);
475 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
476 print "Using $abs\n" if $trace;
479 } else { # Do not look for perl
486 =item perl_script (override)
488 If name passed in doesn't specify a readable file, appends F<.pl> and
489 tries again, since it's customary to have file types on all files
495 my($self,$file) = @_;
496 return $file if -r $file && ! -d _;
497 return "$file.pl" if -r "$file.pl" && ! -d _;
501 =item file_name_is_absolute (override)
503 Checks for VMS directory spec as well as Unix separators.
507 sub file_name_is_absolute {
508 my($self,$file) = @_;
509 $file =~ m!^/! or $file =~ m![<\[][^.\-\]>]! or $file =~ /:[^<\[]/;
512 =item replace_manpage_separator
514 Use as separator a character which is legal in a VMS-syntax file name.
518 sub replace_manpage_separator {
520 $man = unixify($man);
525 =item init_others (override)
527 Provide VMS-specific forms of various utility commands, then hand
528 off to the default MM_Unix method.
535 $self->{NOOP} = 'Continue';
536 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
537 $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
538 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
539 $self->{NOECHO} ||= '@ ';
540 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
541 $self->{RM_RF} = '$(PERL) "-I$(PERL_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
542 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
543 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
544 $self->{CP} = 'Copy/NoConfirm';
545 $self->{MV} = 'Rename/NoConfirm';
546 $self->{UMASK_NULL} = '! ';
547 &ExtUtils::MM_Unix::init_others;
550 =item constants (override)
552 Fixes up numerous file and directory macros to insure VMS syntax
553 regardless of input syntax. Also adds a few VMS-specific macros
554 and makes lists of files comma-separated.
562 if ($self->{DEFINE} ne '') {
563 my(@defs) = split(/\s+/,$self->{DEFINE});
564 foreach $def (@defs) {
567 $def = "\"$def\"" if $def =~ /=/;
569 $self->{DEFINE} = join ',',@defs;
572 if ($self->{OBJECT} =~ /\s/) {
573 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
574 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
576 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
579 # Fix up directory specs
580 $self->{ROOTEXT} = $self->{ROOTEXT} ? $self->fixpath($self->{ROOTEXT},1)
582 foreach $macro ( qw [
583 INST_BIN INST_SCRIPT INST_LIB INST_ARCHLIB INST_EXE INSTALLPRIVLIB
584 INSTALLARCHLIB INSTALLSCRIPT INSTALLBIN PERL_LIB PERL_ARCHLIB
585 PERL_INC PERL_SRC FULLEXT INST_MAN1DIR INSTALLMAN1DIR
586 INST_MAN3DIR INSTALLMAN3DIR INSTALLSITELIB INSTALLSITEARCH
587 SITELIBEXP SITEARCHEXP ] ) {
588 next unless defined $self->{$macro};
589 $self->{$macro} = $self->fixpath($self->{$macro},1);
591 $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC},q(VMS))
592 if ($self->{PERL_SRC});
597 foreach $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKE_APERL_FILE MYEXTLIB] ) {
598 next unless defined $self->{$macro};
599 $self->{$macro} = $self->fixpath($self->{$macro});
603 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION
604 INST_BIN INST_EXE INST_LIB INST_ARCHLIB INST_SCRIPT PREFIX
605 INSTALLDIRS INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
606 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
607 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
608 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_VMS
609 PERL_INC PERL FULLPERL
611 next unless defined $self->{$macro};
612 push @m, "$macro = $self->{$macro}\n";
617 VERSION_MACRO = VERSION
618 DEFINE_VERSION = "$(VERSION_MACRO)=""$(VERSION)"""
619 XS_VERSION_MACRO = XS_VERSION
620 XS_DEFINE_VERSION = "$(XS_VERSION_MACRO)=""$(XS_VERSION)"""
622 MAKEMAKER = ],$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),qq[
623 MM_VERSION = $ExtUtils::MakeMaker::VERSION
624 MM_REVISION = $ExtUtils::MakeMaker::Revision
625 MM_VMS_REVISION = $ExtUtils::MM_VMS::Revision
627 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
628 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
629 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
630 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
634 FULLEXT VERSION_FROM OBJECT LDFROM
636 next unless defined $self->{$tmp};
637 push @m, "$tmp = ",$self->fixpath($self->{$tmp}),"\n";
641 BASEEXT PARENT_NAME DLBASE INC DEFINE LINKTYPE
643 next unless defined $self->{$tmp};
644 push @m, "$tmp = $self->{$tmp}\n";
647 for $tmp (qw/ XS MAN1PODS MAN3PODS PM /) {
648 next unless defined $self->{$tmp};
650 for $key (keys %{$self->{$tmp}}) {
651 $tmp{$self->fixpath($key)} = $self->fixpath($self->{$tmp}{$key});
653 $self->{$tmp} = \%tmp;
656 for $tmp (qw/ C O_FILES H /) {
657 next unless defined $self->{$tmp};
659 for $val (@{$self->{$tmp}}) {
660 push(@tmp,$self->fixpath($val));
662 $self->{$tmp} = \@tmp;
667 # Handy lists of source code files:
668 XS_FILES = ',join(', ', sort keys %{$self->{XS}}),'
669 C_FILES = ',join(', ', @{$self->{C}}),'
670 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
671 H_FILES = ',join(', ', @{$self->{H}}),'
672 MAN1PODS = ',join(', ', sort keys %{$self->{MAN1PODS}}),'
673 MAN3PODS = ',join(', ', sort keys %{$self->{MAN3PODS}}),'
678 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
680 next unless defined $self->{$tmp};
681 push @m, "$tmp = $self->{$tmp}\n";
685 .SUFFIXES : \$(OBJ_EXT) .c .cpp .cxx .xs
687 # Here is the Config.pm that we are using/depend on
688 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
690 # Where to put things:
691 INST_LIBDIR = $self->{INST_LIBDIR}
692 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
694 INST_AUTODIR = $self->{INST_AUTODIR}
695 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
698 if ($self->has_link_code()) {
700 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
701 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
702 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
709 EXPORT_LIST = $(BASEEXT).opt
710 PERL_ARCHIVE = ',($ENV{'PERLSHR'} ? $ENV{'PERLSHR'} : 'Sys$Share:PerlShr.Exe'),'
714 $self->{TO_INST_PM} = [ sort keys %{$self->{PM}} ];
715 $self->{PM_TO_BLIB} = [ %{$self->{PM}} ];
717 TO_INST_PM = ',join(', ',@{$self->{TO_INST_PM}}),'
719 PM_TO_BLIB = ',join(', ',@{$self->{PM_TO_BLIB}}),'
725 =item cflags (override)
727 Bypass shell script and produce qualifiers for CC directly (but warn
728 user if a shell script for this extension exists). Fold multiple
729 /Defines into one, since some C compilers pay attention to only one
730 instance of this qualifier on the command line.
735 my($self,$libperl) = @_;
736 my($quals) = $Config{'ccflags'};
738 my($optimize) = '/Optimize';
740 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
741 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
742 " required to modify CC command for $self->{'BASEEXT'}\n"
745 # Deal with $self->{DEFINE} here since some C compilers pay attention
746 # to only one /Define clause on command line, so we have to
747 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
748 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
749 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
750 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
753 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
754 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
757 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
758 if ($libperl =~ /libperl(\w+)\./i) {
760 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
761 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
762 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
763 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
766 # Likewise with $self->{INC} and /Include
767 my($incstr) = '/Include=($(PERL_INC)';
768 if ($self->{'INC'}) {
769 my(@includes) = split(/\s+/,$self->{INC});
770 foreach (@includes) {
772 $incstr .= ', '.$self->fixpath($_,1);
775 $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 E<lt>sys/foo.hE<gt> directives. Also constructs CC
793 command line a bit differently than MM_Unix method.
798 my($self,$libperl) = @_;
801 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
802 return '' unless $self->needs_linking();
803 if ($Config{'vms_cc_type'} eq 'gcc') {
806 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS GNU_CC_Include:[VMS]';
808 elsif ($Config{'vms_cc_type'} eq 'vaxc') {
811 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library
812 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include';
817 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ',
818 ($Config{'arch'} eq 'VMS_AXP' ? 'Sys$Library' : 'DECC$Library_Include'),'
819 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include';
822 push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n");
824 $self->{CONST_CCCMD} = join('',@m);
827 =item pm_to_blib (override)
829 DCL I<still> accepts a maximum of 255 characters on a command
830 line, so we write the (potentially) long list of file names
831 to a temp file, then persuade Perl to read it instead of the
832 command line to find args.
838 my($line,$from,$to,@m);
839 my($autodir) = $self->catdir('$(INST_LIB)','auto');
840 my(@files) = @{$self->{PM_TO_BLIB}};
844 # Dummy target to match Unix target name; we use pm_to_blib.ts as
845 # timestamp file to avoid repeated invocations under VMS
846 pm_to_blib : pm_to_blib.ts
849 # As always, keep under DCL's 255-char limit
850 pm_to_blib.ts : $(TO_INST_PM)
851 $(NOECHO) $(PERL) -e "print '},shift(@files),q{ },shift(@files),q{'" >.MM_tmp
854 $line = ''; # avoid uninitialized var warning
855 while ($from = shift(@files),$to = shift(@files)) {
856 $line .= " $from $to";
857 if (length($line) > 128) {
858 push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n");
862 push(@m,"\t\$(NOECHO) \$(PERL) -e \"print '$line'\" >>.MM_tmp\n") if $line;
864 push(@m,q[ $(PERL) "-I$(PERL_LIB)" "-MExtUtils::Install" -e "pm_to_blib({split(' ',<STDIN>)},'].$autodir.q[')" <.MM_tmp]);
866 \$(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
867 \$(NOECHO) \$(TOUCH) pm_to_blib.ts
873 =item tool_autosplit (override)
875 Use VMS-style quoting on command line.
880 my($self, %attribs) = @_;
882 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
884 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
885 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
889 =item tool_sxubpp (override)
891 Use VMS-style quoting on xsubpp command line.
897 return '' unless $self->needs_linking;
898 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
899 # drop back to old location if xsubpp is not in new location yet
900 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
901 my(@tmdeps) = '$(XSUBPPDIR)typemap';
902 if( $self->{TYPEMAPS} ){
904 foreach $typemap (@{$self->{TYPEMAPS}}){
906 warn "Typemap $typemap not found.\n";
909 push(@tmdeps, $self->fixpath($typemap));
913 push(@tmdeps, "typemap") if -f "typemap";
914 my(@tmargs) = map("-typemap $_", @tmdeps);
915 if( exists $self->{XSOPT} ){
916 unshift( @tmargs, $self->{XSOPT} );
919 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
921 # What are the correct thresholds for version 1 && 2 Paul?
922 if ( $xsubpp_version > 1.923 ){
923 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
925 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
926 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
927 Your version of xsubpp is $xsubpp_version and cannot handle this.
928 Please upgrade to a more recent version of xsubpp.
931 $self->{XSPROTOARG} = "";
937 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
938 XSPROTOARG = $self->{XSPROTOARG}
944 =item xsubpp_version (override)
946 Test xsubpp exit status according to VMS rules ($sts & 1 ==E<gt> good)
947 rather than Unix rules ($sts == 0 ==E<gt> good).
953 my($self,$xsubpp) = @_;
955 return '' unless $self->needs_linking;
957 # try to figure out the version number of the xsubpp on the system
959 # first try the -v flag, introduced in 1.921 & 2.000a2
961 my $command = "$self->{PERL} \"-I$self->{PERL_LIB}\" $xsubpp -v";
962 print "Running: $command\n" if $Verbose;
963 $version = `$command` ;
964 warn "Running '$command' exits with status " . $? unless ($? & 1);
967 return $1 if $version =~ /^xsubpp version (.*)/ ;
969 # nope, then try something else
972 my ($file) = 'temp' ;
973 $counter++ while -e "$file$counter"; # don't overwrite anything
977 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
979 MODULE = fred PACKAGE = fred
988 $command = "$self->{PERL} $xsubpp $file";
989 print "Running: $command\n" if $Verbose;
990 my $text = `$command` ;
991 warn "Running '$command' exits with status " . $? unless ($? & 1);
994 # gets 1.2 -> 1.92 and 2.000a1
995 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
997 # it is either 1.0 or 1.1
998 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
1000 # none of the above, so 1.0
1004 =item tools_other (override)
1006 Adds a few MM[SK] macros, and shortens some the installatin commands,
1007 in order to stay under DCL's 255-character limit. Also changes
1008 EQUALIZE_TIMESTAMP to set revision date of target file to one second
1009 later than source file, since MMK interprets precisely equal revision
1010 dates for a source and target file as a sign that the target needs
1018 # Assumes \$(MMS) invokes MMS or MMK
1019 # (It is assumed in some cases later that the default makefile name
1020 # (Descrip.MMS for MM[SK]) is used.)
1021 USEMAKEFILE = /Descrip=
1022 USEMACROS = /Macro=(
1024 MAKEFILE = Descrip.MMS
1026 TOUCH = $self->{TOUCH}
1027 CHMOD = $self->{CHMOD}
1030 RM_F = $self->{RM_F}
1031 RM_RF = $self->{RM_RF}
1032 UMASK_NULL = $self->{UMASK_NULL}
1033 NOOP = $self->{NOOP}
1034 NOECHO = $self->{NOECHO}
1035 MKPATH = Create/Directory
1036 EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,qq{>\$ARGV[1]};close F;utime(0,(stat(\$ARGV[0]))[9]+1,\$ARGV[1])"
1037 !. ($self->{PARENT} ? '' :
1038 qq!WARN_IF_OLD_PACKLIST = \$(PERL) -e "if (-f \$ARGV[0]){print qq[WARNING: Old package found (\$ARGV[0]); please check for collisions\\n]}"
1039 MOD_INSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "install({split(' ',<STDIN>)},1);"
1040 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]"
1041 UNINSTALL = \$(PERL) "-I\$(PERL_LIB)" "-MExtUtils::Install" -e "uninstall(\$ARGV[0],1);"
1045 =item dist (override)
1047 Provide VMSish defaults for some values, then hand off to
1048 default MM_Unix method.
1053 my($self, %attribs) = @_;
1054 $attribs{VERSION} ||= $self->{VERSION_SYM};
1055 $attribs{ZIPFLAGS} ||= '-Vu';
1056 $attribs{COMPRESS} ||= 'gzip';
1057 $attribs{SUFFIX} ||= '-gz';
1058 $attribs{SHAR} ||= 'vms_share';
1059 $attribs{DIST_DEFAULT} ||= 'zipdist';
1061 return ExtUtils::MM_Unix::dist($self,%attribs);
1064 =item c_o (override)
1066 Use VMS syntax on command line. In particular, $(DEFINE) and
1067 $(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros.
1073 return '' unless $self->needs_linking();
1076 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1079 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cpp
1082 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cxx
1087 =item xs_c (override)
1095 return '' unless $self->needs_linking();
1098 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
1102 =item xs_o (override)
1104 Use MM[SK] macros, and VMS command line for C compiler.
1108 sub xs_o { # many makes are too dumb to use xs_c then c_o
1110 return '' unless $self->needs_linking();
1113 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
1114 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
1118 =item top_targets (override)
1120 Use VMS quoting on command line for Version_check.
1128 all :: pure_all manifypods
1131 pure_all :: config pm_to_blib subdirs linkext
1134 subdirs :: $(MYEXTLIB)
1137 config :: $(MAKEFILE) $(INST_LIBDIR).exists
1140 config :: $(INST_ARCHAUTODIR).exists
1143 config :: $(INST_AUTODIR).exists
1148 config :: Version_check
1151 } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC};
1154 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
1155 if (%{$self->{MAN1PODS}}) {
1157 config :: $(INST_MAN1DIR).exists
1160 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
1162 if (%{$self->{MAN3PODS}}) {
1164 config :: $(INST_MAN3DIR).exists
1167 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
1171 $(O_FILES) : $(H_FILES)
1172 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
1176 perldoc ExtUtils::MakeMaker
1181 $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1182 "-MExtUtils::MakeMaker=Version_check" -e "&Version_check('$(MM_VERSION)')"
1188 =item dlsyms (override)
1190 Create VMS linker options files specifying universal symbols for this
1191 extension's shareable image, and listing other shareable images or
1192 libraries to which it should be linked.
1197 my($self,%attribs) = @_;
1199 return '' unless $self->needs_linking();
1201 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
1202 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
1203 my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
1206 unless ($self->{SKIPHASH}{'dynamic'}) {
1208 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
1212 my($popt) = $self->catfile($srcdir,'perlshr.opt');
1213 my($lopt) = $self->catfile($srcdir,'crtl.opt');
1214 push(@m,"# Depend on \$(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
1215 rtls.opt : $popt $lopt \$(BASEEXT).opt
1216 Copy/Log $popt Sys\$Disk:[]rtls.opt
1217 Append/Log $lopt Sys\$Disk:[]rtls.opt
1222 # rtls.opt is built in the same step as $(BASEEXT).opt
1223 rtls.opt : $(BASEEXT).opt
1224 $(TOUCH) $(MMS$TARGET)
1230 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
1232 ') unless $self->{SKIPHASH}{'static'};
1235 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
1236 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
1238 $(BASEEXT).opt : Makefile.PL
1239 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
1240 ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ],
1241 neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars),')"
1242 $(PERL) -e "print ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)
1245 if (length $self->{LDLOADLIBS}) {
1246 my($lib); my($line) = '';
1247 foreach $lib (split ' ', $self->{LDLOADLIBS}) {
1248 $lib =~ s%\$%\\\$%g; # Escape '$' in VMS filespecs
1249 if (length($line) + length($lib) > 160) {
1250 push @m, "\t\$(PERL) -e \"print qq[$line]\" >>\$(MMS\$TARGET)\n";
1251 $line = $lib . '\n';
1253 else { $line .= $lib . '\n'; }
1255 push @m, "\t\$(PERL) -e \"print qq[$line]\" >>\$(MMS\$TARGET)\n" if $line;
1262 =item dynamic_lib (override)
1264 Use VMS Link command.
1269 my($self, %attribs) = @_;
1270 return '' unless $self->needs_linking(); #might be because of a subdir
1272 return '' unless $self->has_link_code();
1274 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
1275 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
1279 OTHERLDFLAGS = $otherldflags
1280 INST_DYNAMIC_DEP = $inst_dynamic_dep
1284 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
1285 $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
1286 $(NOECHO) If F$TrnLNm("PerlShr").eqs."" Then Define/NoLog/User PerlShr Sys$Share:PerlShr.Exe
1287 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
1290 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1294 =item dynamic_bs (override)
1296 Use VMS-style quoting on Mkbootstrap command line.
1301 my($self, %attribs) = @_;
1304 ' unless $self->has_link_code();
1306 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
1308 # As MakeMaker mkbootstrap might not write a file (if none is required)
1309 # we use touch to prevent make continually trying to remake it.
1310 # The DynaLoader only reads a non-empty file.
1311 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
1312 $(NOECHO) Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
1313 $(NOECHO) $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
1314 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
1315 $(NOECHO) $(TOUCH) $(MMS$TARGET)
1317 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
1318 $(NOECHO) $(RM_RF) $(INST_BOOT)
1319 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
1323 =item static_lib (override)
1325 Use VMS commands to manipulate object library.
1331 return '' unless $self->needs_linking();
1336 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
1340 # Rely on suffix rule for update action
1341 $(OBJECT) : $(INST_ARCHAUTODIR).exists
1343 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
1345 # If this extension has it's own library (eg SDBM_File)
1346 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
1347 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
1350 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
1351 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
1352 $(NOECHO) $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
1354 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1359 # sub installpm_x { # called by installpm perl file
1360 # my($self, $dist, $inst, $splitlib) = @_;
1361 # if ($inst =~ m!#!) {
1362 # warn "Warning: MM[SK] would have problems processing this file: $inst, SKIPPED\n";
1365 # $inst = $self->fixpath($inst);
1366 # $dist = $self->fixpath($dist);
1367 # my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
1371 # $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
1372 # ",' $(NOECHO) $(RM_F) $(MMS$TARGET)
1373 # $(NOECHO) $(CP) ',"$dist $inst",'
1374 # $(CHMOD) 644 $(MMS$TARGET)
1376 # push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1377 # $self->catdir($splitlib,'auto')."\n\n")
1378 # if ($splitlib and $inst =~ /\.pm$/);
1379 # push(@m,$self->dir_target($instdir));
1384 =item manifypods (override)
1386 Use VMS-style quoting on command line, and VMS logical name
1387 to specify fallback location at build time if we can't find pod2man.
1393 my($self, %attribs) = @_;
1394 return "\nmanifypods :\n\t\$(NOECHO) \$(NOOP)\n" unless %{$self->{MAN3PODS}} or %{$self->{MAN1PODS}};
1397 if (defined $self->{PERL_SRC}) {
1398 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1400 $pod2man_exe = $self->catfile($Config{scriptdirexp},'pod2man');
1402 if (not ($pod2man_exe = $self->perl_script($pod2man_exe))) {
1403 # No pod2man but some MAN3PODS to be installed
1406 Warning: I could not locate your pod2man program. As a last choice,
1407 I will look for the file to which the logical name POD2MAN
1408 points when MMK is invoked.
1411 $pod2man_exe = "pod2man";
1415 qq[POD2MAN_EXE = $pod2man_exe\n],
1416 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1417 -e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1419 push @m, "\nmanifypods : ";
1420 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1422 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1424 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1425 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1426 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1428 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1429 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1430 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1436 =item processPL (override)
1438 Use VMS-style quoting on command line.
1444 return "" unless $self->{PL_FILES};
1446 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1448 all :: $self->{PL_FILES}->{$plfile}
1451 $self->{PL_FILES}->{$plfile} :: $plfile
1452 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1458 =item installbin (override)
1460 Stay under DCL's 255 character command line limit once again by
1461 splitting potentially long list of files across multiple lines
1462 in C<realclean> target.
1468 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1469 return '' unless @{$self->{EXE_FILES}};
1470 my(@m, $from, $to, %fromto, @to, $line);
1471 for $from (@{$self->{EXE_FILES}}) {
1472 my($path) = '$(INST_SCRIPT)' . basename($from);
1473 local($_) = $path; # backward compatibility
1474 $to = $self->libscan($path);
1475 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1478 @to = values %fromto;
1480 EXE_FILES = @{$self->{EXE_FILES}}
1487 $line = ''; #avoid unitialized var warning
1489 if (length($line) + length($to) > 80) {
1490 push @m, "\t\$(RM_F) $line\n";
1493 else { $line .= " $to"; }
1495 push @m, "\t\$(RM_F) $line\n\n" if $line;
1497 while (($from,$to) = each %fromto) {
1498 last unless defined $from;
1500 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1501 else { ($todir = $to) =~ s/[^\)]+$//; }
1502 $todir = $self->fixpath($todir,1);
1504 $to : $from \$(MAKEFILE) ${todir}.exists
1507 ", $self->dir_target($todir);
1512 =item subdir_x (override)
1514 Use VMS commands to change default directory.
1519 my($self, $subdir) = @_;
1521 $subdir = $self->fixpath($subdir,1);
1525 olddef = F$Environment("Default")
1526 Set Default ',$subdir,'
1527 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1528 Set Default \'olddef\'
1533 =item clean (override)
1535 Split potentially long list of files across multiple commands (in
1536 order to stay under the magic command line limit). Also use MM[SK]
1537 commands for handling subdirectories.
1542 my($self, %attribs) = @_;
1545 # Delete temporary files but do not touch installed files. We don\'t delete
1546 # the Descrip.MMS here so that a later make realclean still has it to use.
1549 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1550 my($vmsdir) = $self->fixpath($dir,1);
1551 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1552 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1554 push @m, ' $(RM_F) *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso .MM_Tmp
1557 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1558 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1559 push(@otherfiles, qw[ blib $(MAKE_APERL_FILE) extralibs.ld perlmain.c pm_to_blib.ts ]);
1560 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1562 $line = ''; #avoid unitialized var warning
1563 foreach $file (@otherfiles) {
1564 $file = $self->fixpath($file);
1565 if (length($line) + length($file) > 80) {
1566 push @m, "\t\$(RM_RF) $line\n";
1569 else { $line .= " $file"; }
1571 push @m, "\t\$(RM_RF) $line\n" if $line;
1572 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1576 =item realclean (override)
1578 Guess what we're working around? Also, use MM[SK] for subdirectories.
1583 my($self, %attribs) = @_;
1586 # Delete temporary files (via clean) and also delete installed files
1589 foreach(@{$self->{DIR}}){
1590 my($vmsdir) = $self->fixpath($_,1);
1591 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1592 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1594 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1596 # We can't expand several of the MMS macros here, since they don't have
1597 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1598 # combination of macros). In order to stay below DCL's 255 char limit,
1599 # we put only 2 on a line.
1600 my($file,$line,$fcnt);
1601 my(@files) = qw{ $(MAKEFILE) $(MAKEFILE)_old };
1602 if ($self->has_link_code) {
1603 push(@files,qw{ $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(OBJECT) });
1605 push(@files, values %{$self->{PM}});
1606 $line = ''; #avoid unitialized var warning
1607 foreach $file (@files) {
1608 $file = $self->fixpath($file);
1609 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1610 push @m, "\t\$(RM_F) $line\n";
1614 else { $line .= " $file"; }
1616 push @m, "\t\$(RM_F) $line\n" if $line;
1617 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1619 foreach $file (@{$attribs{'FILES'}}) {
1620 $file = $self->fixpath($file);
1621 if (length($line) + length($file) > 80) {
1622 push @m, "\t\$(RM_RF) $line\n";
1625 else { $line .= " $file"; }
1627 push @m, "\t\$(RM_RF) $line\n" if $line;
1629 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1633 =item dist_basics (override)
1635 Use VMS-style quoting on command line.
1642 distclean :: realclean distcheck
1646 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1649 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1652 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1656 =item dist_core (override)
1658 Syntax for invoking F<VMS_Share> differs from that for Unix F<shar>,
1659 so C<shdist> target actions are VMS-specific.
1666 dist : $(DIST_DEFAULT)
1667 $(NOECHO) $(PERL) -le "print 'Warning: $m older than $vf' if -e ($vf = '$(VERSION_FROM)') && -M $vf < -M ($m = '$(MAKEFILE)'"
1669 zipdist : $(DISTVNAME).zip
1672 $(DISTVNAME).zip : distdir
1674 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1675 $(RM_RF) $(DISTVNAME)
1678 $(DISTVNAME).tar$(SUFFIX) : distdir
1681 $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar $(SRC)
1682 $(RM_RF) $(DISTVNAME)
1683 $(COMPRESS) $(DISTVNAME).tar
1688 $(SHARE) $(SRC) $(DISTVNAME).share
1689 $(RM_RF) $(DISTVNAME)
1694 =item dist_dir (override)
1696 Use VMS-style quoting on command line.
1704 $(RM_RF) $(DISTVNAME)
1705 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1706 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1710 =item dist_test (override)
1712 Use VMS commands to change default directory, and use VMS-style
1713 quoting on command line.
1721 startdir = F$Environment("Default")
1722 Set Default [.$(DISTVNAME)]
1723 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1726 Set Default 'startdir'
1730 # --- Test and Installation Sections ---
1732 =item install (override)
1734 Work around DCL's 255 character limit several times,and use
1735 VMS-style command line quoting in a few cases.
1740 my($self, %attribs) = @_;
1743 if ($self->{EXE_FILES}) {
1744 my($line,$file) = ('','');
1745 foreach $file (@{$self->{EXE_FILES}}) {
1747 if (length($line) > 128) {
1748 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]);
1752 push(@docfiles,qq[\t\$(PERL) -e "print $line" >>.MM_tmp\n]) if $line;
1756 install :: all pure_install doc_install
1759 install_perl :: all pure_perl_install doc_perl_install
1762 install_site :: all pure_site_install doc_site_install
1765 install_ :: install_site
1766 $(NOECHO) Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1768 pure_install :: pure_$(INSTALLDIRS)_install
1771 doc_install :: doc_$(INSTALLDIRS)_install
1772 $(NOECHO) Write Sys$Output "Appending installation info to $(INSTALLARCHLIB)perllocal.pod"
1774 pure__install : pure_site_install
1775 $(NOECHO) Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1777 doc__install : doc_site_install
1778 $(NOECHO} Write Sys$Output "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site"
1780 # This hack brought to you by DCL's 255-character command line limit
1781 pure_perl_install ::
1782 $(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1783 $(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1784 $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLPRIVLIB) '" >>.MM_tmp
1785 $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLARCHLIB) '" >>.MM_tmp
1786 $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp
1787 $(NOECHO) $(PERL) -e "print '$(INST_SCRIPT) $(INSTALLSCRIPT) '" >>.MM_tmp
1788 $(NOECHO) $(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1789 $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1790 $(MOD_INSTALL) <.MM_tmp
1791 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
1792 $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[
1795 pure_site_install ::
1796 $(NOECHO) $(PERL) -e "print 'read ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q[ '" >.MM_tmp
1797 $(NOECHO) $(PERL) -e "print 'write ].$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q[ '" >>.MM_tmp
1798 $(NOECHO) $(PERL) -e "print '$(INST_LIB) $(INSTALLSITELIB) '" >>.MM_tmp
1799 $(NOECHO) $(PERL) -e "print '$(INST_ARCHLIB) $(INSTALLSITEARCH) '" >>.MM_tmp
1800 $(NOECHO) $(PERL) -e "print '$(INST_BIN) $(INSTALLBIN) '" >>.MM_tmp
1801 $(NOECHO) $(PERL) -e "print '$(INST_SCRIPT) $(INSTALLSCRIPT) '" >>.MM_tmp
1802 $(NOECHO) $(PERL) -e "print '$(INST_MAN1DIR) $(INSTALLMAN1DIR) '" >>.MM_tmp
1803 $(NOECHO) $(PERL) -e "print '$(INST_MAN3DIR) $(INSTALLMAN3DIR) '" >>.MM_tmp
1804 $(MOD_INSTALL) <.MM_tmp
1805 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
1806 $(NOECHO) $(WARN_IF_OLD_PACKLIST) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1810 $(NOECHO) $(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLPRIVLIB)|'" >.MM_tmp
1811 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1812 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1814 q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,<STDIN>);]" >.MM2_tmp
1815 $(NOECHO) $(PERL) -e "print q[print '=head3 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
1816 $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp
1817 $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
1818 $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1819 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp;
1823 $(NOECHO) $(PERL) -e "print 'Module $(NAME)|installed into|$(INSTALLSITELIB)|'" >.MM_tmp
1824 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|'" >>.MM_tmp
1825 $(NOECHO) $(PERL) -e "print 'LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|'" >>.MM_tmp
1827 q% $(NOECHO) $(PERL) -e "print q[@ARGV=split(/\\|/,<STDIN>);]" >.MM2_tmp
1828 $(NOECHO) $(PERL) -e "print q[print '=head3 ',scalar(localtime),': C<',shift,qq[>\\n\\n=over 4\\n\\n];]" >>.MM2_tmp
1829 $(NOECHO) $(PERL) -e "print q[while(($key=shift) && ($val=shift)) ]" >>.MM2_tmp
1830 $(NOECHO) $(PERL) -e "print q[{print qq[=item *\\n\\nC<$key: $val>\\n\\n];}print qq[=back\\n\\n];]" >>.MM2_tmp
1831 $(NOECHO) $(PERL) .MM2_tmp <.MM_tmp >>%.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
1832 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;,.MM2_tmp;
1837 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
1840 uninstall_from_perldirs ::
1841 $(NOECHO) $(UNINSTALL) ].$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q[
1843 uninstall_from_sitedirs ::
1844 $(NOECHO) $(UNINSTALL) ].$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')."\n";
1849 =item perldepend (override)
1851 Use VMS-style syntax for files; it's cheaper to just do it directly here
1852 than to have the MM_Unix method call C<catfile> repeatedly. Also use
1853 config.vms as source of original config data if the Perl distribution
1854 is available; config.sh is an ancillary file under VMS. Finally, if
1855 we have to rebuild Config.pm, use MM[SK] to do it.
1864 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1865 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1866 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1867 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1868 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1869 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1870 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1872 ' if $self->{OBJECT};
1874 if ($self->{PERL_SRC}) {
1876 my($mmsquals) = '$(USEMAKEFILE)[.vms]$(MAKEFILE)';
1877 push(@macros,'__AXP__=1') if $Config{'arch'} eq 'VMS_AXP';
1878 push(@macros,'DECC=1') if $Config{'vms_cc_type'} eq 'decc';
1879 push(@macros,'GNUC=1') if $Config{'vms_cc_type'} eq 'gcc';
1880 push(@macros,'SOCKET=1') if $Config{'d_has_sockets'};
1881 push(@macros,qq["CC=$Config{'cc'}"]) if $Config{'cc'} =~ m!/!;
1882 $mmsquals .= '$(USEMACROS)' . join(',',@macros) . '$(MACROEND)' if @macros;
1884 # Check for unpropagated config.sh changes. Should never happen.
1885 # We do NOT just update config.h because that is not sufficient.
1886 # An out of date config.h is not fatal but complains loudly!
1887 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1888 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1889 $(NOECHO) Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1891 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1892 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1893 $(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1894 olddef = F$Environment("Default")
1895 Set Default $(PERL_SRC)
1896 $(MMS)],$mmsquals,q[ $(MMS$TARGET)
1897 Set Default 'olddef'
1901 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1907 =item makefile (override)
1909 Use VMS commands and quoting.
1916 # We do not know what target was originally specified so we
1917 # must force a manual rerun to be sure. But as it should only
1918 # happen very rarely it is not a significant problem.
1920 $(OBJECT) : $(FIRST_MAKEFILE)
1921 ] if $self->{OBJECT};
1924 # We take a very conservative approach here, but it\'s worth it.
1925 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1926 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1927 $(NOECHO) Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1928 $(NOECHO) Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1929 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1930 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1931 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ],join(' ',map(qq["$_"],@ARGV)),q[
1932 $(NOECHO) Write Sys$Output "$(MAKEFILE) has been rebuilt."
1933 $(NOECHO) Write Sys$Output "Please run $(MMS) to build the extension."
1939 =item test (override)
1941 Use VMS commands for handling subdirectories.
1946 my($self, %attribs) = @_;
1947 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1951 TEST_TYPE = test_\$(LINKTYPE)
1955 test :: \$(TEST_TYPE)
1958 testdb :: testdb_\$(LINKTYPE)
1962 foreach(@{$self->{DIR}}){
1963 my($vmsdir) = $self->fixpath($_,1);
1964 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1965 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1967 push(@m, "\t\$(NOECHO) Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
1968 unless $tests or -f "test.pl" or @{$self->{DIR}};
1971 push(@m, "test_dynamic :: pure_all\n");
1972 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1973 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1974 push(@m, "\t\$(NOECHO) \$(NOOP)\n") if (!$tests && ! -f "test.pl");
1977 push(@m, "testdb_dynamic :: pure_all\n");
1978 push(@m, $self->test_via_script('$(FULLPERL) "$(TESTDB_SW)"', '$(TEST_FILE)'));
1981 # Occasionally we may face this degenerate target:
1982 push @m, "test_ : test_dynamic\n\n";
1984 if ($self->needs_linking()) {
1985 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
1986 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
1987 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f 'test.pl';
1989 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
1990 push(@m, $self->test_via_script('$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
1994 push @m, "test_static :: test_dynamic\n\t\$(NOECHO) \$(NOOP)\n\n";
1995 push @m, "testdb_static :: testdb_dynamic\n\t\$(NOECHO) \$(NOOP)\n";
2001 =item test_via_harness (override)
2003 Use VMS-style quoting on command line.
2007 sub test_via_harness {
2008 my($self,$perl,$tests) = @_;
2009 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
2010 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
2013 =item test_via_script (override)
2015 Use VMS-style quoting on command line.
2019 sub test_via_script {
2020 my($self,$perl,$script) = @_;
2021 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '.$script.'
2025 =item makeaperl (override)
2027 Undertake to build a new set of Perl images using VMS commands. Since
2028 VMS does dynamic loading, it's not necessary to statically link each
2029 extension into the Perl image, so this isn't the normal build path.
2030 Consequently, it hasn't really been tested, and may well be incomplete.
2035 my($self, %attribs) = @_;
2036 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2037 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2040 # --- MakeMaker makeaperl section ---
2041 MAP_TARGET = $target
2043 return join '', @m if $self->{PARENT};
2045 my($dir) = join ":", @{$self->{DIR}};
2047 unless ($self->{MAKEAPERL}) {
2049 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
2050 $(NOECHO) Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
2051 $(NOECHO) $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
2052 Makefile.PL DIR=}, $dir, q{ \
2053 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2054 MAKEAPERL=1 NORECURS=1
2056 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
2057 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
2059 push @m, map( " \\\n\t\t$_", @ARGV );
2066 my($linkcmd,@staticopts,@staticpkgs,$extralist,$targdir,$libperldir);
2068 # The front matter of the linkcommand...
2069 $linkcmd = join ' ', $Config{'ld'},
2070 grep($_, @Config{qw(large split ldflags ccdlflags)});
2071 $linkcmd =~ s/\s+/ /g;
2073 # Which *.olb files could we make use of...
2075 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
2077 File::Find::find(sub {
2078 return unless m/\Q$self->{LIB_EXT}\E$/;
2079 return if m/^libperl/;
2081 if( exists $self->{INCLUDE_EXT} ){
2086 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2090 # Throw away anything not explicitly marked for inclusion.
2091 # DynaLoader is implied.
2092 foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2098 return unless $found;
2100 elsif( exists $self->{EXCLUDE_EXT} ){
2104 ($xx = $File::Find::name) =~ s,.*?/auto/,,;
2108 # Throw away anything explicitly marked for exclusion
2109 foreach $excl (@{$self->{EXCLUDE_EXT}}){
2110 return if( $xx eq $excl );
2114 $olbs{$ENV{DEFAULT}} = $_;
2115 }, grep( -d $_, @{$searchdirs || []}));
2117 # We trust that what has been handed in as argument will be buildable
2118 $static = [] unless $static;
2119 @olbs{@{$static}} = (1) x @{$static};
2121 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2122 # Sort the object libraries in inverse order of
2123 # filespec length to try to insure that dependent extensions
2124 # will appear before their parents, so the linker will
2125 # search the parent library to resolve references.
2126 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
2127 # references from [.intuit.dwim]dwim.obj can be found
2128 # in [.intuit]intuit.olb).
2129 for (sort keys %olbs) {
2130 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
2131 my($dir) = $self->fixpath($_,1);
2132 my($extralibs) = $dir . "extralibs.ld";
2133 my($extopt) = $dir . $olbs{$_};
2134 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
2135 if (-f $extralibs ) {
2136 open LIST,$extralibs or warn $!,next;
2137 push @$extra, <LIST>;
2141 open OPT,$extopt or die $!;
2143 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
2144 # ExtUtils::Miniperl expects Unix paths
2145 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
2146 push @staticpkgs,$pkg;
2148 push @staticopts, $extopt;
2152 $target = "Perl.Exe" unless $target;
2153 ($shrtarget,$targdir) = fileparse($target);
2154 $shrtarget =~ s/^([^.]*)/$1Shr/;
2155 $shrtarget = $targdir . $shrtarget;
2156 $target = "Perlshr.$Config{'dlext'}" unless $target;
2157 $tmp = "[]" unless $tmp;
2158 $tmp = $self->fixpath($tmp,1);
2160 $extralist = join(' ',@$extra);
2161 $extralist =~ s/[,\s\n]+/, /g;
2163 else { $extralist = ''; }
2165 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
2166 print STDOUT "Warning: $libperl not found\n";
2171 if (defined $self->{PERL_SRC}) {
2172 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
2173 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
2175 print STDOUT "Warning: $libperl not found
2176 If you're going to build a static perl binary, make sure perl is installed
2177 otherwise ignore this warning\n";
2180 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
2183 # Fill in the target you want to produce if it\'s not perl
2184 MAP_TARGET = ',$self->fixpath($target),'
2185 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
2186 MAP_LINKCMD = $linkcmd
2187 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
2188 # We use the linker options files created with each extension, rather than
2189 #specifying the object files directly on the command line.
2190 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
2191 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
2192 MAP_EXTRA = $extralist
2193 MAP_LIBPERL = ",$self->fixpath($libperl),'
2198 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
2199 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
2200 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
2201 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
2202 $(NOECHO) Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
2203 $(NOECHO) Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
2204 $(NOECHO) Write Sys$Output "To remove the intermediate files, say
2205 $(NOECHO) Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
2208 ',"${tmp}perlmain.c",' : $(MAKEFILE)
2209 $(NOECHO) $(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
2213 # More from the 255-char line length limit
2215 $(NOECHO) $(PERL) -e "print 'Perl binary $(MAP_TARGET)|'" >.MM_tmp
2216 $(NOECHO) $(PERL) -e "print 'MAP_STATIC|$(MAP_STATIC)|'" >>.MM_tmp
2217 $(NOECHO) $(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp
2218 $(NOECHO) $(PERL) -e "print 'MAP_LIBPERL|$(MAP_LIBPERL)|'" >>.MM_tmp
2219 $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q[
2220 $(NOECHO) Delete/NoLog/NoConfirm .MM_tmp;
2224 inst_perl : pure_inst_perl doc_inst_perl
2227 pure_inst_perl : \$(MAP_TARGET)
2228 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
2229 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
2235 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
2236 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
2242 # --- Output postprocessing section ---
2244 =item nicetext (override)
2246 Insure that colons marking targets are preceded by space, in order
2247 to distinguish the target delimiter from a colon appearing as
2254 my($self,$text) = @_;
2255 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;