2 # MakeMaker default methods for VMS
3 # This package is inserted into @ISA of MakeMaker's MM before the
4 # built-in ExtUtils::MM_Unix methods if MakeMaker.pm is run under VMS.
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 @dirs = grep($_,@dirs);
94 my($path) = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
95 my($spath,$sdir) = ($path,$dir);
96 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
97 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
98 $rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
100 else { $rslt = vmspath($dir); }
101 print "catdir(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
106 my($self,@files) = @_;
108 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
109 $self = $ExtUtils::MakeMaker::Parent[-1];
111 my($file) = pop @files;
112 @files = grep($_,@files);
115 my($path) = (@files == 1 ? $files[0] : $self->catdir(@files));
118 if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
120 $rslt = $self->eliminate_macros($spath);
121 $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file));
124 else { $rslt = vmsify($file); }
125 print "catfile(",join(',',@_[1..$#_]),") = |$rslt|\n" if $Verbose >= 3;
130 # Default name is taken from the directory name if it's not passed in.
131 # Since VMS filenames are case-insensitive, we actually look in the
132 # extension files to find the Mixed-case name
136 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
137 $self = $ExtUtils::MakeMaker::Parent[-1];
142 $defname = $ENV{'DEFAULT'};
143 $defname =~ s:.*?([^.\]]+)\]:$1:
144 unless ($defname =~ s:.*[.\[]ext\.(.*)\]:$1:i);
145 $defname =~ s#[.\]]#::#g;
146 ($defpm = $defname) =~ s/.*:://;
147 if (open(PM,"${defpm}.pm")){
149 if (/^\s*package\s+([^;]+)/i) {
154 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
155 "defaulting package name to $defname\n"
160 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
161 "defaulting package name to $defname\n";
163 $defname =~ s#[\-_][\d.\-]+$##;
169 my($self, $ver, $names, $dirs, $trace) = @_;
171 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
172 $self = $ExtUtils::MakeMaker::Parent[-1];
174 my($name, $dir,$vmsfile,@cand);
176 print "Looking for perl $ver by these names:\n";
177 print "\t@$names,\n";
178 print "in these dirs:\n";
181 foreach $dir (@$dirs){
182 next unless defined $dir; # $self->{PERL_SRC} may be undefined
183 foreach $name (@$names){
184 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
185 else { push(@cand,$self->fixpath($name)); }
188 foreach $name (sort { length($a) <=> length($b) } @cand) {
189 print "Checking $name\n" if ($trace >= 2);
190 next unless $vmsfile = $self->maybe_command($name);
191 print "Executing $vmsfile\n" if ($trace >= 2);
192 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
193 print "Using PERL=MCR $vmsfile\n" if $trace;
194 return "MCR $vmsfile"
197 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
198 0; # false and not empty
203 my($self,$file) = @_;
204 return $file if -x $file && ! -d _;
205 return "$file.exe" if -x "$file.exe";
206 if ($file !~ m![/:>\]]!) {
207 my($shrfile) = 'Sys$Share:' . $file;
208 return $file if -x $shrfile && ! -d _;
209 return "$file.exe" if -x "$shrfile.exe";
215 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
216 my($self, $names, $dirs, $trace, $ver) = @_;
218 foreach $dir (@$dirs){
219 next unless defined $dir; # $self->{PERL_SRC} may be undefined
220 foreach $name (@$names){
222 if ($self->file_name_is_absolute($name)) {
225 $abs = $self->catfile($dir, $name);
227 print "Checking $abs for $name\n" if ($trace >= 2);
228 next unless $tryabs = $self->maybe_command($abs);
229 print "Substituting $tryabs instead of $abs\n"
230 if ($trace >= 2 and $tryabs ne $abs);
233 print "Executing $abs\n" if ($trace >= 2);
234 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
235 print "Using PERL=$abs\n" if $trace;
238 } else { # Do not look for perl
247 my($self,$file) = @_;
248 return $file if -r $file && ! -d _;
249 return "$file.pl" if -r "$file.pl" && ! -d _;
253 sub file_name_is_absolute {
255 $file =~ m!^/! or $file =~ m![:<\[][^.]!;
259 sub replace_manpage_separator {
261 $man = unixify($man);
270 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
271 $self = $ExtUtils::MakeMaker::Parent[-1];
274 $self->{NOOP} = "\t@ Continue";
275 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
276 $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
277 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
278 $self->{NOECHO} ||= '@ ';
279 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
280 $self->{RM_RF} = '$(PERL) "-I$(INST_LIB)" -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
281 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
282 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
283 $self->{CP} = 'Copy/NoConfirm';
284 $self->{MV} = 'Rename/NoConfirm';
285 $self->{UMASK_NULL} = "\t!";
286 &ExtUtils::MM_Unix::init_others;
292 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
293 $self = $ExtUtils::MakeMaker::Parent[-1];
298 DISTNAME = $self->{DISTNAME}
299 NAME_SYM = $self->{NAME_SYM}
300 VERSION = $self->{VERSION}
301 VERSION_SYM = $self->{VERSION_SYM}
302 VERSION_MACRO = VERSION
303 DEFINE_VERSION = ",'"$(VERSION_MACRO)=""$(VERSION)"""',"
304 XS_VERSION = $self->{XS_VERSION}
305 XS_VERSION_MACRO = XS_VERSION
306 XS_DEFINE_VERSION = ",'"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""',"
308 # In which library should we install this extension?
309 # This is typically the same as PERL_LIB.
310 # (also see INST_LIBDIR and relationship to ROOTEXT)
311 INST_LIB = ",$self->fixpath($self->{INST_LIB},1),"
312 INST_ARCHLIB = ",$self->fixpath($self->{INST_ARCHLIB},1),"
313 INST_EXE = ",$self->fixpath($self->{INST_EXE},1),"
315 PREFIX = $self->{PREFIX}
317 # AFS users will want to set the installation directories for
318 # the final 'make install' early without setting INST_LIB,
319 # INST_ARCHLIB, and INST_EXE for the testing phase
320 INSTALLPRIVLIB = ",$self->fixpath($self->{INSTALLPRIVLIB},1),'
321 INSTALLARCHLIB = ',$self->fixpath($self->{INSTALLARCHLIB},1),'
322 INSTALLBIN = ',$self->fixpath($self->{INSTALLBIN},1),'
324 # Perl library to use when building the extension
325 PERL_LIB = ',$self->fixpath($self->{PERL_LIB},1),'
326 PERL_ARCHLIB = ',$self->fixpath($self->{PERL_ARCHLIB},1),'
327 LIBPERL_A = ',$self->fixpath($self->{LIBPERL_A}),'
329 MAKEMAKER = ',$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),"
330 MM_VERSION = $ExtUtils::MakeMaker::VERSION
331 FIRST_MAKEFILE = ",$self->fixpath($self->{FIRST_MAKEFILE}),'
332 MAKE_APERL_FILE = ',$self->fixpath($self->{MAKE_APERL_FILE}),"
334 PERLMAINCC = $self->{PERLMAINCC}
337 if ($self->{PERL_SRC}) {
339 # Where is the perl source code located?
340 PERL_SRC = ",$self->fixpath($self->{PERL_SRC},1);
342 PERL_VMS = ",$self->catdir($self->{PERL_SRC},q(VMS));
345 # Perl header files (will eventually be under PERL_LIB)
346 PERL_INC = ",$self->fixpath($self->{PERL_INC},1),"
349 FULLPERL = $self->{FULLPERL}
351 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
352 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
353 # ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD)
354 FULLEXT = ",$self->fixpath($self->{FULLEXT},1),"
355 BASEEXT = $self->{BASEEXT}
356 ROOTEXT = ",($self->{ROOTEXT} eq '') ? '[]' : $self->fixpath($self->{ROOTEXT},1),"
357 DLBASE = $self->{DLBASE}
361 VERSION_FROM = $self->{VERSION_FROM}
362 " if defined $self->{VERSION_FROM};
367 if ($self->{'INC'}) {
368 push @m,'/Include=(';
369 my(@includes) = split(/\s+/,$self->{INC});
371 foreach (@includes) {
373 push @m,', ' if $plural++;
374 push @m,$self->fixpath($_,1);
379 if ($self->{DEFINE} ne '') {
380 my(@defs) = split(/\s+/,$self->{DEFINE});
381 foreach $def (@defs) {
384 $def = "\"$def\"" if $def =~ /=/;
386 $self->{DEFINE} = join ',',@defs;
389 if ($self->{OBJECT} =~ /\s/) {
390 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
391 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
393 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
396 DEFINE = $self->{DEFINE}
397 OBJECT = $self->{OBJECT}
398 LDFROM = $self->{LDFROM}
399 LINKTYPE = $self->{LINKTYPE}
401 # Handy lists of source code files:
402 XS_FILES = ",join(', ', sort keys %{$self->{XS}}),'
403 C_FILES = ',join(', ', @{$self->{C}}),'
404 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
405 H_FILES = ',join(', ', @{$self->{H}}),'
406 MAN1PODS = ',join(" \\\n\t", sort keys %{$self->{MAN1PODS}}),'
407 MAN3PODS = ',join(" \\\n\t", sort keys %{$self->{MAN3PODS}}),'
409 # Man installation stuff:
410 INST_MAN1DIR = ',$self->fixpath($self->{INST_MAN1DIR},1),'
411 INSTALLMAN1DIR = ',$self->fixpath($self->{INSTALLMAN1DIR},1),"
412 MAN1EXT = $self->{MAN1EXT}
414 INST_MAN3DIR = ",$self->fixpath($self->{INST_MAN3DIR},1),'
415 INSTALLMAN3DIR = ',$self->fixpath($self->{INSTALLMAN3DIR},1),"
416 MAN3EXT = $self->{MAN3EXT}
419 .SUFFIXES : .xs .c \$(OBJ_EXT)
421 # This extension may link to it's own library (see SDBM_File)";
423 MYEXTLIB = ",$self->fixpath($self->{MYEXTLIB}),"
425 # Here is the Config.pm that we are using/depend on
426 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
428 # Where to put things:
429 INST_LIBDIR = ",($self->{'INST_LIBDIR'} = $self->catdir($self->{INST_LIB},$self->{ROOTEXT})),"
430 INST_ARCHLIBDIR = ",($self->{'INST_ARCHLIBDIR'} = $self->catdir($self->{INST_ARCHLIB},$self->{ROOTEXT})),"
432 INST_AUTODIR = ",($self->{'INST_AUTODIR'} = $self->catdir($self->{INST_LIB},'auto',$self->{FULLEXT})),'
433 INST_ARCHAUTODIR = ',($self->{'INST_ARCHAUTODIR'} = $self->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT})),'
436 if ($self->has_link_code()) {
438 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
439 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
440 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
447 EXPORT_LIST = $(BASEEXT).opt
448 PERL_ARCHIVE = ',($ENV{'PERLSHR'} ? $ENV{'PERLSHR'} : 'Sys$Share:PerlShr.Exe'),'
453 INST_PM = ',join(', ',map($self->fixpath($_),sort values %{$self->{PM}})),'
463 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
464 $self = $ExtUtils::MakeMaker::Parent[-1];
468 # $self->{NAME} might depend on some other libraries.
469 # (These comments may need revising:)
471 # Dependent libraries can be linked in one of three ways:
473 # 1. (For static extensions) by the ld command when the perl binary
474 # is linked with the extension library. See EXTRALIBS below.
476 # 2. (For dynamic extensions) by the ld command when the shared
477 # object is built/linked. See LDLOADLIBS below.
479 # 3. (For dynamic extensions) by the DynaLoader when the shared
480 # object is loaded. See BSLOADLIBS below.
482 # EXTRALIBS = List of libraries that need to be linked with when
483 # linking a perl binary which includes this extension
484 # Only those libraries that actually exist are included.
485 # These are written to a file and used when linking perl.
487 # LDLOADLIBS = List of those libraries which can or must be linked into
488 # the shared library when created using ld. These may be
489 # static or dynamic libraries.
490 # LD_RUN_PATH is a colon separated list of the directories
491 # in LDLOADLIBS. It is passed as an environment variable to
492 # the process that links the shared library.
494 # BSLOADLIBS = List of those libraries that are needed but can be
495 # linked in dynamically at run time on this platform.
496 # SunOS/Solaris does not need this because ld records
497 # the information (from LDLOADLIBS) into the object file.
498 # This list is used to create a .bs (bootstrap) file.
500 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
501 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
502 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
509 my($self,$libperl) = @_;
511 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
512 $self = $ExtUtils::MakeMaker::Parent[-1];
514 my($cmd,$quals) = ($Config{'cc'},$Config{'ccflags'});
517 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
518 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
519 " required to modify CC command for $self->{'BASEEXT'}\n"
522 # Deal with $self->{DEFINE} here since some C compilers pay attention
523 # to only one /Define clause on command line, so we have to
524 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
525 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
526 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
527 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
530 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
531 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
534 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
535 if ($libperl =~ /libperl(\w+)\./i) {
537 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
538 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
539 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
540 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
543 # Likewise with $self->{INC} and /Include
544 my($incstr) = '/Include=($(PERL_INC)';
545 if ($self->{'INC'}) {
546 my(@includes) = split(/\s+/,$self->{INC});
547 foreach (@includes) {
549 $incstr .= ', '.$self->fixpath($_,1);
552 if ($quals =~ m:(.*)/include=\(?([^\(\/\)\s]+)\)?(.*):i) {
553 $quals = "$1$incstr,$2)$3";
555 else { $quals .= "$incstr)"; }
558 if ($Config{'vms_cc_type'} ne 'decc') {
561 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS ',
562 ($Config{'vms_cc_type'} eq 'gcc' ? 'GNU_CC_Include:[VMS]'
567 push(@m, "CCCMD = $cmd$quals\n");
569 $self->{CONST_CCCMD} = join('',@m);
573 # --- Tool Sections ---
576 my($self, %attribs) = @_;
578 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
579 $self = $ExtUtils::MakeMaker::Parent[-1];
582 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
584 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
585 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
592 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
593 $self = $ExtUtils::MakeMaker::Parent[-1];
595 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
596 # drop back to old location if xsubpp is not in new location yet
597 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
598 my(@tmdeps) = '$(XSUBPPDIR)typemap';
599 if( $self->{TYPEMAPS} ){
601 foreach $typemap (@{$self->{TYPEMAPS}}){
603 warn "Typemap $typemap not found.\n";
606 push(@tmdeps, $self->fixpath($typemap));
610 push(@tmdeps, "typemap") if -f "typemap";
611 my(@tmargs) = map("-typemap $_", @tmdeps);
612 if( exists $self->{XSOPT} ){
613 unshift( @tmargs, $self->{XSOPT} );
616 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
618 # What are the correct thresholds for version 1 && 2 Paul?
619 if ( $xsubpp_version > 1.923 ){
620 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
622 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
623 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
624 Your version of xsubpp is $xsubpp_version and cannot handle this.
625 Please upgrade to a more recent version of xsubpp.
628 $self->{XSPROTOARG} = "";
633 XSUBPPDIR = ".$self->fixpath($xsdir,1)."
634 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
635 XSPROTOARG = $self->{XSPROTOARG}
644 my($self,$xsubpp) = @_;
647 # try to figure out the version number of the xsubpp on the system
649 # first try the -v flag, introduced in 1.921 & 2.000a2
651 my $command = "$self->{PERL} $xsubpp -v";
652 print "Running: $command\n" if $Verbose;
653 $version = `$command` ;
654 warn "Running '$command' exits with status " . $? unless ($? & 1);
657 return $1 if $version =~ /^xsubpp version (.*)/ ;
659 # nope, then try something else
662 my ($file) = 'temp' ;
663 $counter++ while -e "$file$counter"; # don't overwrite anything
667 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
669 MODULE = fred PACKAGE = fred
678 $command = "$self->{PERL} $xsubpp $file";
679 print "Running: $command\n" if $Verbose;
680 my $text = `$command` ;
681 warn "Running '$command' exits with status " . $? unless ($? & 1);
684 # gets 1.2 -> 1.92 and 2.000a1
685 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
687 # it is either 1.0 or 1.1
688 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
690 # none of the above, so 1.0
698 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
699 $self = $ExtUtils::MakeMaker::Parent[-1];
702 # Assumes \$(MMS) invokes MMS or MMK
703 # (It is assumed in some cases later that the default makefile name
704 # (Descrip.MMS for MM[SK]) is used.)
705 USEMAKEFILE = /Descrip=
708 MAKEFILE = Descrip.MMS
710 TOUCH = $self->{TOUCH}
711 CHMOD = $self->{CHMOD}
715 RM_RF = $self->{RM_RF}
716 UMASK_NULL = $self->{UMASK_NULL}
717 MKPATH = Create/Directory
718 EQUALIZE_TIMESTAMP = \$(PERL) -we "open F,"">\$ARGV[1]"";close F;utime((stat(""\$ARGV[0]""))[8,9],\$ARGV[1])"
724 my($self, %attribs) = @_;
726 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
727 $self = $ExtUtils::MakeMaker::Parent[-1];
729 # VERSION should be sanitised before use as a file name
730 my($name) = $attribs{NAME} || '$(DISTVNAME)';
731 my($zip) = $attribs{ZIP} || 'zip';
732 my($zipflags) = $attribs{ZIPFLAGS} || '-Vu';
733 my($suffix) = $attribs{SUFFIX} || '';
734 my($shar) = $attribs{SHAR} || 'vms_share';
735 my($preop) = $attribs{PREOP} || '!'; # e.g., update MANIFEST
736 my($postop) = $attribs{POSTOP} || '!';
737 my($dist_cp) = $attribs{DIST_CP} || 'best';
738 my($dist_default) = $attribs{DIST_DEFAULT} || 'zipdist';
741 $src = "[.$src]" unless $src =~ /\[/;
743 $src .= '*.*' if $src =~ /\]$/;
746 DISTVNAME = \$(DISTNAME)-\$(VERSION_SYM)
755 DIST_DEFAULT = $dist_default
760 # --- Translation Sections ---
765 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
766 $self = $ExtUtils::MakeMaker::Parent[-1];
768 return '' unless $self->needs_linking();
771 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
778 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
779 $self = $ExtUtils::MakeMaker::Parent[-1];
781 return '' unless $self->needs_linking();
784 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
788 sub xs_o { # many makes are too dumb to use xs_c then c_o
791 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
792 $self = $ExtUtils::MakeMaker::Parent[-1];
794 return '' unless $self->needs_linking();
797 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
798 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
803 # --- Target Sections ---
809 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
810 $self = $ExtUtils::MakeMaker::Parent[-1];
814 all :: config $(INST_PM) subdirs linkext manifypods reorg_packlist
817 subdirs :: $(MYEXTLIB)
820 config :: $(MAKEFILE) $(INST_LIBDIR).exists
823 config :: $(INST_ARCHAUTODIR).exists Version_check
826 config :: $(INST_AUTODIR).exists
831 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
832 if (%{$self->{MAN1PODS}}) {
834 config :: $(INST_MAN1DIR).exists
837 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
839 if (%{$self->{MAN3PODS}}) {
841 config :: $(INST_MAN3DIR).exists
844 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
848 $(O_FILES) : $(H_FILES)
849 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
853 perldoc ExtUtils::MakeMaker
858 },$self->{NOECHO},q{$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
859 -e "use ExtUtils::MakeMaker qw($Version &Version_check);" -
860 -e "&Version_check('$(MM_VERSION)')"
868 my($self,%attribs) = @_;
870 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
871 $self = $ExtUtils::MakeMaker::Parent[-1];
874 return '' unless $self->needs_linking();
876 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
877 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
878 my($srcdir)= $attribs{PERL_SRC} || $self->{PERL_SRC} || '';
881 unless ($self->{SKIPHASH}{'dynamic'}) {
883 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
887 my($opt) = $self->catfile($srcdir,'perlshr.opt');
888 push(@m,"# Depend on $(BASEEXT).opt to insure we copy here *after* autogenerating (wrong) rtls.opt in Mksymlists
889 rtls.opt : $opt \$(BASEEXT).opt
890 Copy/Log $opt Sys\$Disk:[]rtls.opt
895 # rtls.opt is built in the same step as $(BASEEXT).opt
896 rtls.opt : $(BASEEXT).opt
897 $(TOUCH) $(MMS$TARGET)
903 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
905 ') unless $self->{SKIPHASH}{'static'};
908 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
909 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
910 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
912 $(BASEEXT).opt : Makefile.PL
913 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
914 ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ],
915 neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars),')"
916 $(PERL) -e "print ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)
923 # --- Dynamic Loading Sections ---
926 my($self, %attribs) = @_;
928 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
929 $self = $ExtUtils::MakeMaker::Parent[-1];
931 return '' unless $self->needs_linking(); #might be because of a subdir
933 return '' unless $self->has_link_code();
935 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
936 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
940 OTHERLDFLAGS = $otherldflags
941 INST_DYNAMIC_DEP = $inst_dynamic_dep
945 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
946 ',$self->{NOECHO},'$(MKPATH) $(INST_ARCHAUTODIR)
947 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
948 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
951 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
956 my($self, %attribs) = @_;
958 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
959 $self = $ExtUtils::MakeMaker::Parent[-1];
963 ' unless $self->has_link_code();
965 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
967 # As MakeMaker mkbootstrap might not write a file (if none is required)
968 # we use touch to prevent make continually trying to remake it.
969 # The DynaLoader only reads a non-empty file.
970 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
971 '.$self->{NOECHO}.'Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
972 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
973 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
974 '.$self->{NOECHO}.' $(TOUCH) $(MMS$TARGET)
975 '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
977 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
978 '.$self->{NOECHO}.'$(RM_RF) $(INST_BOOT)
979 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
980 '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
983 # --- Static Loading Sections ---
988 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
989 $self = $ExtUtils::MakeMaker::Parent[-1];
991 return '' unless $self->needs_linking();
996 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
1000 # Rely on suffix rule for update action
1001 $(OBJECT) : $(INST_ARCHAUTODIR).exists
1003 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
1005 # If this extension has it's own library (eg SDBM_File)
1006 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
1007 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
1010 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
1011 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
1012 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
1013 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
1015 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1020 sub installpm_x { # called by installpm perl file
1021 my($self, $dist, $inst, $splitlib) = @_;
1023 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1024 $self = $ExtUtils::MakeMaker::Parent[-1];
1026 if ($inst =~ m!#!) {
1027 warn "Warning: MM[SK] would have problems processing this file: $inst, SKIPPED\n";
1030 $inst = $self->fixpath($inst);
1031 $dist = $self->fixpath($dist);
1032 my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
1036 $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
1037 ",' ',$self->{NOECHO},'$(RM_F) $(MMS$TARGET)
1038 ',$self->{NOECHO},'$(CP) ',"$dist $inst",'
1039 $(CHMOD) 644 $(MMS$TARGET)
1040 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
1042 push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1043 $self->catdir($splitlib,'auto')."\n\n")
1044 if ($splitlib and $inst =~ /\.pm$/);
1045 push(@m,$self->dir_target($instdir));
1052 my($self, %attribs) = @_;
1054 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1055 $self = $ExtUtils::MakeMaker::Parent[-1];
1057 return "\nmanifypods :\n\t\$(NOOP)\n" unless %{$self->{MAN3PODS}};
1059 my($pod2man_exe,$found_pod2man);
1060 if (defined $self->{PERL_SRC}) {
1061 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1063 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
1065 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1067 # No pod2man but some MAN3PODS to be installed
1070 Warning: I could not locate your pod2man program. As a last choice,
1071 I will look for the file to which the logical name POD2MAN
1072 points when MMK is invoked.
1075 $pod2man_exe = "pod2man";
1079 qq[POD2MAN_EXE = $pod2man_exe\n],
1080 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1081 -e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1083 push @m, "\nmanifypods : ";
1084 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1086 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1088 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1089 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1090 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1092 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1093 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1094 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1104 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1105 $self = $ExtUtils::MakeMaker::Parent[-1];
1107 return "" unless $self->{PL_FILES};
1109 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1111 all :: $self->{PL_FILES}->{$plfile}
1114 $self->{PL_FILES}->{$plfile} :: $plfile
1115 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1125 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1126 $self = $ExtUtils::MakeMaker::Parent[-1];
1128 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1129 return '' unless @{$self->{EXE_FILES}};
1130 my(@m, $from, $to, %fromto, @to, $line);
1131 for $from (@{$self->{EXE_FILES}}) {
1132 my($path) = '$(INST_EXE)' . basename($from);
1133 local($_) = $path; # backward compatibility
1134 $to = $self->exescan($path);
1135 print "exescan($from) => '$to'\n" if ($Verbose >=2);
1138 @to = values %fromto;
1140 EXE_FILES = @{$self->{EXE_FILES}}
1147 $line = ''; #avoid unitialized var warning
1149 if (length($line) + length($to) > 80) {
1150 push @m, "\t\$(RM_F) $line\n";
1153 else { $line .= " $to"; }
1155 push @m, "\t\$(RM_F) $line\n\n";
1157 while (($from,$to) = each %fromto) {
1159 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1160 else { ($todir = $to) =~ s/[^\)]+$//; }
1161 $todir = $self->fixpath($todir,1);
1163 $to : $from \$(MAKEFILE) ${todir}.exists
1166 ", $self->dir_target($todir);
1172 # --- Sub-directory Sections ---
1177 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1178 $self = $ExtUtils::MakeMaker::Parent[-1];
1183 foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1184 INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A
1186 push @pasthru, "$key=\"$self->{$key}\"";
1189 push @m, "\nPASTHRU = \\\n ", join (",\\\n ", @pasthru), "\n";
1195 my($self, $subdir) = @_;
1197 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1198 $self = $ExtUtils::MakeMaker::Parent[-1];
1201 $subdir = $self->fixpath($subdir,1);
1205 olddef = F$Environment("Default")
1206 Set Default ',$subdir,'
1207 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1208 Set Default \'olddef\'
1214 # --- Cleanup and Distribution Sections ---
1217 my($self, %attribs) = @_;
1219 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1220 $self = $ExtUtils::MakeMaker::Parent[-1];
1224 # Delete temporary files but do not touch installed files. We don\'t delete
1225 # the Descrip.MMS here so that a later make realclean still has it to use.
1228 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1229 my($vmsdir) = $self->fixpath($dir,1);
1230 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1231 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1233 push @m, ' $(RM_F) *.Map *.lis *.cpp *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso
1236 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1237 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1238 push(@otherfiles, 'blib.dir', '$(MAKE_APERL_FILE)', 'extralibs.ld', 'perlmain.c');
1239 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1241 $line = ''; #avoid unitialized var warning
1242 foreach $file (@otherfiles) {
1243 $file = $self->fixpath($file);
1244 if (length($line) + length($file) > 80) {
1245 push @m, "\t\$(RM_RF) $line\n";
1248 else { $line .= " $file"; }
1250 push @m, "\t\$(RM_RF) $line\n\n";
1251 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1257 my($self, %attribs) = @_;
1259 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1260 $self = $ExtUtils::MakeMaker::Parent[-1];
1264 # Delete temporary files (via clean) and also delete installed files
1267 foreach(@{$self->{DIR}}){
1268 my($vmsdir) = $self->fixpath($_,1);
1269 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1270 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1272 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1274 # We can't expand several of the MMS macros here, since they don't have
1275 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1276 # combination of macros). In order to stay below DCL's 255 char limit,
1277 # we put only 2 on a line.
1278 my($file,$line,$fcnt);
1279 my(@files) = qw{ *.Opt $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(INST_PM) $(OBJECT) $(MAKEFILE) $(MAKEFILE)_old };
1280 $line = ''; #avoid unitialized var warning
1281 foreach $file (@files) {
1282 $file = $self->fixpath($file);
1283 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1284 push @m, "\t\$(RM_F) $line\n";
1288 else { $line .= " $file"; }
1290 push @m, "\t\$(RM_F) $line\n";
1291 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1293 foreach $file (@{$attribs{'FILES'}}) {
1294 $file = $self->fixpath($file);
1295 if (length($line) + length($file) > 80) {
1296 push @m, "\t\$(RM_RF) $line\n";
1299 else { $line .= " $file"; }
1301 push @m, "\t\$(RM_RF) $line\n";
1303 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1311 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1312 $self = $ExtUtils::MakeMaker::Parent[-1];
1315 distclean :: realclean distcheck
1319 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1322 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1325 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1333 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1334 $self = $ExtUtils::MakeMaker::Parent[-1];
1337 dist : $(DIST_DEFAULT)
1340 zipdist : $(DISTVNAME).zip$(SUFFIX)
1343 $(DISTVNAME).zip$(SUFFIX) : distdir
1345 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1346 $(RM_RF) $(DISTVNAME)
1351 $(SHARE) $(SRC) $(DISTVNAME).share$(SUFFIX)
1352 $(RM_RF) $(DISTVNAME)
1361 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1362 $self = $ExtUtils::MakeMaker::Parent[-1];
1366 $(RM_RF) $(DISTVNAME)
1367 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1368 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1376 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1377 $self = $ExtUtils::MakeMaker::Parent[-1];
1381 startdir = F$Environment("Default")
1382 Set Default [.$(DISTVNAME)]
1383 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1386 Set Default 'startdir'
1393 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1394 $self = $ExtUtils::MakeMaker::Parent[-1];
1400 # --- Test and Installation Sections ---
1405 my($self, %attribs) = @_;
1407 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1408 $self = $ExtUtils::MakeMaker::Parent[-1];
1413 ],$self->{NOECHO},q[Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
1414 ],$self->{NOECHO},q[$(PERL) -e "print q{use ExtUtils::MakeMaker; }" >.MM_tmp
1415 ],$self->{NOECHO},q[$(PERL) -e "print q{MY->new({})->writedoc(}" >>.MM_tmp
1416 ],$self->{NOECHO},q[$(PERL) -e "print q{'Module','$(NAME)','LINKTYPE=$(LINKTYPE)',}" >>.MM_tmp
1417 ],$self->{NOECHO},q[$(PERL) -e "print q{'VERSION=$(VERSION)','XS_VERSION=$(XS_VERSION)',}" >>.MM_tmp
1418 ],$self->{NOECHO},q[$(PERL) -e "print q{'EXE_FILES=$(EXE_FILES)')}" >>.MM_tmp
1419 ],$self->{NOECHO},q[$(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" .MM_tmp >>$(INSTALLARCHLIB)perllocal.pod
1420 ],$self->{NOECHO},q[If F$Search(".MM_tmp") .nes. "" then Delete/NoLog .MM_tmp;
1424 install :: pure_install doc_install
1427 # Interim solution for VMS; assumes directory tree of same structure under
1428 # both \$(INST_LIB) and \$(INSTALLPRIVLIB). This operation will be assumed
1429 # into MakeMaker in a (near) future version.
1432 # # install subdirectories first
1433 # foreach(@{$self->{DIR}}){
1434 # my($vmsdir) = $self->fixpath($_,1);
1435 # push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1436 # '; print `$(MMS) install`"'."\n");
1439 # push(@m, ' ',$self->{NOECHO},'$(PERL) "-I$(PERL_LIB)" -e "use File::Path; mkpath(\@ARGV)" $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
1440 # ',$self->{NOECHO},'$(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLPRIVLIB)
1441 # ',$self->{NOECHO},'$(PERL) -e "die qq{You do not have permissions to install into $ARGV[0]\n} unless -w VMS::Filespec::fileify($ARGV[0])" $(INSTALLARCHLIB)',"
1442 # # Can't install manpages here -- INST_MAN%DIR macros make line >255 chars
1443 # \$(MMS) \$(USEMACROS)INST_LIB=$self->{INSTALLPRIVLIB},INST_ARCHLIB=$self->{INSTALLARCHLIB},INST_EXE=$self->{INSTALLBIN}\$(MACROEND)",'
1444 # ',$self->{NOECHO},'$(PERL) -i_bak -lne "print unless $seen{$_}++" $(INST_ARCHAUTODIR).packlist
1447 my($curtop,$insttop);
1448 ($curtop = $self->fixpath($self->{INST_LIB},1)) =~ s/]$//;
1449 ($insttop = $self->fixpath($self->{INSTALLPRIVLIB},1)) =~ s/]$//;
1450 push(@m," Backup/Log ${curtop}...]*.*; ${insttop}...]/New_Version/By_Owner=Parent\n");
1452 my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
1454 # This song and dance brought to you by DCL\'s 255 char limit
1457 my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
1458 if ("\L$oldpacklist" ne "\L$self->{INST_ARCHAUTODIR}.packlist") {
1459 push(@m,' If F$Search("',$oldpacklist,'").nes."" Then Append/New ',$oldpacklist,' $(INST_ARCHAUTODIR).packlist');
1462 $(PERL) -ne "BEGIN{exit unless -e $ARGV[0];}print unless $s{$_}++;" $(INST_ARCHAUTODIR).packlist >.MM_tmp
1463 If F$Search(".MM_tmp").nes."" Then Copy/NoConfirm .MM_tmp $(INST_ARCHAUTODIR).packlist
1464 If F$Search(".MM_tmp").nes."" Then Delete/NoConfirm .MM_tmp;
1470 # Comment on .packlist rewrite above:
1471 # Read both .packlist files: the old one in PERL_ARCHLIB/auto/FULLEXT, and the new one
1472 # in INSTARCHAUTODIR. Don't croak if they are missing. Write to the one
1473 # in INSTARCHAUTODIR.
1477 ##### UNINSTALL IS STILL EXPERIMENTAL ####
1480 foreach(@{$self->{DIR}}){
1481 my($vmsdir) = $self->fixpath($_,1);
1482 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1483 '; print `$(MMS) uninstall`"'."\n");
1485 push @m, "\t".'$(PERL) -le "use File::Path; foreach (<>) {s/',"$curtop/$insttop/;",'rmtree($_,1,0);}" <$(INST_ARCHAUTODIR).packlist
1495 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1496 $self = $ExtUtils::MakeMaker::Parent[-1];
1501 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1502 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1503 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1504 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1505 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1506 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1507 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1509 ' if $self->{OBJECT};
1512 # Check for unpropagated config.sh changes. Should never happen.
1513 # We do NOT just update config.h because that is not sufficient.
1514 # An out of date config.h is not fatal but complains loudly!
1515 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1516 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1517 ',$self->{NOECHO},'Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1519 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1520 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1521 ',$self->{NOECHO},'Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1522 olddef = F$Environment("Default")
1523 Set Default $(PERL_SRC)
1524 $(MMS) $(USEMAKEFILE)[.VMS]$(MAKEFILE) [.lib.',$Config{'arch'},']config.pm
1525 Set Default \'olddef\'
1526 ') if $self->{PERL_SRC};
1528 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1537 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1538 $self = $ExtUtils::MakeMaker::Parent[-1];
1541 # We do not know what target was originally specified so we
1542 # must force a manual rerun to be sure. But as it should only
1543 # happen very rarely it is not a significant problem.
1545 $(OBJECT) : $(FIRST_MAKEFILE)
1546 ' if $self->{OBJECT};
1549 # We take a very conservative approach here, but it\'s worth it.
1550 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1551 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1552 ',$self->{NOECHO},'Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1553 ',$self->{NOECHO},'Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1554 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1555 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1556 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',@ARGV),'
1557 ',$self->{NOECHO},'Write Sys$Output "$(MAKEFILE) has been rebuilt."
1558 ',$self->{NOECHO},'Write Sys$Output "Please run $(MMS) to build the extension."
1566 my($self, %attribs) = @_;
1568 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1569 $self = $ExtUtils::MakeMaker::Parent[-1];
1571 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1575 TEST_TYPE=test_\$(LINKTYPE)
1577 test : \$(TEST_TYPE)
1580 foreach(@{$self->{DIR}}){
1581 my($vmsdir) = $self->fixpath($_,1);
1582 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1583 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1585 push(@m, "\t$self->{NOECHO}Write Sys\$Output \"No tests defined for \$(NAME) extension.\"\n")
1586 unless $tests or -f "test.pl" or @{$self->{DIR}};
1589 push(@m, "test_dynamic :: all\n");
1590 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1591 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1592 push(@m, " \$(NOOP)\n") if (!$tests && ! -f "test.pl");
1595 # Occasionally we may face this degenerate target:
1596 push @m, "test_ : test_dynamic\n\n";
1598 if ($self->needs_linking()) {
1599 push(@m, "test_static :: all \$(MAP_TARGET)\n");
1600 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
1601 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
1602 push(@m, "\t$self->{NOECHO}\$(NOOP)\n") if (!$tests && ! -f "test.pl");
1606 push @m, "test_static :: test_dynamic\n\t$self->{NOECHO}\$(NOOP)\n";
1613 sub test_via_harness {
1614 my($self,$perl,$tests) = @_;
1616 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1617 $self = $ExtUtils::MakeMaker::Parent[-1];
1619 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
1620 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
1624 sub test_via_script {
1625 my($self,$perl,$script) = @_;
1627 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1628 $self = $ExtUtils::MakeMaker::Parent[-1];
1630 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl
1636 my($self, %attribs) = @_;
1638 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1639 $self = $ExtUtils::MakeMaker::Parent[-1];
1641 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1642 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1645 # --- MakeMaker makeaperl section ---
1646 MAP_TARGET = $target
1648 return join '', @m if $self->{PARENT};
1650 my($dir) = join ":", @{$self->{DIR}};
1652 unless ($self->{MAKEAPERL}) {
1654 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1655 },$self->{NOECHO},q{Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
1656 },$self->{NOECHO},q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
1657 Makefile.PL DIR=}, $dir, q{ \
1658 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1659 MAKEAPERL=1 NORECURS=1
1661 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
1662 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
1664 push @m, map( " \\\n\t\t$_", @ARGV );
1671 my($linkcmd,@staticopts,@staticpkgs,$extralist,$target,$targdir,$libperldir);
1673 # The front matter of the linkcommand...
1674 $linkcmd = join ' ', $Config{'ld'},
1675 grep($_, @Config{qw(large split ldflags ccdlflags)});
1676 $linkcmd =~ s/\s+/ /g;
1678 # Which *.olb files could we make use of...
1680 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
1681 File::Find::find(sub {
1682 return unless m/\Q$self->{LIB_EXT}\E$/;
1683 return if m/^libperl/;
1684 $olbs{$ENV{DEFAULT}} = $_;
1685 }, grep( -d $_, @{$searchdirs || []}));
1687 # We trust that what has been handed in as argument will be buildable
1688 $static = [] unless $static;
1689 @olbs{@{$static}} = (1) x @{$static};
1691 $extra = [] unless $extra && ref $extra eq 'ARRAY';
1692 # Sort the object libraries in inverse order of
1693 # filespec length to try to insure that dependent extensions
1694 # will appear before their parents, so the linker will
1695 # search the parent library to resolve references.
1696 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
1697 # references from [.intuit.dwim]dwim.obj can be found
1698 # in [.intuit]intuit.olb).
1699 for (sort keys %olbs) {
1700 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
1701 my($dir) = $self->fixpath($_,1);
1702 my($extralibs) = $dir . "extralibs.ld";
1703 my($extopt) = $dir . $olbs{$_};
1704 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
1705 if (-f $extralibs ) {
1706 open LIST,$extralibs or warn $!,next;
1707 push @$extra, <LIST>;
1711 open OPT,$extopt or die $!;
1713 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
1714 # ExtUtils::Miniperl expects Unix paths
1715 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
1716 push @staticpkgs,$pkg;
1718 push @staticopts, $extopt;
1722 $target = "Perl.Exe" unless $target;
1723 ($shrtarget,$targdir) = fileparse($target);
1724 $shrtarget =~ s/^([^.]*)/$1Shr/;
1725 $shrtarget = $targdir . $shrtarget;
1726 $target = "Perlshr.$Config{'dlext'}" unless $target;
1727 $tmp = "[]" unless $tmp;
1728 $tmp = $self->fixpath($tmp,1);
1730 $extralist = join(' ',@$extra);
1731 $extralist =~ s/[,\s\n]+/, /g;
1733 else { $extralist = ''; }
1735 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
1736 print STDOUT "Warning: $libperl not found\n";
1741 if (defined $self->{PERL_SRC}) {
1742 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
1743 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
1745 print STDOUT "Warning: $libperl not found
1746 If you're going to build a static perl binary, make sure perl is installed
1747 otherwise ignore this warning\n";
1750 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
1753 # Fill in the target you want to produce if it\'s not perl
1754 MAP_TARGET = ',$self->fixpath($target),'
1755 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
1756 MAP_LINKCMD = $linkcmd
1757 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
1758 # We use the linker options files created with each extension, rather than
1759 #specifying the object files directly on the command line.
1760 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
1761 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
1762 MAP_EXTRA = $extralist
1763 MAP_LIBPERL = ",$self->fixpath($libperl),'
1768 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
1769 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
1770 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
1771 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
1772 ',$self->{NOECHO},'Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
1773 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
1774 ',$self->{NOECHO},'Write Sys$Output "To remove the intermediate files, say
1775 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
1778 ',"${tmp}perlmain.c",' : $(MAKEFILE)
1779 ',$self->{NOECHO},'$(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
1784 },$self->{NOECHO},q{$(PERL) -e "use ExtUtils::MakeMaker; MY->new()->writedoc('Perl binary','$(MAP_TARGET)','MAP_STATIC=$(MAP_STATIC)','MAP_EXTRA=$(MAP_EXTRA)','MAP_LIBPERL=$(MAP_LIBPERL)')"
1788 inst_perl : pure_inst_perl doc_inst_perl
1791 pure_inst_perl : \$(MAP_TARGET)
1792 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
1793 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
1799 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
1800 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
1809 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1810 $self = $ExtUtils::MakeMaker::Parent[-1];
1816 # --- Make-Directories section (internal method) ---
1817 # dir_target(@array) returns a Makefile entry for the file .exists in each
1818 # named directory. Returns nothing, if the entry has already been processed.
1819 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
1820 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
1821 # prerequisite, because there has to be one, something that doesn't change
1825 my($self,@dirs) = @_;
1827 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1828 $self = $ExtUtils::MakeMaker::Parent[-1];
1831 foreach $dir (@dirs) {
1832 next if $self->{DIR_TARGET}{$self}{$dir}++;
1833 my($vmsdir) = $self->fixpath($dir,1);
1835 ${vmsdir}.exists :: \$(PERL_INC)perl.h
1836 $self->{NOECHO}\$(MKPATH) $vmsdir
1837 $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) \$(MMS\$SOURCE) \$(MMS\$TARGET)
1844 # --- Output postprocessing section ---
1847 # Insure that colons marking targets are preceded by space -
1848 # most Unix Makes don't need this, but it's necessary under VMS
1849 # to distinguish the target delimiter from a colon appearing as
1850 # part of a filespec.
1852 my($self,$text) = @_;
1854 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1855 $self = $ExtUtils::MakeMaker::Parent[-1];
1857 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;