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 # AFS users will want to set the installation directories for
304 # the final 'make install' early without setting INST_LIB,
305 # INST_ARCHLIB, and INST_EXE for the testing phase
306 INSTALLPRIVLIB = ",$self->fixpath($self->{INSTALLPRIVLIB},1),'
307 INSTALLARCHLIB = ',$self->fixpath($self->{INSTALLARCHLIB},1),'
308 INSTALLBIN = ',$self->fixpath($self->{INSTALLBIN},1),'
310 # Perl library to use when building the extension
311 PERL_LIB = ',$self->fixpath($self->{PERL_LIB},1),'
312 PERL_ARCHLIB = ',$self->fixpath($self->{PERL_ARCHLIB},1),'
313 LIBPERL_A = ',$self->fixpath($self->{LIBPERL_A}),'
315 MAKEMAKER = ',$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),"
316 MM_VERSION = $ExtUtils::MakeMaker::VERSION
317 FIRST_MAKEFILE = ",$self->fixpath($self->{FIRST_MAKEFILE}),'
318 MAKE_APERL_FILE = ',$self->fixpath($self->{MAKE_APERL_FILE}),"
320 PERLMAINCC = $self->{PERLMAINCC}
323 if ($self->{PERL_SRC}) {
325 # Where is the perl source code located?
326 PERL_SRC = ",$self->fixpath($self->{PERL_SRC},1);
328 PERL_VMS = ",$self->catdir($self->{PERL_SRC},q(VMS));
331 # Perl header files (will eventually be under PERL_LIB)
332 PERL_INC = ",$self->fixpath($self->{PERL_INC},1),"
335 FULLPERL = $self->{FULLPERL}
337 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
338 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
339 # ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD)
340 FULLEXT = ",$self->fixpath($self->{FULLEXT},1),"
341 BASEEXT = $self->{BASEEXT}
342 ROOTEXT = ",($self->{ROOTEXT} eq '') ? '[]' : $self->fixpath($self->{ROOTEXT},1),"
343 DLBASE = $self->{DLBASE}
346 if ($self->{'INC'}) {
347 push @m,'/Include=(';
348 my(@includes) = split(/\s+/,$self->{INC});
350 foreach (@includes) {
352 push @m,', ' if $plural++;
353 push @m,$self->fixpath($_,1);
358 if ($self->{DEFINE} ne '') {
359 my(@defs) = split(/\s+/,$self->{DEFINE});
360 foreach $def (@defs) {
363 $def = "\"$def\"" if $def =~ /=/;
365 $self->{DEFINE} = join ',',@defs;
368 if ($self->{OBJECT} =~ /\s/) {
369 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
370 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
372 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
375 DEFINE = $self->{DEFINE}
376 OBJECT = $self->{OBJECT}
377 LDFROM = $self->{LDFROM}
378 LINKTYPE = $self->{LINKTYPE}
380 # Handy lists of source code files:
381 XS_FILES = ",join(', ', sort keys %{$self->{XS}}),'
382 C_FILES = ',join(', ', @{$self->{C}}),'
383 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
384 H_FILES = ',join(', ', @{$self->{H}}),'
385 MAN1PODS = ',join(" \\\n\t", sort keys %{$self->{MAN1PODS}}),'
386 MAN3PODS = ',join(" \\\n\t", sort keys %{$self->{MAN3PODS}}),'
388 # Man installation stuff:
389 INST_MAN1DIR = ',$self->fixpath($self->{INST_MAN1DIR},1),'
390 INSTALLMAN1DIR = ',$self->fixpath($self->{INSTALLMAN1DIR},1),"
391 MAN1EXT = $self->{MAN1EXT}
393 INST_MAN3DIR = ",$self->fixpath($self->{INST_MAN3DIR},1),'
394 INSTALLMAN3DIR = ',$self->fixpath($self->{INSTALLMAN3DIR},1),"
395 MAN3EXT = $self->{MAN3EXT}
398 .SUFFIXES : .xs .c \$(OBJ_EXT)
400 # This extension may link to it's own library (see SDBM_File)";
402 MYEXTLIB = ",$self->fixpath($self->{MYEXTLIB}),"
404 # Here is the Config.pm that we are using/depend on
405 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h
407 # Where to put things:
408 INST_LIBDIR = ",($self->{'INST_LIBDIR'} = $self->catdir($self->{INST_LIB},$self->{ROOTEXT})),"
409 INST_ARCHLIBDIR = ",($self->{'INST_ARCHLIBDIR'} = $self->catdir($self->{INST_ARCHLIB},$self->{ROOTEXT})),"
411 INST_AUTODIR = ",($self->{'INST_AUTODIR'} = $self->catdir($self->{INST_LIB},'auto',$self->{FULLEXT})),'
412 INST_ARCHAUTODIR = ',($self->{'INST_ARCHAUTODIR'} = $self->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT})),'
415 if ($self->has_link_code()) {
417 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
418 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
419 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
430 INST_PM = ',join(', ',map($self->fixpath($_),sort values %{$self->{PM}})),'
440 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
441 $self = $ExtUtils::MakeMaker::Parent[-1];
445 # $self->{NAME} might depend on some other libraries.
446 # (These comments may need revising:)
448 # Dependent libraries can be linked in one of three ways:
450 # 1. (For static extensions) by the ld command when the perl binary
451 # is linked with the extension library. See EXTRALIBS below.
453 # 2. (For dynamic extensions) by the ld command when the shared
454 # object is built/linked. See LDLOADLIBS below.
456 # 3. (For dynamic extensions) by the DynaLoader when the shared
457 # object is loaded. See BSLOADLIBS below.
459 # EXTRALIBS = List of libraries that need to be linked with when
460 # linking a perl binary which includes this extension
461 # Only those libraries that actually exist are included.
462 # These are written to a file and used when linking perl.
464 # LDLOADLIBS = List of those libraries which can or must be linked into
465 # the shared library when created using ld. These may be
466 # static or dynamic libraries.
467 # LD_RUN_PATH is a colon separated list of the directories
468 # in LDLOADLIBS. It is passed as an environment variable to
469 # the process that links the shared library.
471 # BSLOADLIBS = List of those libraries that are needed but can be
472 # linked in dynamically at run time on this platform.
473 # SunOS/Solaris does not need this because ld records
474 # the information (from LDLOADLIBS) into the object file.
475 # This list is used to create a .bs (bootstrap) file.
477 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
478 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
479 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
486 my($self,$libperl) = @_;
488 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
489 $self = $ExtUtils::MakeMaker::Parent[-1];
491 my($cmd) = $Config{'cc'};
494 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
495 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
496 " required to modify CC command for $self->{'BASEEXT'}\n"
499 # Deal with $self->{DEFINE} here since some C compilers pay attention
500 # to only one /Define clause on command line, so we have to
501 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
502 if ($cmd =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
503 $cmd = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
504 "\$(DEFINE_VERSION))$3";
505 # "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
508 $cmd .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
509 '$(DEFINE_VERSION))';
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 $cmd =~ 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 ($cmd =~ m:(.*)/include=\(?([^\(\/\)\s]+)\)?(.*):i) {
532 $cmd = "$1$incstr,$2)$3";
534 else { $cmd .= "$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\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
690 TOUCH = $self->{TOUCH}
691 CHMOD = $self->{CHMOD}
695 RM_RF = $self->{RM_RF}
696 UMASK_NULL = $self->{UMASK_NULL}
697 MKPATH = Create/Directory
703 my($self, %attribs) = @_;
705 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
706 $self = $ExtUtils::MakeMaker::Parent[-1];
708 # VERSION should be sanitised before use as a file name
709 my($name) = $attribs{NAME} || '$(DISTVNAME)';
710 my($zip) = $attribs{ZIP} || 'zip';
711 my($zipflags) = $attribs{ZIPFLAGS} || '-Vu';
712 my($suffix) = $attribs{SUFFIX} || '';
713 my($shar) = $attribs{SHAR} || 'vms_share';
714 my($preop) = $attribs{PREOP} || '!'; # e.g., update MANIFEST
715 my($postop) = $attribs{POSTOP} || '!';
716 my($dist_cp) = $attribs{DIST_CP} || 'best';
717 my($dist_default) = $attribs{DIST_DEFAULT} || 'zipdist';
720 $src = "[.$src]" unless $src =~ /\[/;
722 $src .= '*.*' if $src =~ /\]$/;
725 DISTVNAME = \$(DISTNAME)-\$(VERSION_SYM)
734 DIST_DEFAULT = $dist_default
739 # --- Translation Sections ---
744 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
745 $self = $ExtUtils::MakeMaker::Parent[-1];
747 return '' unless $self->needs_linking();
750 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
757 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
758 $self = $ExtUtils::MakeMaker::Parent[-1];
760 return '' unless $self->needs_linking();
763 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
767 sub xs_o { # many makes are too dumb to use xs_c then c_o
770 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
771 $self = $ExtUtils::MakeMaker::Parent[-1];
773 return '' unless $self->needs_linking();
776 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
777 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
782 # --- Target Sections ---
788 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
789 $self = $ExtUtils::MakeMaker::Parent[-1];
793 all :: config $(INST_PM) subdirs linkext manifypods
796 subdirs :: $(MYEXTLIB)
799 config :: $(MAKEFILE) $(INST_LIBDIR).exists
801 config :: $(INST_ARCHAUTODIR).exists Version_check
803 config :: $(INST_AUTODIR).exists
807 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
808 if (%{$self->{MAN1PODS}}) {
810 config :: $(INST_MAN1DIR)/.exists
812 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
814 if (%{$self->{MAN3PODS}}) {
816 config :: $(INST_MAN3DIR).exists
818 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
822 $(O_FILES) : $(H_FILES)
823 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
827 perldoc ExtUtils::MakeMaker
832 @ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
833 -e "use ExtUtils::MakeMaker qw($Version &Version_check);" -
834 -e "&Version_check('$(MM_VERSION)')"
842 my($self,%attribs) = @_;
844 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
845 $self = $ExtUtils::MakeMaker::Parent[-1];
847 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
848 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
852 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
855 # rtls.opt is built in the same step as $(BASEEXT).opt
856 rtls.opt : $(BASEEXT).opt
857 $(TOUCH) $(MMS$TARGET)
858 ') unless $self->{SKIPHASH}{'dynamic'};
861 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
863 ') unless $self->{SKIPHASH}{'static'};
866 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
867 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
868 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
870 $(BASEEXT).opt : makefile.PL
871 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::MakeMaker qw(&mksymlists);" -
872 -e "MM->new()->mksymlists({DL_FUNCS => ',neatvalue($self->{DL_FUNCS}),', DL_VARS => ',neatvalue($self->{DL_VARS}),',NAME => \'',$self->{NAME},'\'})"
873 $(PERL) -e "open OPT,\'>>$(MMS$TARGET)\'; print OPT ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";close OPT"
880 # --- Dynamic Loading Sections ---
883 my($self, %attribs) = @_;
885 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
886 $self = $ExtUtils::MakeMaker::Parent[-1];
888 return '' unless $self->needs_linking(); #might be because of a subdir
894 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
896 ($otherldflags) = $attribs{OTHERLDFLAGS} || "";
900 OTHERLDFLAGS = $otherldflags
904 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(BASEEXT).opt $(INST_ARCHAUTODIR).exists
905 @ $(MKPATH) $(INST_ARCHAUTODIR)
906 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
907 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
910 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
915 my($self, %attribs) = @_;
917 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
918 $self = $ExtUtils::MakeMaker::Parent[-1];
920 return '' unless $self->needs_linking();
922 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
924 # As MakeMaker mkbootstrap might not write a file (if none is required)
925 # we use touch to prevent make continually trying to remake it.
926 # The DynaLoader only reads a non-empty file.
927 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".'
928 @ Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
929 @ $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
930 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
931 @ $(TOUCH) $(MMS$TARGET)
932 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
934 $(INST_BOOT) : $(BOOTSTRAP)
935 @ $(RM_RF) $(INST_BOOT)
936 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
937 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
940 # --- Static Loading Sections ---
945 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
946 $self = $ExtUtils::MakeMaker::Parent[-1];
948 return '' unless $self->needs_linking();
953 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
957 # Rely on suffix rule for update action
958 $(OBJECT) : $(INST_ARCHAUTODIR).exists
960 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
962 # If this extension has it's own library (eg SDBM_File)
963 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
964 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
967 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
968 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
969 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
970 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
972 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
977 sub installpm_x { # called by installpm perl file
978 my($self, $dist, $inst, $splitlib) = @_;
980 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
981 $self = $ExtUtils::MakeMaker::Parent[-1];
983 warn "Warning: Most probably 'make' will have problems processing this file: $inst\n"
985 $inst = $self->fixpath($inst);
986 $dist = $self->fixpath($dist);
987 my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
991 $inst : $dist \$(MAKEFILE) ${instdir}.exists
992 ",' @ $(RM_F) $(MMS$TARGET)
993 @ $(CP) ',"$dist $inst",'
994 $(CHMOD) 644 $(MMS$TARGET)
995 @ $(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
997 push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
998 $self->catdir($splitlib,'auto')."\n\n")
999 if ($splitlib and $inst =~ /\.pm$/);
1000 push(@m,$self->dir_target($instdir));
1007 my($self, %attribs) = @_;
1009 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1010 $self = $ExtUtils::MakeMaker::Parent[-1];
1012 return "\nmanifypods :\n\t\$(NOOP)\n" unless %{$self->{MAN3PODS}};
1014 my($pod2man_exe,$found_pod2man);
1015 if (defined $self->{PERL_SRC}) {
1016 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1018 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
1020 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1022 # No pod2man but some MAN3PODS to be installed
1025 Warning: I could not locate your pod2man program. As a last choice,
1026 I will look for the file to which the logical name POD2MAN
1027 points when MMK is invoked.
1030 $pod2man_exe = "pod2man";
1034 qq[POD2MAN_EXE = $pod2man_exe\n],
1035 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1036 -e "system(""$(PERL) $(POD2MAN_EXE) $_ >$m{$_}"");}"
1038 push @m, "\nmanifypods : ";
1039 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1041 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1043 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1044 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1045 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1047 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1048 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1049 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1059 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1060 $self = $ExtUtils::MakeMaker::Parent[-1];
1062 return "" unless $self->{PL_FILES};
1064 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1066 all :: $self->{PL_FILES}->{$plfile}
1069 $self->{PL_FILES}->{$plfile} :: $plfile
1070 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1080 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1081 $self = $ExtUtils::MakeMaker::Parent[-1];
1083 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1084 return '' unless @{$self->{EXE_FILES}};
1085 my(@m, $from, $to, %fromto, @to, $line);
1086 for $from (@{$self->{EXE_FILES}}) {
1087 my($path) = '$(INST_EXE)' . basename($from);
1088 local($_) = $path; # backward compatibility
1089 $to = $self->exescan($path);
1090 print "exescan($from) => '$to'\n" if ($Verbose >=2);
1093 @to = values %fromto;
1095 EXE_FILES = @{$self->{EXE_FILES}}
1102 $line = ''; #avoid unitialized var warning
1104 if (length($line) + length($to) > 80) {
1105 push @m, "\t\$(RM_F) $line\n";
1108 else { $line .= " $to"; }
1110 push @m, "\t\$(RM_F) $line\n\n";
1112 while (($from,$to) = each %fromto) {
1114 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1115 else { ($todir = $to) =~ s/[^\)]+$//; }
1116 $todir = $self->fixpath($todir,1);
1118 $to : $from \$(MAKEFILE) ${todir}.exists
1121 ", $self->dir_target($todir);
1127 # --- Sub-directory Sections ---
1132 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1133 $self = $ExtUtils::MakeMaker::Parent[-1];
1138 foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1139 INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
1140 push @pasthru, "$key=\"$self->{$key}\"";
1143 push @m, "\nPASTHRU = \\\n ", join (",\\\n ", @pasthru), "\n";
1149 my($self, $subdir) = @_;
1151 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1152 $self = $ExtUtils::MakeMaker::Parent[-1];
1155 $subdir = $self->fixpath($subdir,1);
1159 olddef = F$Environment("Default")
1160 Set Default ',$subdir,'
1161 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1162 Set Default \'olddef\'
1168 # --- Cleanup and Distribution Sections ---
1171 my($self, %attribs) = @_;
1173 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1174 $self = $ExtUtils::MakeMaker::Parent[-1];
1178 # Delete temporary files but do not touch installed files. We don\'t delete
1179 # the Descrip.MMS here so that a later make realclean still has it to use.
1182 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1183 my($vmsdir) = $self->fixpath($dir,1);
1184 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1185 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1187 push @m, ' $(RM_F) *.Map *.lis *.cpp *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso
1190 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1191 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1192 push(@otherfiles, 'blib.dir', 'Makeaperl.MMS', 'extralibs.ld', 'perlmain.c');
1193 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1195 $line = ''; #avoid unitialized var warning
1196 foreach $file (@otherfiles) {
1197 $file = $self->fixpath($file);
1198 if (length($line) + length($file) > 80) {
1199 push @m, "\t\$(RM_RF) $line\n";
1202 else { $line .= " $file"; }
1204 push @m, "\t\$(RM_RF) $line\n\n";
1205 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1211 my($self, %attribs) = @_;
1213 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1214 $self = $ExtUtils::MakeMaker::Parent[-1];
1218 # Delete temporary files (via clean) and also delete installed files
1221 foreach(@{$self->{DIR}}){
1222 my($vmsdir) = $self->fixpath($_,1);
1223 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1224 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1226 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1228 # We can't expand several of the MMS macros here, since they don't have
1229 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1230 # combination of macros). In order to stay below DCL's 255 char limit,
1231 # we put only 2 on a line.
1232 my($file,$line,$fcnt);
1233 my(@files) = qw{ *.Opt $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(INST_PM) $(OBJECT) $(MAKEFILE) $(MAKEFILE)_old };
1234 $line = ''; #avoid unitialized var warning
1235 foreach $file (@files) {
1236 $file = $self->fixpath($file);
1237 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1238 push @m, "\t\$(RM_F) $line\n";
1242 else { $line .= " $file"; }
1244 push @m, "\t\$(RM_F) $line\n";
1245 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1247 foreach $file (@{$attribs{'FILES'}}) {
1248 $file = $self->fixpath($file);
1249 if (length($line) + length($file) > 80) {
1250 push @m, "\t\$(RM_RF) $line\n";
1253 else { $line .= " $file"; }
1255 push @m, "\t\$(RM_RF) $line\n";
1257 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1265 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1266 $self = $ExtUtils::MakeMaker::Parent[-1];
1269 distclean :: realclean distcheck
1273 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1276 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1279 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1287 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1288 $self = $ExtUtils::MakeMaker::Parent[-1];
1291 dist : $(DIST_DEFAULT)
1294 zipdist : $(DISTVNAME).zip$(SUFFIX)
1297 $(DISTVNAME).zip$(SUFFIX) : distdir
1299 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1300 $(RM_RF) $(DISTVNAME)
1305 $(SHARE) $(SRC) $(DISTVNAME).share$(SUFFIX)
1306 $(RM_RF) $(DISTVNAME)
1315 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1316 $self = $ExtUtils::MakeMaker::Parent[-1];
1320 $(RM_RF) $(DISTVNAME)
1321 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1322 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1330 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1331 $self = $ExtUtils::MakeMaker::Parent[-1];
1335 startdir = F$Environment("Default")
1336 Set Default [.$(DISTVNAME)]
1337 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1340 Set Default 'startdir'
1347 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1348 $self = $ExtUtils::MakeMaker::Parent[-1];
1354 # --- Test and Installation Sections ---
1359 my($self, %attribs) = @_;
1361 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1362 $self = $ExtUtils::MakeMaker::Parent[-1];
1367 @ Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
1368 @ $(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\
1369 -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
1370 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'EXE_FILES=$(EXE_FILES)')" \\
1371 >>$(INSTALLARCHLIB)perllocal.pod
1375 install :: pure_install doc_install
1378 # Interim solution for VMS; assumes directory tree of same structure under
1379 # both \$(INST_LIB) and \$(INSTALLPRIVLIB). This operation will be assumed
1380 # into MakeMaker in a (near) future version.
1383 # # install subdirectories first
1384 # foreach(@{$self->{DIR}}){
1385 # my($vmsdir) = $self->fixpath($_,1);
1386 # push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1387 # '; print `$(MMS) install`"'."\n");
1390 # push(@m, ' @ $(PERL) "-I$(PERL_LIB)" -e "use File::Path; mkpath(\@ARGV)" $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
1391 # @ $(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLPRIVLIB)
1392 # @ $(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLARCHLIB)',"
1393 # # Can't install manpages here -- INST_MAN%DIR macros make line >255 chars
1394 # \$(MMS) \$(USEMACROS)INST_LIB=$self->{INSTALLPRIVLIB},INST_ARCHLIB=$self->{INSTALLARCHLIB},INST_EXE=$self->{INSTALLBIN}\$(MACROEND)",'
1395 # @ $(PERL) -i_bak -lne "print unless $seen{$_}++" $(INST_ARCHAUTODIR).packlist
1398 my($curtop,$insttop);
1399 ($curtop = $self->fixpath($self->{INST_LIB},1)) =~ s/]$//;
1400 ($insttop = $self->fixpath($self->{INSTALLPRIVLIB},1)) =~ s/]$//;
1401 push(@m," Backup/Log ${curtop}...]*.*; ${insttop}...]/New_Version/By_Owner=Parent\n");
1404 ##### UNINSTALL IS STILL EXPERIMENTAL ####
1407 foreach(@{$self->{DIR}}){
1408 my($vmsdir) = $self->fixpath($_,1);
1409 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1410 '; print `$(MMS) uninstall`"'."\n");
1412 push @m, "\t".'$(PERL) -le "use File::Path; foreach (<>) {s/',"$curtop/$insttop/;",'rmtree($_,1,0);}" <$(INST_ARCHAUTODIR).packlist
1422 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1423 $self = $ExtUtils::MakeMaker::Parent[-1];
1428 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1429 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1430 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1431 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1432 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1433 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1434 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1436 ' if $self->{OBJECT};
1439 # Check for unpropagated config.sh changes. Should never happen.
1440 # We do NOT just update config.h because that is not sufficient.
1441 # An out of date config.h is not fatal but complains loudly!
1442 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1443 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1444 @ Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1446 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1447 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1448 @ Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1449 olddef = F$Environment("Default")
1450 Set Default $(PERL_SRC)
1451 $(MMS) $(USEMAKEFILE)[.VMS]$(MAKEFILE) [.lib.',$Config{'arch'},']config.pm
1452 Set Default \'olddef\'
1453 ') if $self->{PERL_SRC};
1455 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1464 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1465 $self = $ExtUtils::MakeMaker::Parent[-1];
1468 # We do not know what target was originally specified so we
1469 # must force a manual rerun to be sure. But as it should only
1470 # happen very rarely it is not a significant problem.
1472 $(OBJECT) : $(FIRST_MAKEFILE)
1473 ' if $self->{OBJECT};
1476 # We take a very conservative approach here, but it\'s worth it.
1477 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1478 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1479 @ Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1480 @ Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1481 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1482 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1483 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',@ARGV),'
1484 @ Write Sys$Output "$(MAKEFILE) has been rebuilt."
1485 @ Write Sys$Output "Please run $(MMS) to build the extension."
1493 my($self, %attribs) = @_;
1495 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1496 $self = $ExtUtils::MakeMaker::Parent[-1];
1498 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1502 TEST_TYPE=test_\$(LINKTYPE)
1504 test : \$(TEST_TYPE)
1507 foreach(@{$self->{DIR}}){
1508 my($vmsdir) = $self->fixpath($_,1);
1509 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1510 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1512 push(@m, "\t\@ Write Sys\$Output 'No tests defined for \$(NAME) extension.'\n")
1513 unless $tests or -f "test.pl" or @{$self->{DIR}};
1516 push(@m, "test_dynamic :: all\n");
1517 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1518 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1521 # Occasionally we may face this degenerate target:
1522 push @m, "test_ : test_dynamic\n\n";
1524 if ($self->needs_linking()) {
1525 push(@m, "test_static :: all \$(MAP_TARGET)\n");
1526 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
1527 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
1531 push @m, "test_static :: test_dynamic\n";
1538 sub test_via_harness {
1539 my($self,$perl,$tests) = @_;
1541 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1542 $self = $ExtUtils::MakeMaker::Parent[-1];
1544 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
1545 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
1549 sub test_via_script {
1550 my($self,$perl,$script) = @_;
1552 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1553 $self = $ExtUtils::MakeMaker::Parent[-1];
1555 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl
1561 my($self, %attribs) = @_;
1563 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1564 $self = $ExtUtils::MakeMaker::Parent[-1];
1566 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1567 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1570 # --- MakeMaker makeaperl section ---
1571 MAP_TARGET = $target
1572 FULLPERL = $self->{FULLPERL}
1574 return join '', @m if $self->{PARENT};
1576 my($dir) = join ":", @{$self->{DIR}};
1578 unless ($self->{MAKEAPERL}) {
1580 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
1581 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
1583 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1584 @ Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
1585 @ $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
1586 Makefile.PL DIR=}, $dir, q{ \
1587 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1588 MAKEAPERL=1 NORECURS=1};
1590 push @m, map( " \\\n\t\t$_", @ARGV );
1597 my($linkcmd,@staticopts,@staticpkgs,$extralist,$target,$targdir,$libperldir);
1599 # The front matter of the linkcommand...
1600 $linkcmd = join ' ', $Config{'ld'},
1601 grep($_, @Config{qw(large split ldflags ccdlflags)});
1602 $linkcmd =~ s/\s+/ /g;
1604 # Which *.olb files could we make use of...
1606 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
1607 File::Find::find(sub {
1608 return unless m/\Q$self->{LIB_EXT}\E$/;
1609 return if m/^libperl/;
1610 $olbs{$ENV{DEFAULT}} = $_;
1611 }, grep( -d $_, @{$searchdirs || []}));
1613 # We trust that what has been handed in as argument will be buildable
1614 $static = [] unless $static;
1615 @olbs{@{$static}} = (1) x @{$static};
1617 $extra = [] unless $extra && ref $extra eq 'ARRAY';
1618 # Sort the object libraries in inverse order of
1619 # filespec length to try to insure that dependent extensions
1620 # will appear before their parents, so the linker will
1621 # search the parent library to resolve references.
1622 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
1623 # references from [.intuit.dwim]dwim.obj can be found
1624 # in [.intuit]intuit.olb).
1625 for (sort keys %olbs) {
1626 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
1627 my($dir) = $self->fixpath($_,1);
1628 my($extralibs) = $dir . "extralibs.ld";
1629 my($extopt) = $dir . $olbs{$_};
1630 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
1631 if (-f $extralibs ) {
1632 open LIST,$extralibs or warn $!,next;
1633 push @$extra, <LIST>;
1637 open OPT,$extopt or die $!;
1639 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
1640 # ExtUtils::Miniperl expects Unix paths
1641 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
1642 push @staticpkgs,$pkg;
1644 push @staticopts, $extopt;
1648 $target = "Perl.Exe" unless $target;
1649 ($shrtarget,$targdir) = fileparse($target);
1650 $shrtarget =~ s/^([^.]*)/$1Shr/;
1651 $shrtarget = $targdir . $shrtarget;
1652 $target = "Perlshr.$Config{'dlext'}" unless $target;
1653 $tmp = "[]" unless $tmp;
1654 $tmp = $self->fixpath($tmp,1);
1656 $extralist = join(' ',@$extra);
1657 $extralist =~ s/[,\s\n]+/, /g;
1659 else { $extralist = ''; }
1661 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
1662 print STDOUT "Warning: $libperl not found\n";
1667 if (defined $self->{PERL_SRC}) {
1668 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
1669 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
1671 print STDOUT "Warning: $libperl not found
1672 If you're going to build a static perl binary, make sure perl is installed
1673 otherwise ignore this warning\n";
1676 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
1679 # Fill in the target you want to produce if it\'s not perl
1680 MAP_TARGET = ',$self->fixpath($target),'
1681 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
1682 MAP_LINKCMD = $linkcmd
1683 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
1684 # We use the linker options files created with each extension, rather than
1685 #specifying the object files directly on the command line.
1686 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
1687 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
1688 MAP_EXTRA = $extralist
1689 MAP_LIBPERL = ",$self->fixpath($libperl),'
1694 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
1695 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
1696 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
1697 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
1698 @ Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
1699 @ Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
1700 @ Write Sys$Output "To remove the intermediate files, say
1701 @ Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
1704 ',"${tmp}perlmain.c",' : $(MAKEFILE)
1705 @ $(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
1710 @ $(PERL) -e "use ExtUtils::MakeMaker; MY->new()->writedoc('Perl binary','$(MAP_TARGET)','MAP_STATIC=$(MAP_STATIC)','MAP_EXTRA=$(MAP_EXTRA)','MAP_LIBPERL=$(MAP_LIBPERL)')"
1714 inst_perl : pure_inst_perl doc_inst_perl
1717 pure_inst_perl : \$(MAP_TARGET)
1718 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
1719 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
1725 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
1726 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
1735 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1736 $self = $ExtUtils::MakeMaker::Parent[-1];
1743 my($self,%attribs) = @_;
1745 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1746 $self = $ExtUtils::MakeMaker::Parent[-1];
1749 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
1750 my($procs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS};
1751 my($package,$packprefix,$sym,$optname);
1755 $package = $self->{NAME};
1756 $package =~ s/\W/_/g;
1757 $procs = { $package => ["boot_$package"] };
1759 my($isvax) = $Config{'arch'} =~ /VAX/i;
1761 # Options file declaring universal symbols
1762 # Used when linking shareable image for dynamic extension,
1763 # or when linking PerlShr into which we've added this package
1764 # as a static extension
1765 # We don't do anything to preserve order, so we won't relax
1766 # the GSMATCH criteria for a dynamic extension
1768 # BASEEXT is not available when mksymlists is run, so we
1769 # create the options file name directly from NAME
1770 # May cause trouble if Makefile.PL author specifies NAME
1771 # and BASEEXT directly as unrelated strings.
1772 ($optname = $self->{NAME}) =~ s/.*:://;
1773 open OPT, ">$optname.opt";
1774 foreach $package (keys %$procs) {
1775 ($packprefix = $package) =~ s/\W/_/g;
1776 foreach $sym (@{$$procs{$package}}) {
1777 $sym = "XS_${packprefix}_$sym" unless $sym =~ /^boot_/;
1778 if ($isvax) { print OPT "UNIVERSAL=$sym\n" }
1779 else { print OPT "SYMBOL_VECTOR=($sym=PROCEDURE)\n"; }
1782 foreach $sym (@$vars) {
1783 print OPT "PSECT_ATTR=${sym},PIC,OVR,RD,NOEXE,WRT,NOSHR\n";
1784 if ($isvax) { print OPT "UNIVERSAL=$sym\n" }
1785 else { print OPT "SYMBOL_VECTOR=($sym=DATA)\n"; }
1789 # Options file specifying RTLs to which this extension must be linked.
1790 # Eventually, the list of libraries will be supplied by a working
1791 # extliblist routine.
1792 open OPT,'>rtls.opt';
1793 print OPT "PerlShr/Share\n";
1794 foreach $rtl (split(/\s+/,$Config{'libs'})) { print OPT "$rtl\n"; }
1799 # --- Make-Directories section (internal method) ---
1800 # dir_target(@array) returns a Makefile entry for the file .exists in each
1801 # named directory. Returns nothing, if the entry has already been processed.
1802 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
1803 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
1804 # prerequisite, because there has to be one, something that doesn't change
1808 my($self,@dirs) = @_;
1810 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1811 $self = $ExtUtils::MakeMaker::Parent[-1];
1814 foreach $dir (@dirs) {
1815 next if $self->{DIR_TARGET}{$self}{$dir}++;
1816 my($vmsdir) = $self->fixpath($dir,1);
1818 ${vmsdir}.exists :: \$(PERL_INC)perl.h
1819 \@ \$(MKPATH) $vmsdir
1820 \@ \$(TOUCH) ${vmsdir}.exists
1827 # --- Output postprocessing section ---
1830 # Insure that colons marking targets are preceded by space -
1831 # most Unix Makes don't need this, but it's necessary under VMS
1832 # to distinguish the target delimiter from a colon appearing as
1833 # part of a filespec.
1835 my($self,$text) = @_;
1837 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1838 $self = $ExtUtils::MakeMaker::Parent[-1];
1840 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;