2 # MakeMaker default methods for VMS
3 # This package is inserted into @ISA of MakeMaker's MM before the
4 # built-in MM_Unix methods if MakeMaker.pm is run under VMS.
7 # Author: Charles Bailey bailey@genetics.upenn.edu
10 package ExtUtils::MM_VMS;
17 Exporter::import('ExtUtils::MakeMaker', '$Verbose', '&neatvalue');
20 sub eliminate_macros {
23 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
24 $self = $ExtUtils::MakeMaker::Parent[-1];
27 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
30 my($npath) = unixify($path);
31 my($head,$macro,$tail);
33 # perform m##g in scalar context so it acts as an iterator
34 while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) {
36 ($head,$macro,$tail) = ($1,$2,$3);
37 ($macro = unixify($self->{$macro})) =~ s#/$##;
38 $npath = "$head$macro$tail";
41 print "eliminate_macros($path) = |$npath|\n" if $Verbose >= 3;
45 # Catchall routine to clean up problem macros. Expands macros in any directory
46 # specification, and expands expressions which are all macro, so that we can
47 # tell how long the expansion is, and avoid overrunning DCL's command buffer
48 # when MM[KS] is running.
50 my($self,$path,$force_path) = @_;
52 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
53 $self = $ExtUtils::MakeMaker::Parent[-1];
56 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
59 my($fixedpath,$prefix,$name);
61 if ($path =~ m#^\$\(.+\)$# || $path =~ m#[/:>\]]#) {
62 if ($force_path or $path =~ /(?:DIR\)|\])$/) {
63 $fixedpath = vmspath($self->eliminate_macros($path));
66 $fixedpath = vmsify($self->eliminate_macros($path));
69 elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#)) && $self->{$prefix}) {
70 my($vmspre) = vmspath($self->{$prefix}) || ''; # is it a dir or just a name?
71 $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name;
72 $fixedpath = vmspath($fixedpath) if $force_path;
76 $fixedpath = vmspath($fixedpath) if $force_path;
78 # Convert names without directory or type to paths
79 if (!$force_path and $fixedpath !~ /[:>(.\]]/) { $fixedpath = vmspath($fixedpath); }
80 print "fixpath($path) = |$fixedpath|\n" if $Verbose >= 3;
87 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
88 $self = $ExtUtils::MakeMaker::Parent[-1];
91 my($path) = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
92 my($spath,$sdir) = ($path,$dir);
93 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
94 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
97 $rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
98 print "catdir($path,$dir) = |$rslt|\n" if $Verbose >= 3;
103 my($self,@files) = @_;
105 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
106 $self = $ExtUtils::MakeMaker::Parent[-1];
108 my($file) = pop @files;
109 my($path) = (@files == 1 ? $files[0] : $self->catdir(@files));
113 if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
114 else { $rslt = vmsify($self->eliminate_macros($spath).'/'.unixify($file)); }
115 print "catfile($path,$file) = |$rslt|\n" if $Verbose >= 3;
120 # Default name is taken from the directory name if it's not passed in.
121 # Since VMS filenames are case-insensitive, we actually look in the
122 # extension files to find the Mixed-case name
126 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
127 $self = $ExtUtils::MakeMaker::Parent[-1];
132 $defname = $ENV{'DEFAULT'};
133 $defname =~ s:.*?([^.\]]+)\]:$1:
134 unless ($defname =~ s:.*[.\[]ext\.(.*)\]:$1:i);
135 $defname =~ s#[.\]]#::#g;
136 ($defpm = $defname) =~ s/.*:://;
137 if (open(PM,"${defpm}.pm")){
139 if (/^\s*package\s+([^;]+)/i) {
144 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
145 "defaulting package name to $defname\n"
150 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
151 "defaulting package name to $defname\n";
153 $defname =~ s#[\-_][\d.\-]+$##;
159 my($self, $ver, $names, $dirs, $trace) = @_;
161 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
162 $self = $ExtUtils::MakeMaker::Parent[-1];
164 my($name, $dir,$vmsfile,@cand);
166 print "Looking for perl $ver by these names:\n";
167 print "\t@$names,\n";
168 print "in these dirs:\n";
171 foreach $dir (@$dirs){
172 next unless defined $dir; # $self->{PERL_SRC} may be undefined
173 foreach $name (@$names){
174 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
175 else { push(@cand,$self->fixpath($name)); }
178 foreach $name (sort { length($a) <=> length($b) } @cand) {
179 print "Checking $name\n" if ($trace >= 2);
180 next unless $vmsfile = $self->maybe_command($name);
181 print "Executing $vmsfile\n" if ($trace >= 2);
182 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
183 print "Using PERL=MCR $vmsfile\n" if $trace;
184 return "MCR $vmsfile"
187 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
188 0; # false and not empty
193 my($self,$file) = @_;
194 return $file if -x $file && ! -d _;
195 return "$file.exe" if -x "$file.exe";
196 if ($file !~ m![/:>\]]!) {
197 my($shrfile) = 'Sys$Share:' . $file;
198 return $file if -x $shrfile && ! -d _;
199 return "$file.exe" if -x "$shrfile.exe";
205 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
206 my($self, $names, $dirs, $trace, $ver) = @_;
208 foreach $dir (@$dirs){
209 next unless defined $dir; # $self->{PERL_SRC} may be undefined
210 foreach $name (@$names){
212 if ($self->file_name_is_absolute($name)) {
215 $abs = $self->catfile($dir, $name);
217 print "Checking $abs for $name\n" if ($trace >= 2);
218 next unless $tryabs = $self->maybe_command($abs);
219 print "Substituting $tryabs instead of $abs\n"
220 if ($trace >= 2 and $tryabs ne $abs);
223 print "Executing $abs\n" if ($trace >= 2);
224 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
225 print "Using PERL=$abs\n" if $trace;
228 } else { # Do not look for perl
237 my($self,$file) = @_;
238 return $file if -r $file && ! -d _;
239 return "$file.pl" if -r "$file.pl" && ! -d _;
243 sub file_name_is_absolute {
245 $file =~ m!^/! or $file =~ m![:<\[][^.]!;
249 sub replace_manpage_separator {
251 $man = unixify($man);
260 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
261 $self = $ExtUtils::MakeMaker::Parent[-1];
264 $self->{NOOP} = "\t@ Continue";
265 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
266 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
267 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
268 $self->{RM_RF} = '$(PERL) -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
269 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
270 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
271 $self->{CP} = 'Copy/NoConfirm';
272 $self->{MV} = 'Rename/NoConfirm';
273 $self->{UMASK_NULL} = "\t!";
274 &MM_Unix::init_others;
280 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
281 $self = $ExtUtils::MakeMaker::Parent[-1];
286 DISTNAME = $self->{DISTNAME}
287 NAME_SYM = $self->{NAME_SYM}
288 VERSION = $self->{VERSION}
289 VERSION_SYM = $self->{VERSION_SYM}
290 VERSION_MACRO = VERSION
291 DEFINE_VERSION = ",'"$(VERSION_MACRO)=""$(VERSION)"""',"
292 XS_VERSION = $self->{XS_VERSION}
293 XS_VERSION_MACRO = XS_VERSION
294 XS_DEFINE_VERSION = ",'"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""',"
296 # In which library should we install this extension?
297 # This is typically the same as PERL_LIB.
298 # (also see INST_LIBDIR and relationship to ROOTEXT)
299 INST_LIB = ",$self->fixpath($self->{INST_LIB},1),"
300 INST_ARCHLIB = ",$self->fixpath($self->{INST_ARCHLIB},1),"
301 INST_EXE = ",$self->fixpath($self->{INST_EXE},1),"
303 PREFIX = $self->{PREFIX}
305 # AFS users will want to set the installation directories for
306 # the final 'make install' early without setting INST_LIB,
307 # INST_ARCHLIB, and INST_EXE for the testing phase
308 INSTALLPRIVLIB = ",$self->fixpath($self->{INSTALLPRIVLIB},1),'
309 INSTALLARCHLIB = ',$self->fixpath($self->{INSTALLARCHLIB},1),'
310 INSTALLBIN = ',$self->fixpath($self->{INSTALLBIN},1),'
312 # Perl library to use when building the extension
313 PERL_LIB = ',$self->fixpath($self->{PERL_LIB},1),'
314 PERL_ARCHLIB = ',$self->fixpath($self->{PERL_ARCHLIB},1),'
315 LIBPERL_A = ',$self->fixpath($self->{LIBPERL_A}),'
317 MAKEMAKER = ',$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),"
318 MM_VERSION = $ExtUtils::MakeMaker::VERSION
319 FIRST_MAKEFILE = ",$self->fixpath($self->{FIRST_MAKEFILE}),'
320 MAKE_APERL_FILE = ',$self->fixpath($self->{MAKE_APERL_FILE}),"
322 PERLMAINCC = $self->{PERLMAINCC}
325 if ($self->{PERL_SRC}) {
327 # Where is the perl source code located?
328 PERL_SRC = ",$self->fixpath($self->{PERL_SRC},1);
330 PERL_VMS = ",$self->catdir($self->{PERL_SRC},q(VMS));
333 # Perl header files (will eventually be under PERL_LIB)
334 PERL_INC = ",$self->fixpath($self->{PERL_INC},1),"
337 FULLPERL = $self->{FULLPERL}
339 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
340 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
341 # ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD)
342 FULLEXT = ",$self->fixpath($self->{FULLEXT},1),"
343 BASEEXT = $self->{BASEEXT}
344 ROOTEXT = ",($self->{ROOTEXT} eq '') ? '[]' : $self->fixpath($self->{ROOTEXT},1),"
345 DLBASE = $self->{DLBASE}
348 if ($self->{'INC'}) {
349 push @m,'/Include=(';
350 my(@includes) = split(/\s+/,$self->{INC});
352 foreach (@includes) {
354 push @m,', ' if $plural++;
355 push @m,$self->fixpath($_,1);
360 if ($self->{DEFINE} ne '') {
361 my(@defs) = split(/\s+/,$self->{DEFINE});
362 foreach $def (@defs) {
365 $def = "\"$def\"" if $def =~ /=/;
367 $self->{DEFINE} = join ',',@defs;
370 if ($self->{OBJECT} =~ /\s/) {
371 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
372 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
374 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
377 DEFINE = $self->{DEFINE}
378 OBJECT = $self->{OBJECT}
379 LDFROM = $self->{LDFROM}
380 LINKTYPE = $self->{LINKTYPE}
382 # Handy lists of source code files:
383 XS_FILES = ",join(', ', sort keys %{$self->{XS}}),'
384 C_FILES = ',join(', ', @{$self->{C}}),'
385 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
386 H_FILES = ',join(', ', @{$self->{H}}),'
387 MAN1PODS = ',join(" \\\n\t", sort keys %{$self->{MAN1PODS}}),'
388 MAN3PODS = ',join(" \\\n\t", sort keys %{$self->{MAN3PODS}}),'
390 # Man installation stuff:
391 INST_MAN1DIR = ',$self->fixpath($self->{INST_MAN1DIR},1),'
392 INSTALLMAN1DIR = ',$self->fixpath($self->{INSTALLMAN1DIR},1),"
393 MAN1EXT = $self->{MAN1EXT}
395 INST_MAN3DIR = ",$self->fixpath($self->{INST_MAN3DIR},1),'
396 INSTALLMAN3DIR = ',$self->fixpath($self->{INSTALLMAN3DIR},1),"
397 MAN3EXT = $self->{MAN3EXT}
400 .SUFFIXES : .xs .c \$(OBJ_EXT)
402 # This extension may link to it's own library (see SDBM_File)";
404 MYEXTLIB = ",$self->fixpath($self->{MYEXTLIB}),"
406 # Here is the Config.pm that we are using/depend on
407 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h
409 # Where to put things:
410 INST_LIBDIR = ",($self->{'INST_LIBDIR'} = $self->catdir($self->{INST_LIB},$self->{ROOTEXT})),"
411 INST_ARCHLIBDIR = ",($self->{'INST_ARCHLIBDIR'} = $self->catdir($self->{INST_ARCHLIB},$self->{ROOTEXT})),"
413 INST_AUTODIR = ",($self->{'INST_AUTODIR'} = $self->catdir($self->{INST_LIB},'auto',$self->{FULLEXT})),'
414 INST_ARCHAUTODIR = ',($self->{'INST_ARCHAUTODIR'} = $self->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT})),'
417 if ($self->has_link_code()) {
419 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
420 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
421 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
432 INST_PM = ',join(', ',map($self->fixpath($_),sort values %{$self->{PM}})),'
442 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
443 $self = $ExtUtils::MakeMaker::Parent[-1];
447 # $self->{NAME} might depend on some other libraries.
448 # (These comments may need revising:)
450 # Dependent libraries can be linked in one of three ways:
452 # 1. (For static extensions) by the ld command when the perl binary
453 # is linked with the extension library. See EXTRALIBS below.
455 # 2. (For dynamic extensions) by the ld command when the shared
456 # object is built/linked. See LDLOADLIBS below.
458 # 3. (For dynamic extensions) by the DynaLoader when the shared
459 # object is loaded. See BSLOADLIBS below.
461 # EXTRALIBS = List of libraries that need to be linked with when
462 # linking a perl binary which includes this extension
463 # Only those libraries that actually exist are included.
464 # These are written to a file and used when linking perl.
466 # LDLOADLIBS = List of those libraries which can or must be linked into
467 # the shared library when created using ld. These may be
468 # static or dynamic libraries.
469 # LD_RUN_PATH is a colon separated list of the directories
470 # in LDLOADLIBS. It is passed as an environment variable to
471 # the process that links the shared library.
473 # BSLOADLIBS = List of those libraries that are needed but can be
474 # linked in dynamically at run time on this platform.
475 # SunOS/Solaris does not need this because ld records
476 # the information (from LDLOADLIBS) into the object file.
477 # This list is used to create a .bs (bootstrap) file.
479 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
480 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
481 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
488 my($self,$libperl) = @_;
490 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
491 $self = $ExtUtils::MakeMaker::Parent[-1];
493 my($cmd,$quals) = ($Config{'cc'},$Config{'ccflags'});
496 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
497 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
498 " required to modify CC command for $self->{'BASEEXT'}\n"
501 # Deal with $self->{DEFINE} here since some C compilers pay attention
502 # to only one /Define clause on command line, so we have to
503 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
504 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
505 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
506 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
509 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
510 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
513 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
514 if ($libperl =~ /libperl(\w+)\./i) {
516 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
517 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
518 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
519 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
522 # Likewise with $self->{INC} and /Include
523 my($incstr) = '/Include=($(PERL_INC)';
524 if ($self->{'INC'}) {
525 my(@includes) = split(/\s+/,$self->{INC});
526 foreach (@includes) {
528 $incstr .= ', '.$self->fixpath($_,1);
531 if ($quals =~ m:(.*)/include=\(?([^\(\/\)\s]+)\)?(.*):i) {
532 $quals = "$1$incstr,$2)$3";
534 else { $quals .= "$incstr)"; }
537 if ($Config{'vms_cc_type'} ne 'decc') {
540 @ If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS ',
541 ($Config{'vms_cc_type'} eq 'gcc' ? 'GNU_CC_Include:[VMS]'
546 push(@m, "CCCMD = $cmd$quals\n");
548 $self->{CONST_CCCMD} = join('',@m);
552 # --- Tool Sections ---
555 my($self, %attribs) = @_;
557 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
558 $self = $ExtUtils::MakeMaker::Parent[-1];
561 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
563 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
564 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
571 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
572 $self = $ExtUtils::MakeMaker::Parent[-1];
574 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
575 # drop back to old location if xsubpp is not in new location yet
576 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
577 my(@tmdeps) = '$(XSUBPPDIR)typemap';
578 if( $self->{TYPEMAPS} ){
580 foreach $typemap (@{$self->{TYPEMAPS}}){
582 warn "Typemap $typemap not found.\n";
585 push(@tmdeps, $self->fixpath($typemap));
589 push(@tmdeps, "typemap") if -f "typemap";
590 my(@tmargs) = map("-typemap $_", @tmdeps);
591 if( exists $self->{XSOPT} ){
592 unshift( @tmargs, $self->{XSOPT} );
595 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
597 # What are the correct thresholds for version 1 && 2 Paul?
598 if ( $xsubpp_version > 1.923 ){
599 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
601 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
602 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
603 Your version of xsubpp is $xsubpp_version and cannot handle this.
604 Please upgrade to a more recent version of xsubpp.
607 $self->{XSPROTOARG} = "";
612 XSUBPPDIR = ".$self->fixpath($xsdir,1)."
613 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
614 XSPROTOARG = $self->{XSPROTOARG}
623 my($self,$xsubpp) = @_;
626 # try to figure out the version number of the xsubpp on the system
628 # first try the -v flag, introduced in 1.921 & 2.000a2
630 my $command = "$self->{PERL} $xsubpp -v";
631 print "Running: $command\n" if $Verbose;
632 $version = `$command` ;
633 warn "Running '$command' exits with status " . $? unless ($? & 1);
636 return $1 if $version =~ /^xsubpp version (.*)/ ;
638 # nope, then try something else
641 my ($file) = 'temp' ;
642 $counter++ while -e "$file$counter"; # don't overwrite anything
646 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
648 MODULE = fred PACKAGE = fred
657 $command = "$self->{PERL} $xsubpp $file";
658 print "Running: $command\n" if $Verbose;
659 my $text = `$command` ;
660 warn "Running '$command' exits with status " . $? unless ($? & 1);
663 # gets 1.2 -> 1.92 and 2.000a1
664 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
666 # it is either 1.0 or 1.1
667 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
669 # none of the above, so 1.0
677 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
678 $self = $ExtUtils::MakeMaker::Parent[-1];
681 # Assumes \$(MMS) invokes MMS or MMK
682 # (It is assumed in some cases later that the default makefile name
683 # (Descrip.MMS for MM[SK]) is used.)
684 USEMAKEFILE = /Descrip=
687 MAKEFILE = Descrip.MMS
689 TOUCH = $self->{TOUCH}
690 CHMOD = $self->{CHMOD}
694 RM_RF = $self->{RM_RF}
695 UMASK_NULL = $self->{UMASK_NULL}
696 MKPATH = Create/Directory
702 my($self, %attribs) = @_;
704 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
705 $self = $ExtUtils::MakeMaker::Parent[-1];
707 # VERSION should be sanitised before use as a file name
708 my($name) = $attribs{NAME} || '$(DISTVNAME)';
709 my($zip) = $attribs{ZIP} || 'zip';
710 my($zipflags) = $attribs{ZIPFLAGS} || '-Vu';
711 my($suffix) = $attribs{SUFFIX} || '';
712 my($shar) = $attribs{SHAR} || 'vms_share';
713 my($preop) = $attribs{PREOP} || '!'; # e.g., update MANIFEST
714 my($postop) = $attribs{POSTOP} || '!';
715 my($dist_cp) = $attribs{DIST_CP} || 'best';
716 my($dist_default) = $attribs{DIST_DEFAULT} || 'zipdist';
719 $src = "[.$src]" unless $src =~ /\[/;
721 $src .= '*.*' if $src =~ /\]$/;
724 DISTVNAME = \$(DISTNAME)-\$(VERSION_SYM)
733 DIST_DEFAULT = $dist_default
738 # --- Translation Sections ---
743 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
744 $self = $ExtUtils::MakeMaker::Parent[-1];
746 return '' unless $self->needs_linking();
749 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
756 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
757 $self = $ExtUtils::MakeMaker::Parent[-1];
759 return '' unless $self->needs_linking();
762 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
766 sub xs_o { # many makes are too dumb to use xs_c then c_o
769 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
770 $self = $ExtUtils::MakeMaker::Parent[-1];
772 return '' unless $self->needs_linking();
775 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
776 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
781 # --- Target Sections ---
787 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
788 $self = $ExtUtils::MakeMaker::Parent[-1];
792 all :: config $(INST_PM) subdirs linkext manifypods
795 subdirs :: $(MYEXTLIB)
798 config :: $(MAKEFILE) $(INST_LIBDIR).exists
801 config :: $(INST_ARCHAUTODIR).exists Version_check
804 config :: $(INST_AUTODIR).exists
809 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
810 if (%{$self->{MAN1PODS}}) {
812 config :: $(INST_MAN1DIR)/.exists
815 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
817 if (%{$self->{MAN3PODS}}) {
819 config :: $(INST_MAN3DIR).exists
822 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
826 $(O_FILES) : $(H_FILES)
827 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
831 perldoc ExtUtils::MakeMaker
836 @ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
837 -e "use ExtUtils::MakeMaker qw($Version &Version_check);" -
838 -e "&Version_check('$(MM_VERSION)')"
846 my($self,%attribs) = @_;
848 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
849 $self = $ExtUtils::MakeMaker::Parent[-1];
852 return '' unless $self->needs_linking();
854 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
855 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
859 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
862 # rtls.opt is built in the same step as $(BASEEXT).opt
863 rtls.opt : $(BASEEXT).opt
864 $(TOUCH) $(MMS$TARGET)
865 ') unless $self->{SKIPHASH}{'dynamic'};
868 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
870 ') unless $self->{SKIPHASH}{'static'};
873 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
874 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
875 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
877 $(BASEEXT).opt : makefile.PL
878 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::MakeMaker qw(&mksymlists);" -
879 -e "MM->new({NAME => \'',$self->{NAME},'\'})->mksymlists({DL_FUNCS => ',neatvalue($self->{DL_FUNCS}),', DL_VARS => ',neatvalue($self->{DL_VARS}),'})"
880 $(PERL) -e "open OPT,\'>>$(MMS$TARGET)\'; print OPT ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";close OPT"
887 # --- Dynamic Loading Sections ---
890 my($self, %attribs) = @_;
892 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
893 $self = $ExtUtils::MakeMaker::Parent[-1];
895 return '' unless $self->needs_linking(); #might be because of a subdir
897 return '' unless $self->has_link_code();
899 ($otherldflags) = $attribs{OTHERLDFLAGS} || "";
903 OTHERLDFLAGS = $otherldflags
907 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(BASEEXT).opt $(INST_ARCHAUTODIR).exists
908 @ $(MKPATH) $(INST_ARCHAUTODIR)
909 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
910 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
913 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
918 my($self, %attribs) = @_;
920 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
921 $self = $ExtUtils::MakeMaker::Parent[-1];
925 ' unless $self->has_link_code();
927 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
929 # As MakeMaker mkbootstrap might not write a file (if none is required)
930 # we use touch to prevent make continually trying to remake it.
931 # The DynaLoader only reads a non-empty file.
932 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
933 @ Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
934 @ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
935 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
936 @ $(TOUCH) $(MMS$TARGET)
937 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
939 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
940 @ $(RM_RF) $(INST_BOOT)
941 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
942 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
945 # --- Static Loading Sections ---
950 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
951 $self = $ExtUtils::MakeMaker::Parent[-1];
953 return '' unless $self->needs_linking();
958 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
962 # Rely on suffix rule for update action
963 $(OBJECT) : $(INST_ARCHAUTODIR).exists
965 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
967 # If this extension has it's own library (eg SDBM_File)
968 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
969 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
972 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
973 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
974 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
975 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
977 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
982 sub installpm_x { # called by installpm perl file
983 my($self, $dist, $inst, $splitlib) = @_;
985 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
986 $self = $ExtUtils::MakeMaker::Parent[-1];
988 warn "Warning: Most probably 'make' will have problems processing this file: $inst\n"
990 $inst = $self->fixpath($inst);
991 $dist = $self->fixpath($dist);
992 my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
996 $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
997 ",' @ $(RM_F) $(MMS$TARGET)
998 @ $(CP) ',"$dist $inst",'
999 $(CHMOD) 644 $(MMS$TARGET)
1000 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
1002 push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1003 $self->catdir($splitlib,'auto')."\n\n")
1004 if ($splitlib and $inst =~ /\.pm$/);
1005 push(@m,$self->dir_target($instdir));
1012 my($self, %attribs) = @_;
1014 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1015 $self = $ExtUtils::MakeMaker::Parent[-1];
1017 return "\nmanifypods :\n\t\$(NOOP)\n" unless %{$self->{MAN3PODS}};
1019 my($pod2man_exe,$found_pod2man);
1020 if (defined $self->{PERL_SRC}) {
1021 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1023 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
1025 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1027 # No pod2man but some MAN3PODS to be installed
1030 Warning: I could not locate your pod2man program. As a last choice,
1031 I will look for the file to which the logical name POD2MAN
1032 points when MMK is invoked.
1035 $pod2man_exe = "pod2man";
1039 qq[POD2MAN_EXE = $pod2man_exe\n],
1040 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1041 -e "system(""$^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1043 push @m, "\nmanifypods : ";
1044 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1046 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1048 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1049 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1050 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1052 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1053 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1054 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1064 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1065 $self = $ExtUtils::MakeMaker::Parent[-1];
1067 return "" unless $self->{PL_FILES};
1069 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1071 all :: $self->{PL_FILES}->{$plfile}
1074 $self->{PL_FILES}->{$plfile} :: $plfile
1075 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1085 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1086 $self = $ExtUtils::MakeMaker::Parent[-1];
1088 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1089 return '' unless @{$self->{EXE_FILES}};
1090 my(@m, $from, $to, %fromto, @to, $line);
1091 for $from (@{$self->{EXE_FILES}}) {
1092 my($path) = '$(INST_EXE)' . basename($from);
1093 local($_) = $path; # backward compatibility
1094 $to = $self->exescan($path);
1095 print "exescan($from) => '$to'\n" if ($Verbose >=2);
1098 @to = values %fromto;
1100 EXE_FILES = @{$self->{EXE_FILES}}
1107 $line = ''; #avoid unitialized var warning
1109 if (length($line) + length($to) > 80) {
1110 push @m, "\t\$(RM_F) $line\n";
1113 else { $line .= " $to"; }
1115 push @m, "\t\$(RM_F) $line\n\n";
1117 while (($from,$to) = each %fromto) {
1119 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1120 else { ($todir = $to) =~ s/[^\)]+$//; }
1121 $todir = $self->fixpath($todir,1);
1123 $to : $from \$(MAKEFILE) ${todir}.exists
1126 ", $self->dir_target($todir);
1132 # --- Sub-directory Sections ---
1137 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1138 $self = $ExtUtils::MakeMaker::Parent[-1];
1143 foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1144 INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
1145 push @pasthru, "$key=\"$self->{$key}\"";
1148 push @m, "\nPASTHRU = \\\n ", join (",\\\n ", @pasthru), "\n";
1154 my($self, $subdir) = @_;
1156 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1157 $self = $ExtUtils::MakeMaker::Parent[-1];
1160 $subdir = $self->fixpath($subdir,1);
1164 olddef = F$Environment("Default")
1165 Set Default ',$subdir,'
1166 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1167 Set Default \'olddef\'
1173 # --- Cleanup and Distribution Sections ---
1176 my($self, %attribs) = @_;
1178 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1179 $self = $ExtUtils::MakeMaker::Parent[-1];
1183 # Delete temporary files but do not touch installed files. We don\'t delete
1184 # the Descrip.MMS here so that a later make realclean still has it to use.
1187 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1188 my($vmsdir) = $self->fixpath($dir,1);
1189 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1190 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1192 push @m, ' $(RM_F) *.Map *.lis *.cpp *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso
1195 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1196 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1197 push(@otherfiles, 'blib.dir', 'Makeaperl.MMS', 'extralibs.ld', 'perlmain.c');
1198 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1200 $line = ''; #avoid unitialized var warning
1201 foreach $file (@otherfiles) {
1202 $file = $self->fixpath($file);
1203 if (length($line) + length($file) > 80) {
1204 push @m, "\t\$(RM_RF) $line\n";
1207 else { $line .= " $file"; }
1209 push @m, "\t\$(RM_RF) $line\n\n";
1210 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1216 my($self, %attribs) = @_;
1218 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1219 $self = $ExtUtils::MakeMaker::Parent[-1];
1223 # Delete temporary files (via clean) and also delete installed files
1226 foreach(@{$self->{DIR}}){
1227 my($vmsdir) = $self->fixpath($_,1);
1228 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1229 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1231 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1233 # We can't expand several of the MMS macros here, since they don't have
1234 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1235 # combination of macros). In order to stay below DCL's 255 char limit,
1236 # we put only 2 on a line.
1237 my($file,$line,$fcnt);
1238 my(@files) = qw{ *.Opt $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(INST_PM) $(OBJECT) $(MAKEFILE) $(MAKEFILE)_old };
1239 $line = ''; #avoid unitialized var warning
1240 foreach $file (@files) {
1241 $file = $self->fixpath($file);
1242 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1243 push @m, "\t\$(RM_F) $line\n";
1247 else { $line .= " $file"; }
1249 push @m, "\t\$(RM_F) $line\n";
1250 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1252 foreach $file (@{$attribs{'FILES'}}) {
1253 $file = $self->fixpath($file);
1254 if (length($line) + length($file) > 80) {
1255 push @m, "\t\$(RM_RF) $line\n";
1258 else { $line .= " $file"; }
1260 push @m, "\t\$(RM_RF) $line\n";
1262 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1270 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1271 $self = $ExtUtils::MakeMaker::Parent[-1];
1274 distclean :: realclean distcheck
1278 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1281 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1284 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1292 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1293 $self = $ExtUtils::MakeMaker::Parent[-1];
1296 dist : $(DIST_DEFAULT)
1299 zipdist : $(DISTVNAME).zip$(SUFFIX)
1302 $(DISTVNAME).zip$(SUFFIX) : distdir
1304 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1305 $(RM_RF) $(DISTVNAME)
1310 $(SHARE) $(SRC) $(DISTVNAME).share$(SUFFIX)
1311 $(RM_RF) $(DISTVNAME)
1320 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1321 $self = $ExtUtils::MakeMaker::Parent[-1];
1325 $(RM_RF) $(DISTVNAME)
1326 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1327 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1335 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1336 $self = $ExtUtils::MakeMaker::Parent[-1];
1340 startdir = F$Environment("Default")
1341 Set Default [.$(DISTVNAME)]
1342 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1345 Set Default 'startdir'
1352 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1353 $self = $ExtUtils::MakeMaker::Parent[-1];
1359 # --- Test and Installation Sections ---
1364 my($self, %attribs) = @_;
1366 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1367 $self = $ExtUtils::MakeMaker::Parent[-1];
1372 @ Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
1373 @ $(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\
1374 -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
1375 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'XS_VERSION=$(XS_VERSION)', 'EXE_FILES=$(EXE_FILES)')" \\
1376 >>$(INSTALLARCHLIB)perllocal.pod
1380 install :: pure_install doc_install
1383 # Interim solution for VMS; assumes directory tree of same structure under
1384 # both \$(INST_LIB) and \$(INSTALLPRIVLIB). This operation will be assumed
1385 # into MakeMaker in a (near) future version.
1388 # # install subdirectories first
1389 # foreach(@{$self->{DIR}}){
1390 # my($vmsdir) = $self->fixpath($_,1);
1391 # push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1392 # '; print `$(MMS) install`"'."\n");
1395 # push(@m, ' @ $(PERL) "-I$(PERL_LIB)" -e "use File::Path; mkpath(\@ARGV)" $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
1396 # @ $(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLPRIVLIB)
1397 # @ $(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLARCHLIB)',"
1398 # # Can't install manpages here -- INST_MAN%DIR macros make line >255 chars
1399 # \$(MMS) \$(USEMACROS)INST_LIB=$self->{INSTALLPRIVLIB},INST_ARCHLIB=$self->{INSTALLARCHLIB},INST_EXE=$self->{INSTALLBIN}\$(MACROEND)",'
1400 # @ $(PERL) -i_bak -lne "print unless $seen{$_}++" $(INST_ARCHAUTODIR).packlist
1403 my($curtop,$insttop);
1404 ($curtop = $self->fixpath($self->{INST_LIB},1)) =~ s/]$//;
1405 ($insttop = $self->fixpath($self->{INSTALLPRIVLIB},1)) =~ s/]$//;
1406 push(@m," Backup/Log ${curtop}...]*.*; ${insttop}...]/New_Version/By_Owner=Parent\n");
1409 ##### UNINSTALL IS STILL EXPERIMENTAL ####
1412 foreach(@{$self->{DIR}}){
1413 my($vmsdir) = $self->fixpath($_,1);
1414 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1415 '; print `$(MMS) uninstall`"'."\n");
1417 push @m, "\t".'$(PERL) -le "use File::Path; foreach (<>) {s/',"$curtop/$insttop/;",'rmtree($_,1,0);}" <$(INST_ARCHAUTODIR).packlist
1427 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1428 $self = $ExtUtils::MakeMaker::Parent[-1];
1433 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1434 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1435 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1436 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1437 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1438 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1439 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1441 ' if $self->{OBJECT};
1444 # Check for unpropagated config.sh changes. Should never happen.
1445 # We do NOT just update config.h because that is not sufficient.
1446 # An out of date config.h is not fatal but complains loudly!
1447 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1448 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1449 @ Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1451 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1452 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1453 @ Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1454 olddef = F$Environment("Default")
1455 Set Default $(PERL_SRC)
1456 $(MMS) $(USEMAKEFILE)[.VMS]$(MAKEFILE) [.lib.',$Config{'arch'},']config.pm
1457 Set Default \'olddef\'
1458 ') if $self->{PERL_SRC};
1460 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1469 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1470 $self = $ExtUtils::MakeMaker::Parent[-1];
1473 # We do not know what target was originally specified so we
1474 # must force a manual rerun to be sure. But as it should only
1475 # happen very rarely it is not a significant problem.
1477 $(OBJECT) : $(FIRST_MAKEFILE)
1478 ' if $self->{OBJECT};
1481 # We take a very conservative approach here, but it\'s worth it.
1482 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1483 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1484 @ Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1485 @ Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1486 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1487 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1488 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',@ARGV),'
1489 @ Write Sys$Output "$(MAKEFILE) has been rebuilt."
1490 @ Write Sys$Output "Please run $(MMS) to build the extension."
1498 my($self, %attribs) = @_;
1500 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1501 $self = $ExtUtils::MakeMaker::Parent[-1];
1503 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1507 TEST_TYPE=test_\$(LINKTYPE)
1509 test : \$(TEST_TYPE)
1512 foreach(@{$self->{DIR}}){
1513 my($vmsdir) = $self->fixpath($_,1);
1514 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1515 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1517 push(@m, "\t\@ Write Sys\$Output 'No tests defined for \$(NAME) extension.'\n")
1518 unless $tests or -f "test.pl" or @{$self->{DIR}};
1521 push(@m, "test_dynamic :: all\n");
1522 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1523 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1526 # Occasionally we may face this degenerate target:
1527 push @m, "test_ : test_dynamic\n\n";
1529 if ($self->needs_linking()) {
1530 push(@m, "test_static :: all \$(MAP_TARGET)\n");
1531 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
1532 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
1536 push @m, "test_static :: test_dynamic\n";
1543 sub test_via_harness {
1544 my($self,$perl,$tests) = @_;
1546 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1547 $self = $ExtUtils::MakeMaker::Parent[-1];
1549 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
1550 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
1554 sub test_via_script {
1555 my($self,$perl,$script) = @_;
1557 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1558 $self = $ExtUtils::MakeMaker::Parent[-1];
1560 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl
1566 my($self, %attribs) = @_;
1568 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1569 $self = $ExtUtils::MakeMaker::Parent[-1];
1571 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1572 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1575 # --- MakeMaker makeaperl section ---
1576 MAP_TARGET = $target
1578 return join '', @m if $self->{PARENT};
1580 my($dir) = join ":", @{$self->{DIR}};
1582 unless ($self->{MAKEAPERL}) {
1584 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1585 @ Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
1586 @ $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
1587 Makefile.PL DIR=}, $dir, q{ \
1588 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1589 MAKEAPERL=1 NORECURS=1
1591 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
1592 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
1594 push @m, map( " \\\n\t\t$_", @ARGV );
1601 my($linkcmd,@staticopts,@staticpkgs,$extralist,$target,$targdir,$libperldir);
1603 # The front matter of the linkcommand...
1604 $linkcmd = join ' ', $Config{'ld'},
1605 grep($_, @Config{qw(large split ldflags ccdlflags)});
1606 $linkcmd =~ s/\s+/ /g;
1608 # Which *.olb files could we make use of...
1610 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
1611 File::Find::find(sub {
1612 return unless m/\Q$self->{LIB_EXT}\E$/;
1613 return if m/^libperl/;
1614 $olbs{$ENV{DEFAULT}} = $_;
1615 }, grep( -d $_, @{$searchdirs || []}));
1617 # We trust that what has been handed in as argument will be buildable
1618 $static = [] unless $static;
1619 @olbs{@{$static}} = (1) x @{$static};
1621 $extra = [] unless $extra && ref $extra eq 'ARRAY';
1622 # Sort the object libraries in inverse order of
1623 # filespec length to try to insure that dependent extensions
1624 # will appear before their parents, so the linker will
1625 # search the parent library to resolve references.
1626 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
1627 # references from [.intuit.dwim]dwim.obj can be found
1628 # in [.intuit]intuit.olb).
1629 for (sort keys %olbs) {
1630 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
1631 my($dir) = $self->fixpath($_,1);
1632 my($extralibs) = $dir . "extralibs.ld";
1633 my($extopt) = $dir . $olbs{$_};
1634 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
1635 if (-f $extralibs ) {
1636 open LIST,$extralibs or warn $!,next;
1637 push @$extra, <LIST>;
1641 open OPT,$extopt or die $!;
1643 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
1644 # ExtUtils::Miniperl expects Unix paths
1645 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
1646 push @staticpkgs,$pkg;
1648 push @staticopts, $extopt;
1652 $target = "Perl.Exe" unless $target;
1653 ($shrtarget,$targdir) = fileparse($target);
1654 $shrtarget =~ s/^([^.]*)/$1Shr/;
1655 $shrtarget = $targdir . $shrtarget;
1656 $target = "Perlshr.$Config{'dlext'}" unless $target;
1657 $tmp = "[]" unless $tmp;
1658 $tmp = $self->fixpath($tmp,1);
1660 $extralist = join(' ',@$extra);
1661 $extralist =~ s/[,\s\n]+/, /g;
1663 else { $extralist = ''; }
1665 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
1666 print STDOUT "Warning: $libperl not found\n";
1671 if (defined $self->{PERL_SRC}) {
1672 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
1673 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
1675 print STDOUT "Warning: $libperl not found
1676 If you're going to build a static perl binary, make sure perl is installed
1677 otherwise ignore this warning\n";
1680 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
1683 # Fill in the target you want to produce if it\'s not perl
1684 MAP_TARGET = ',$self->fixpath($target),'
1685 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
1686 MAP_LINKCMD = $linkcmd
1687 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
1688 # We use the linker options files created with each extension, rather than
1689 #specifying the object files directly on the command line.
1690 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
1691 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
1692 MAP_EXTRA = $extralist
1693 MAP_LIBPERL = ",$self->fixpath($libperl),'
1698 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
1699 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
1700 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
1701 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
1702 @ Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
1703 @ Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
1704 @ Write Sys$Output "To remove the intermediate files, say
1705 @ Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
1708 ',"${tmp}perlmain.c",' : $(MAKEFILE)
1709 @ $(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
1714 @ $(PERL) -e "use ExtUtils::MakeMaker; MY->new()->writedoc('Perl binary','$(MAP_TARGET)','MAP_STATIC=$(MAP_STATIC)','MAP_EXTRA=$(MAP_EXTRA)','MAP_LIBPERL=$(MAP_LIBPERL)')"
1718 inst_perl : pure_inst_perl doc_inst_perl
1721 pure_inst_perl : \$(MAP_TARGET)
1722 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
1723 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
1729 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
1730 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
1739 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1740 $self = $ExtUtils::MakeMaker::Parent[-1];
1747 my($self,%attribs) = @_;
1749 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1750 $self = $ExtUtils::MakeMaker::Parent[-1];
1753 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
1754 my($procs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS};
1755 my($package,$packprefix,$sym,$optname);
1759 $package = $self->{NAME};
1760 $package =~ s/\W/_/g;
1761 $procs = { $package => ["boot_$package"] };
1763 my($isvax) = $Config{'arch'} =~ /VAX/i;
1765 # Options file declaring universal symbols
1766 # Used when linking shareable image for dynamic extension,
1767 # or when linking PerlShr into which we've added this package
1768 # as a static extension
1769 # We don't do anything to preserve order, so we won't relax
1770 # the GSMATCH criteria for a dynamic extension
1772 # BASEEXT is not available when mksymlists is run, so we
1773 # create the options file name directly from NAME
1774 # May cause trouble if Makefile.PL author specifies NAME
1775 # and BASEEXT directly as unrelated strings.
1776 ($optname = $self->{NAME}) =~ s/.*:://;
1777 open OPT, ">$optname.opt";
1778 foreach $package (keys %$procs) {
1779 ($packprefix = $package) =~ s/\W/_/g;
1780 foreach $sym (@{$$procs{$package}}) {
1781 $sym = "XS_${packprefix}_$sym" unless $sym =~ /^boot_/;
1782 if ($isvax) { print OPT "UNIVERSAL=$sym\n" }
1783 else { print OPT "SYMBOL_VECTOR=($sym=PROCEDURE)\n"; }
1786 foreach $sym (@$vars) {
1787 print OPT "PSECT_ATTR=${sym},PIC,OVR,RD,NOEXE,WRT,NOSHR\n";
1788 if ($isvax) { print OPT "UNIVERSAL=$sym\n" }
1789 else { print OPT "SYMBOL_VECTOR=($sym=DATA)\n"; }
1793 # Options file specifying RTLs to which this extension must be linked.
1794 # Eventually, the list of libraries will be supplied by a working
1795 # extliblist routine.
1796 open OPT,'>rtls.opt';
1797 print OPT "PerlShr/Share\n";
1798 foreach $rtl (split(/\s+/,$Config{'libs'})) { print OPT "$rtl\n"; }
1803 # --- Make-Directories section (internal method) ---
1804 # dir_target(@array) returns a Makefile entry for the file .exists in each
1805 # named directory. Returns nothing, if the entry has already been processed.
1806 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
1807 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
1808 # prerequisite, because there has to be one, something that doesn't change
1812 my($self,@dirs) = @_;
1814 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1815 $self = $ExtUtils::MakeMaker::Parent[-1];
1818 foreach $dir (@dirs) {
1819 next if $self->{DIR_TARGET}{$self}{$dir}++;
1820 my($vmsdir) = $self->fixpath($dir,1);
1822 ${vmsdir}.exists :: \$(PERL_INC)perl.h
1823 \@ \$(MKPATH) $vmsdir
1824 \@ \$(TOUCH) ${vmsdir}.exists
1831 # --- Output postprocessing section ---
1834 # Insure that colons marking targets are preceded by space -
1835 # most Unix Makes don't need this, but it's necessary under VMS
1836 # to distinguish the target delimiter from a colon appearing as
1837 # part of a filespec.
1839 my($self,$text) = @_;
1841 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1842 $self = $ExtUtils::MakeMaker::Parent[-1];
1844 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;