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');
18 unshift @MM::ISA, 'ExtUtils::MM_VMS';
21 sub eliminate_macros {
24 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
25 $self = $ExtUtils::MakeMaker::Parent[-1];
28 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
31 my($npath) = unixify($path);
32 my($head,$macro,$tail);
34 # perform m##g in scalar context so it acts as an iterator
35 while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) {
37 ($head,$macro,$tail) = ($1,$2,$3);
38 ($macro = unixify($self->{$macro})) =~ s#/$##;
39 $npath = "$head$macro$tail";
42 print "eliminate_macros($path) = |$npath|\n" if $Verbose >= 3;
46 # Catchall routine to clean up problem macros. Expands macros in any directory
47 # specification, and expands expressions which are all macro, so that we can
48 # tell how long the expansion is, and avoid overrunning DCL's command buffer
49 # when MM[KS] is running.
51 my($self,$path,$force_path) = @_;
53 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
54 $self = $ExtUtils::MakeMaker::Parent[-1];
57 print "eliminate_macros('') = ||\n" if $Verbose >= 3;
60 my($fixedpath,$prefix,$name);
62 if ($path =~ m#^\$\(.+\)$# || $path =~ m#[/:>\]]#) {
63 if ($force_path or $path =~ /(?:DIR\)|\])$/) {
64 $fixedpath = vmspath($self->eliminate_macros($path));
67 $fixedpath = vmsify($self->eliminate_macros($path));
70 elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#)) && $self->{$prefix}) {
71 my($vmspre) = vmspath($self->{$prefix}) || ''; # is it a dir or just a name?
72 $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name;
73 $fixedpath = vmspath($fixedpath) if $force_path;
77 $fixedpath = vmspath($fixedpath) if $force_path;
79 # Convert names without directory or type to paths
80 if (!$force_path and $fixedpath !~ /[:>(.\]]/) { $fixedpath = vmspath($fixedpath); }
81 print "fixpath($path) = |$fixedpath|\n" if $Verbose >= 3;
88 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
89 $self = $ExtUtils::MakeMaker::Parent[-1];
92 @dirs = grep($_,@dirs);
95 my($path) = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs));
96 my($spath,$sdir) = ($path,$dir);
97 $spath =~ s/.dir$//; $sdir =~ s/.dir$//;
98 $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+$/;
99 $rslt = vmspath($self->eliminate_macros($spath)."/$sdir");
101 else { $rslt = vmspath($dir); }
102 print "catdir($path,$dir) = |$rslt|\n" if $Verbose >= 3;
107 my($self,@files) = @_;
109 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
110 $self = $ExtUtils::MakeMaker::Parent[-1];
112 my($file) = pop @files;
113 @files = grep($_,@files);
116 my($path) = (@files == 1 ? $files[0] : $self->catdir(@files));
119 if ( $spath =~ /^[^\)\]\/:>]+\)$/ && basename($file) eq $file) { $rslt = "$spath$file"; }
120 else { $rslt = vmsify($self->eliminate_macros($spath).'/'.unixify($file)); }
122 else { $rslt = vmsify($file); }
123 print "catfile($path,$file) = |$rslt|\n" if $Verbose >= 3;
128 # Default name is taken from the directory name if it's not passed in.
129 # Since VMS filenames are case-insensitive, we actually look in the
130 # extension files to find the Mixed-case name
134 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
135 $self = $ExtUtils::MakeMaker::Parent[-1];
140 $defname = $ENV{'DEFAULT'};
141 $defname =~ s:.*?([^.\]]+)\]:$1:
142 unless ($defname =~ s:.*[.\[]ext\.(.*)\]:$1:i);
143 $defname =~ s#[.\]]#::#g;
144 ($defpm = $defname) =~ s/.*:://;
145 if (open(PM,"${defpm}.pm")){
147 if (/^\s*package\s+([^;]+)/i) {
152 print STDOUT "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t",
153 "defaulting package name to $defname\n"
158 print STDOUT "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t",
159 "defaulting package name to $defname\n";
161 $defname =~ s#[\-_][\d.\-]+$##;
167 my($self, $ver, $names, $dirs, $trace) = @_;
169 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
170 $self = $ExtUtils::MakeMaker::Parent[-1];
172 my($name, $dir,$vmsfile,@cand);
174 print "Looking for perl $ver by these names:\n";
175 print "\t@$names,\n";
176 print "in these dirs:\n";
179 foreach $dir (@$dirs){
180 next unless defined $dir; # $self->{PERL_SRC} may be undefined
181 foreach $name (@$names){
182 if ($name !~ m![/:>\]]!) { push(@cand,$self->catfile($dir,$name)); }
183 else { push(@cand,$self->fixpath($name)); }
186 foreach $name (sort { length($a) <=> length($b) } @cand) {
187 print "Checking $name\n" if ($trace >= 2);
188 next unless $vmsfile = $self->maybe_command($name);
189 print "Executing $vmsfile\n" if ($trace >= 2);
190 if (`MCR $vmsfile -e "require $ver; print ""VER_OK\n"""` =~ /VER_OK/) {
191 print "Using PERL=MCR $vmsfile\n" if $trace;
192 return "MCR $vmsfile"
195 print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
196 0; # false and not empty
201 my($self,$file) = @_;
202 return $file if -x $file && ! -d _;
203 return "$file.exe" if -x "$file.exe";
204 if ($file !~ m![/:>\]]!) {
205 my($shrfile) = 'Sys$Share:' . $file;
206 return $file if -x $shrfile && ! -d _;
207 return "$file.exe" if -x "$shrfile.exe";
213 sub maybe_command_in_dirs { # $ver is optional argument if looking for perl
214 my($self, $names, $dirs, $trace, $ver) = @_;
216 foreach $dir (@$dirs){
217 next unless defined $dir; # $self->{PERL_SRC} may be undefined
218 foreach $name (@$names){
220 if ($self->file_name_is_absolute($name)) {
223 $abs = $self->catfile($dir, $name);
225 print "Checking $abs for $name\n" if ($trace >= 2);
226 next unless $tryabs = $self->maybe_command($abs);
227 print "Substituting $tryabs instead of $abs\n"
228 if ($trace >= 2 and $tryabs ne $abs);
231 print "Executing $abs\n" if ($trace >= 2);
232 if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
233 print "Using PERL=$abs\n" if $trace;
236 } else { # Do not look for perl
245 my($self,$file) = @_;
246 return $file if -r $file && ! -d _;
247 return "$file.pl" if -r "$file.pl" && ! -d _;
251 sub file_name_is_absolute {
253 $file =~ m!^/! or $file =~ m![:<\[][^.]!;
257 sub replace_manpage_separator {
259 $man = unixify($man);
268 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
269 $self = $ExtUtils::MakeMaker::Parent[-1];
272 $self->{NOOP} = "\t@ Continue";
273 $self->{FIRST_MAKEFILE} ||= 'Descrip.MMS';
274 $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS';
275 $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE};
276 $self->{NOECHO} ||= '@ ';
277 $self->{RM_F} = '$(PERL) -e "foreach (@ARGV) { 1 while ( -d $_ ? rmdir $_ : unlink $_)}"';
278 $self->{RM_RF} = '$(PERL) -e "use File::Path; @dirs = map(VMS::Filespec::unixify($_),@ARGV); rmtree(\@dirs,0,0)"';
279 $self->{TOUCH} = '$(PERL) -e "$t=time; foreach (@ARGV) { -e $_ ? utime($t,$t,@ARGV) : (open(F,qq(>$_)),close F)}"';
280 $self->{CHMOD} = '$(PERL) -e "chmod @ARGV"'; # expect Unix syntax from MakeMaker
281 $self->{CP} = 'Copy/NoConfirm';
282 $self->{MV} = 'Rename/NoConfirm';
283 $self->{UMASK_NULL} = "\t!";
284 &ExtUtils::MM_Unix::init_others;
290 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
291 $self = $ExtUtils::MakeMaker::Parent[-1];
296 DISTNAME = $self->{DISTNAME}
297 NAME_SYM = $self->{NAME_SYM}
298 VERSION = $self->{VERSION}
299 VERSION_SYM = $self->{VERSION_SYM}
300 VERSION_MACRO = VERSION
301 DEFINE_VERSION = ",'"$(VERSION_MACRO)=""$(VERSION)"""',"
302 XS_VERSION = $self->{XS_VERSION}
303 XS_VERSION_MACRO = XS_VERSION
304 XS_DEFINE_VERSION = ",'"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""',"
306 # In which library should we install this extension?
307 # This is typically the same as PERL_LIB.
308 # (also see INST_LIBDIR and relationship to ROOTEXT)
309 INST_LIB = ",$self->fixpath($self->{INST_LIB},1),"
310 INST_ARCHLIB = ",$self->fixpath($self->{INST_ARCHLIB},1),"
311 INST_EXE = ",$self->fixpath($self->{INST_EXE},1),"
313 PREFIX = $self->{PREFIX}
315 # AFS users will want to set the installation directories for
316 # the final 'make install' early without setting INST_LIB,
317 # INST_ARCHLIB, and INST_EXE for the testing phase
318 INSTALLPRIVLIB = ",$self->fixpath($self->{INSTALLPRIVLIB},1),'
319 INSTALLARCHLIB = ',$self->fixpath($self->{INSTALLARCHLIB},1),'
320 INSTALLBIN = ',$self->fixpath($self->{INSTALLBIN},1),'
322 # Perl library to use when building the extension
323 PERL_LIB = ',$self->fixpath($self->{PERL_LIB},1),'
324 PERL_ARCHLIB = ',$self->fixpath($self->{PERL_ARCHLIB},1),'
325 LIBPERL_A = ',$self->fixpath($self->{LIBPERL_A}),'
327 MAKEMAKER = ',$self->catfile($self->{PERL_LIB},'ExtUtils','MakeMaker.pm'),"
328 MM_VERSION = $ExtUtils::MakeMaker::VERSION
329 FIRST_MAKEFILE = ",$self->fixpath($self->{FIRST_MAKEFILE}),'
330 MAKE_APERL_FILE = ',$self->fixpath($self->{MAKE_APERL_FILE}),"
332 PERLMAINCC = $self->{PERLMAINCC}
335 if ($self->{PERL_SRC}) {
337 # Where is the perl source code located?
338 PERL_SRC = ",$self->fixpath($self->{PERL_SRC},1);
340 PERL_VMS = ",$self->catdir($self->{PERL_SRC},q(VMS));
343 # Perl header files (will eventually be under PERL_LIB)
344 PERL_INC = ",$self->fixpath($self->{PERL_INC},1),"
347 FULLPERL = $self->{FULLPERL}
349 # FULLEXT = Pathname for extension directory (eg DBD/Oracle).
350 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT.
351 # ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD)
352 FULLEXT = ",$self->fixpath($self->{FULLEXT},1),"
353 BASEEXT = $self->{BASEEXT}
354 ROOTEXT = ",($self->{ROOTEXT} eq '') ? '[]' : $self->fixpath($self->{ROOTEXT},1),"
355 DLBASE = $self->{DLBASE}
359 VERSION_FROM = $self->{VERSION_FROM}
360 " if defined $self->{VERSION_FROM};
365 if ($self->{'INC'}) {
366 push @m,'/Include=(';
367 my(@includes) = split(/\s+/,$self->{INC});
369 foreach (@includes) {
371 push @m,', ' if $plural++;
372 push @m,$self->fixpath($_,1);
377 if ($self->{DEFINE} ne '') {
378 my(@defs) = split(/\s+/,$self->{DEFINE});
379 foreach $def (@defs) {
382 $def = "\"$def\"" if $def =~ /=/;
384 $self->{DEFINE} = join ',',@defs;
387 if ($self->{OBJECT} =~ /\s/) {
388 $self->{OBJECT} =~ s/(\\)?\n+\s+/ /g;
389 $self->{OBJECT} = map($self->fixpath($_),split(/,?\s+/,$self->{OBJECT}));
391 $self->{LDFROM} = join(' ',map($self->fixpath($_),split(/,?\s+/,$self->{LDFROM})));
394 DEFINE = $self->{DEFINE}
395 OBJECT = $self->{OBJECT}
396 LDFROM = $self->{LDFROM}
397 LINKTYPE = $self->{LINKTYPE}
399 # Handy lists of source code files:
400 XS_FILES = ",join(', ', sort keys %{$self->{XS}}),'
401 C_FILES = ',join(', ', @{$self->{C}}),'
402 O_FILES = ',join(', ', @{$self->{O_FILES}} ),'
403 H_FILES = ',join(', ', @{$self->{H}}),'
404 MAN1PODS = ',join(" \\\n\t", sort keys %{$self->{MAN1PODS}}),'
405 MAN3PODS = ',join(" \\\n\t", sort keys %{$self->{MAN3PODS}}),'
407 # Man installation stuff:
408 INST_MAN1DIR = ',$self->fixpath($self->{INST_MAN1DIR},1),'
409 INSTALLMAN1DIR = ',$self->fixpath($self->{INSTALLMAN1DIR},1),"
410 MAN1EXT = $self->{MAN1EXT}
412 INST_MAN3DIR = ",$self->fixpath($self->{INST_MAN3DIR},1),'
413 INSTALLMAN3DIR = ',$self->fixpath($self->{INSTALLMAN3DIR},1),"
414 MAN3EXT = $self->{MAN3EXT}
417 .SUFFIXES : .xs .c \$(OBJ_EXT)
419 # This extension may link to it's own library (see SDBM_File)";
421 MYEXTLIB = ",$self->fixpath($self->{MYEXTLIB}),"
423 # Here is the Config.pm that we are using/depend on
424 CONFIGDEP = \$(PERL_ARCHLIB)Config.pm, \$(PERL_INC)config.h \$(VERSION_FROM)
426 # Where to put things:
427 INST_LIBDIR = ",($self->{'INST_LIBDIR'} = $self->catdir($self->{INST_LIB},$self->{ROOTEXT})),"
428 INST_ARCHLIBDIR = ",($self->{'INST_ARCHLIBDIR'} = $self->catdir($self->{INST_ARCHLIB},$self->{ROOTEXT})),"
430 INST_AUTODIR = ",($self->{'INST_AUTODIR'} = $self->catdir($self->{INST_LIB},'auto',$self->{FULLEXT})),'
431 INST_ARCHAUTODIR = ',($self->{'INST_ARCHAUTODIR'} = $self->catdir($self->{INST_ARCHLIB},'auto',$self->{FULLEXT})),'
434 if ($self->has_link_code()) {
436 INST_STATIC = $(INST_ARCHAUTODIR)$(BASEEXT)$(LIB_EXT)
437 INST_DYNAMIC = $(INST_ARCHAUTODIR)$(BASEEXT).$(DLEXT)
438 INST_BOOT = $(INST_ARCHAUTODIR)$(BASEEXT).bs
445 EXPORT_LIST = $(BASEEXT).opt
446 PERL_ARCHIVE = ',($ENV{'PERLSHR'} ? $ENV{'PERLSHR'} : 'Sys$Share:PerlShr.Exe'),'
451 INST_PM = ',join(', ',map($self->fixpath($_),sort values %{$self->{PM}})),'
461 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
462 $self = $ExtUtils::MakeMaker::Parent[-1];
466 # $self->{NAME} might depend on some other libraries.
467 # (These comments may need revising:)
469 # Dependent libraries can be linked in one of three ways:
471 # 1. (For static extensions) by the ld command when the perl binary
472 # is linked with the extension library. See EXTRALIBS below.
474 # 2. (For dynamic extensions) by the ld command when the shared
475 # object is built/linked. See LDLOADLIBS below.
477 # 3. (For dynamic extensions) by the DynaLoader when the shared
478 # object is loaded. See BSLOADLIBS below.
480 # EXTRALIBS = List of libraries that need to be linked with when
481 # linking a perl binary which includes this extension
482 # Only those libraries that actually exist are included.
483 # These are written to a file and used when linking perl.
485 # LDLOADLIBS = List of those libraries which can or must be linked into
486 # the shared library when created using ld. These may be
487 # static or dynamic libraries.
488 # LD_RUN_PATH is a colon separated list of the directories
489 # in LDLOADLIBS. It is passed as an environment variable to
490 # the process that links the shared library.
492 # BSLOADLIBS = List of those libraries that are needed but can be
493 # linked in dynamically at run time on this platform.
494 # SunOS/Solaris does not need this because ld records
495 # the information (from LDLOADLIBS) into the object file.
496 # This list is used to create a .bs (bootstrap) file.
498 EXTRALIBS = ",map($self->fixpath($_) . ' ',$self->{'EXTRALIBS'}),"
499 BSLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'BSLOADLIBS'}),"
500 LDLOADLIBS = ",map($self->fixpath($_) . ' ',$self->{'LDLOADLIBS'}),"\n";
507 my($self,$libperl) = @_;
509 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
510 $self = $ExtUtils::MakeMaker::Parent[-1];
512 my($cmd,$quals) = ($Config{'cc'},$Config{'ccflags'});
515 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
516 print STDOUT "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}.
517 " required to modify CC command for $self->{'BASEEXT'}\n"
520 # Deal with $self->{DEFINE} here since some C compilers pay attention
521 # to only one /Define clause on command line, so we have to
522 # conflate the ones from $Config{'cc'} and $self->{DEFINE}
523 if ($quals =~ m:(.*)/define=\(?([^\(\/\)\s]+)\)?(.*)?:i) {
524 $quals = "$1/Define=($2," . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
525 "\$(DEFINE_VERSION),\$(XS_DEFINE_VERSION))$3";
528 $quals .= '/Define=(' . ($self->{DEFINE} ? "$self->{DEFINE}," : '') .
529 '$(DEFINE_VERSION),$(XS_DEFINE_VERSION))';
532 $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb";
533 if ($libperl =~ /libperl(\w+)\./i) {
535 my(%map) = ( 'D' => 'DEBUGGING', 'E' => 'EMBED', 'M' => 'MULTIPLICITY',
536 'DE' => 'DEBUGGING,EMBED', 'DM' => 'DEBUGGING,MULTIPLICITY',
537 'EM' => 'EMBED,MULTIPLICITY', 'DEM' => 'DEBUGGING,EMBED,MULTIPLICITY' );
538 $quals =~ s:/define=\(([^\)]+)\):/Define=($1,$map{$type}):i
541 # Likewise with $self->{INC} and /Include
542 my($incstr) = '/Include=($(PERL_INC)';
543 if ($self->{'INC'}) {
544 my(@includes) = split(/\s+/,$self->{INC});
545 foreach (@includes) {
547 $incstr .= ', '.$self->fixpath($_,1);
550 if ($quals =~ m:(.*)/include=\(?([^\(\/\)\s]+)\)?(.*):i) {
551 $quals = "$1$incstr,$2)$3";
553 else { $quals .= "$incstr)"; }
556 if ($Config{'vms_cc_type'} ne 'decc') {
559 ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS ',
560 ($Config{'vms_cc_type'} eq 'gcc' ? 'GNU_CC_Include:[VMS]'
565 push(@m, "CCCMD = $cmd$quals\n");
567 $self->{CONST_CCCMD} = join('',@m);
571 # --- Tool Sections ---
574 my($self, %attribs) = @_;
576 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
577 $self = $ExtUtils::MakeMaker::Parent[-1];
580 $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
582 # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
583 AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use AutoSplit;}.$asl.q{ AutoSplit::autosplit($ARGV[0], $ARGV[1], 0, 1, 1) ;"
590 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
591 $self = $ExtUtils::MakeMaker::Parent[-1];
593 my($xsdir) = $self->catdir($self->{PERL_LIB},'ExtUtils');
594 # drop back to old location if xsubpp is not in new location yet
595 $xsdir = $self->catdir($self->{PERL_SRC},'ext') unless (-f $self->catfile($xsdir,'xsubpp'));
596 my(@tmdeps) = '$(XSUBPPDIR)typemap';
597 if( $self->{TYPEMAPS} ){
599 foreach $typemap (@{$self->{TYPEMAPS}}){
601 warn "Typemap $typemap not found.\n";
604 push(@tmdeps, $self->fixpath($typemap));
608 push(@tmdeps, "typemap") if -f "typemap";
609 my(@tmargs) = map("-typemap $_", @tmdeps);
610 if( exists $self->{XSOPT} ){
611 unshift( @tmargs, $self->{XSOPT} );
614 my $xsubpp_version = $self->xsubpp_version($self->catfile($xsdir,'xsubpp'));
616 # What are the correct thresholds for version 1 && 2 Paul?
617 if ( $xsubpp_version > 1.923 ){
618 $self->{XSPROTOARG} = '' unless defined $self->{XSPROTOARG};
620 if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) {
621 print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
622 Your version of xsubpp is $xsubpp_version and cannot handle this.
623 Please upgrade to a more recent version of xsubpp.
626 $self->{XSPROTOARG} = "";
631 XSUBPPDIR = ".$self->fixpath($xsdir,1)."
632 XSUBPP = \$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" \$(XSUBPPDIR)xsubpp
633 XSPROTOARG = $self->{XSPROTOARG}
642 my($self,$xsubpp) = @_;
645 # try to figure out the version number of the xsubpp on the system
647 # first try the -v flag, introduced in 1.921 & 2.000a2
649 my $command = "$self->{PERL} $xsubpp -v";
650 print "Running: $command\n" if $Verbose;
651 $version = `$command` ;
652 warn "Running '$command' exits with status " . $? unless ($? & 1);
655 return $1 if $version =~ /^xsubpp version (.*)/ ;
657 # nope, then try something else
660 my ($file) = 'temp' ;
661 $counter++ while -e "$file$counter"; # don't overwrite anything
665 open(F, ">$file") or die "Cannot open file '$file': $!\n" ;
667 MODULE = fred PACKAGE = fred
676 $command = "$self->{PERL} $xsubpp $file";
677 print "Running: $command\n" if $Verbose;
678 my $text = `$command` ;
679 warn "Running '$command' exits with status " . $? unless ($? & 1);
682 # gets 1.2 -> 1.92 and 2.000a1
683 return $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ;
685 # it is either 1.0 or 1.1
686 return 1.1 if $text =~ /^Warning: ignored semicolon/ ;
688 # none of the above, so 1.0
696 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
697 $self = $ExtUtils::MakeMaker::Parent[-1];
700 # Assumes \$(MMS) invokes MMS or MMK
701 # (It is assumed in some cases later that the default makefile name
702 # (Descrip.MMS for MM[SK]) is used.)
703 USEMAKEFILE = /Descrip=
706 MAKEFILE = Descrip.MMS
708 TOUCH = $self->{TOUCH}
709 CHMOD = $self->{CHMOD}
713 RM_RF = $self->{RM_RF}
714 UMASK_NULL = $self->{UMASK_NULL}
715 MKPATH = Create/Directory
721 my($self, %attribs) = @_;
723 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
724 $self = $ExtUtils::MakeMaker::Parent[-1];
726 # VERSION should be sanitised before use as a file name
727 my($name) = $attribs{NAME} || '$(DISTVNAME)';
728 my($zip) = $attribs{ZIP} || 'zip';
729 my($zipflags) = $attribs{ZIPFLAGS} || '-Vu';
730 my($suffix) = $attribs{SUFFIX} || '';
731 my($shar) = $attribs{SHAR} || 'vms_share';
732 my($preop) = $attribs{PREOP} || '!'; # e.g., update MANIFEST
733 my($postop) = $attribs{POSTOP} || '!';
734 my($dist_cp) = $attribs{DIST_CP} || 'best';
735 my($dist_default) = $attribs{DIST_DEFAULT} || 'zipdist';
738 $src = "[.$src]" unless $src =~ /\[/;
740 $src .= '*.*' if $src =~ /\]$/;
743 DISTVNAME = \$(DISTNAME)-\$(VERSION_SYM)
752 DIST_DEFAULT = $dist_default
757 # --- Translation Sections ---
762 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
763 $self = $ExtUtils::MakeMaker::Parent[-1];
765 return '' unless $self->needs_linking();
768 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
775 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
776 $self = $ExtUtils::MakeMaker::Parent[-1];
778 return '' unless $self->needs_linking();
781 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET)
785 sub xs_o { # many makes are too dumb to use xs_c then c_o
788 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
789 $self = $ExtUtils::MakeMaker::Parent[-1];
791 return '' unless $self->needs_linking();
794 $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).c
795 $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c
800 # --- Target Sections ---
806 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
807 $self = $ExtUtils::MakeMaker::Parent[-1];
811 all :: config $(INST_PM) subdirs linkext manifypods reorg_packlist
814 subdirs :: $(MYEXTLIB)
817 config :: $(MAKEFILE) $(INST_LIBDIR).exists
820 config :: $(INST_ARCHAUTODIR).exists Version_check
823 config :: $(INST_AUTODIR).exists
828 push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
829 if (%{$self->{MAN1PODS}}) {
831 config :: $(INST_MAN1DIR).exists
834 push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
836 if (%{$self->{MAN3PODS}}) {
838 config :: $(INST_MAN3DIR).exists
841 push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
845 $(O_FILES) : $(H_FILES)
846 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
850 perldoc ExtUtils::MakeMaker
855 },$self->{NOECHO},q{$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
856 -e "use ExtUtils::MakeMaker qw($Version &Version_check);" -
857 -e "&Version_check('$(MM_VERSION)')"
865 my($self,%attribs) = @_;
867 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
868 $self = $ExtUtils::MakeMaker::Parent[-1];
871 return '' unless $self->needs_linking();
873 my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
874 my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
878 dynamic :: rtls.opt $(INST_ARCHAUTODIR)$(BASEEXT).opt
881 # rtls.opt is built in the same step as $(BASEEXT).opt
882 rtls.opt : $(BASEEXT).opt
883 $(TOUCH) $(MMS$TARGET)
884 ') unless $self->{SKIPHASH}{'dynamic'};
887 static :: $(INST_ARCHAUTODIR)$(BASEEXT).opt
889 ') unless $self->{SKIPHASH}{'static'};
892 $(INST_ARCHAUTODIR)$(BASEEXT).opt : $(BASEEXT).opt
893 $(CP) $(MMS$SOURCE) $(MMS$TARGET)
894 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
896 $(BASEEXT).opt : Makefile.PL
897 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Mksymlists;" -
898 ',qq[-e "Mksymlists('NAME' => '$self->{NAME}', 'DL_FUNCS' => ],
899 neatvalue($funcs),q[, 'DL_VARS' => ],neatvalue($vars),')"
900 $(PERL) -e "print ""$(INST_STATIC)/Include=$(BASEEXT)\n$(INST_STATIC)/Library\n"";" >>$(MMS$TARGET)
907 # --- Dynamic Loading Sections ---
910 my($self, %attribs) = @_;
912 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
913 $self = $ExtUtils::MakeMaker::Parent[-1];
915 return '' unless $self->needs_linking(); #might be because of a subdir
917 return '' unless $self->has_link_code();
919 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
920 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
924 OTHERLDFLAGS = $otherldflags
925 INST_DYNAMIC_DEP = $inst_dynamic_dep
929 $(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt rtls.opt $(INST_ARCHAUTODIR).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
930 ',$self->{NOECHO},'$(MKPATH) $(INST_ARCHAUTODIR)
931 Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,rtls.opt/Option,$(PERL_INC)perlshr_attr.opt/Option
932 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
935 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
940 my($self, %attribs) = @_;
942 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
943 $self = $ExtUtils::MakeMaker::Parent[-1];
947 ' unless $self->has_link_code();
949 BOOTSTRAP = '."$self->{BASEEXT}.bs".'
951 # As MakeMaker mkbootstrap might not write a file (if none is required)
952 # we use touch to prevent make continually trying to remake it.
953 # The DynaLoader only reads a non-empty file.
954 $(BOOTSTRAP) : $(MAKEFILE) '."$self->{BOOTDEP}".' $(INST_ARCHAUTODIR).exists
955 '.$self->{NOECHO}.'Write Sys$Output "Running mkbootstrap for $(NAME) ($(BSLOADLIBS))"
956 '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -
957 -e "use ExtUtils::Mkbootstrap; Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
958 '.$self->{NOECHO}.' $(TOUCH) $(MMS$TARGET)
959 '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
961 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR).exists
962 '.$self->{NOECHO}.'$(RM_RF) $(INST_BOOT)
963 - $(CP) $(BOOTSTRAP) $(INST_BOOT)
964 '.$self->{NOECHO}.'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
967 # --- Static Loading Sections ---
972 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
973 $self = $ExtUtils::MakeMaker::Parent[-1];
975 return '' unless $self->needs_linking();
980 ' unless ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB});
984 # Rely on suffix rule for update action
985 $(OBJECT) : $(INST_ARCHAUTODIR).exists
987 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB)
989 # If this extension has it's own library (eg SDBM_File)
990 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
991 push(@m, ' $(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB};
994 If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)
995 Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)
996 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR)extralibs.ld\';print F qq[$(EXTRALIBS)\n];close F;"
997 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
999 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
1004 sub installpm_x { # called by installpm perl file
1005 my($self, $dist, $inst, $splitlib) = @_;
1007 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1008 $self = $ExtUtils::MakeMaker::Parent[-1];
1010 if ($inst =~ m!#!) {
1011 warn "Warning: MM[SK] would have problems processing this file: $inst, SKIPPED\n";
1014 $inst = $self->fixpath($inst);
1015 $dist = $self->fixpath($dist);
1016 my($instdir) = $inst =~ /([^\)]+\))[^\)]*$/ ? $1 : dirname($inst);
1020 $inst : $dist \$(MAKEFILE) ${instdir}.exists \$(INST_ARCHAUTODIR).exists
1021 ",' ',$self->{NOECHO},'$(RM_F) $(MMS$TARGET)
1022 ',$self->{NOECHO},'$(CP) ',"$dist $inst",'
1023 $(CHMOD) 644 $(MMS$TARGET)
1024 ',$self->{NOECHO},'$(PERL) -e "open F,\'>>$(INST_ARCHAUTODIR).packlist\';print F qq[$(MMS$TARGET)\n];close F;"
1026 push(@m, ' $(AUTOSPLITFILE) $(MMS$TARGET) ',
1027 $self->catdir($splitlib,'auto')."\n\n")
1028 if ($splitlib and $inst =~ /\.pm$/);
1029 push(@m,$self->dir_target($instdir));
1036 my($self, %attribs) = @_;
1038 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1039 $self = $ExtUtils::MakeMaker::Parent[-1];
1041 return "\nmanifypods :\n\t\$(NOOP)\n" unless %{$self->{MAN3PODS}};
1043 my($pod2man_exe,$found_pod2man);
1044 if (defined $self->{PERL_SRC}) {
1045 $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man');
1047 $pod2man_exe = $self->catfile($Config{bin},'pod2man');
1049 if ($pod2man_exe = $self->perl_script($pod2man_exe)) { $found_pod2man = 1; }
1051 # No pod2man but some MAN3PODS to be installed
1054 Warning: I could not locate your pod2man program. As a last choice,
1055 I will look for the file to which the logical name POD2MAN
1056 points when MMK is invoked.
1059 $pod2man_exe = "pod2man";
1063 qq[POD2MAN_EXE = $pod2man_exe\n],
1064 q[POD2MAN = $(PERL) -we "%m=@ARGV;for (keys %m){" -
1065 -e "system(""MCR $^X $(POD2MAN_EXE) $_ >$m{$_}"");}"
1067 push @m, "\nmanifypods : ";
1068 push @m, join " ", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}};
1070 if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) {
1072 foreach $pod (sort keys %{$self->{MAN1PODS}}) {
1073 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1074 push @m, "$pod $self->{MAN1PODS}{$pod}\n";
1076 foreach $pod (sort keys %{$self->{MAN3PODS}}) {
1077 push @m, qq[\t\@- If F\$Search("\$(POD2MAN_EXE)").nes."" Then \$(POD2MAN) ];
1078 push @m, "$pod $self->{MAN3PODS}{$pod}\n";
1088 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1089 $self = $ExtUtils::MakeMaker::Parent[-1];
1091 return "" unless $self->{PL_FILES};
1093 foreach $plfile (sort keys %{$self->{PL_FILES}}) {
1095 all :: $self->{PL_FILES}->{$plfile}
1098 $self->{PL_FILES}->{$plfile} :: $plfile
1099 ",' $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" '," $plfile
1109 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1110 $self = $ExtUtils::MakeMaker::Parent[-1];
1112 return '' unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
1113 return '' unless @{$self->{EXE_FILES}};
1114 my(@m, $from, $to, %fromto, @to, $line);
1115 for $from (@{$self->{EXE_FILES}}) {
1116 my($path) = '$(INST_EXE)' . basename($from);
1117 local($_) = $path; # backward compatibility
1118 $to = $self->libscan($path);
1119 print "libscan($from) => '$to'\n" if ($Verbose >=2);
1122 @to = values %fromto;
1124 EXE_FILES = @{$self->{EXE_FILES}}
1131 $line = ''; #avoid unitialized var warning
1133 if (length($line) + length($to) > 80) {
1134 push @m, "\t\$(RM_F) $line\n";
1137 else { $line .= " $to"; }
1139 push @m, "\t\$(RM_F) $line\n\n";
1141 while (($from,$to) = each %fromto) {
1143 if ($to =~ m#[/>:\]]#) { $todir = dirname($to); }
1144 else { ($todir = $to) =~ s/[^\)]+$//; }
1145 $todir = $self->fixpath($todir,1);
1147 $to : $from \$(MAKEFILE) ${todir}.exists
1150 ", $self->dir_target($todir);
1156 # --- Sub-directory Sections ---
1161 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1162 $self = $ExtUtils::MakeMaker::Parent[-1];
1167 foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
1168 INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A LINKTYPE)){
1169 push @pasthru, "$key=\"$self->{$key}\"";
1172 push @m, "\nPASTHRU = \\\n ", join (",\\\n ", @pasthru), "\n";
1178 my($self, $subdir) = @_;
1180 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1181 $self = $ExtUtils::MakeMaker::Parent[-1];
1184 $subdir = $self->fixpath($subdir,1);
1188 olddef = F$Environment("Default")
1189 Set Default ',$subdir,'
1190 - $(MMS) all $(USEMACROS)$(PASTHRU)$(MACROEND)
1191 Set Default \'olddef\'
1197 # --- Cleanup and Distribution Sections ---
1200 my($self, %attribs) = @_;
1202 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1203 $self = $ExtUtils::MakeMaker::Parent[-1];
1207 # Delete temporary files but do not touch installed files. We don\'t delete
1208 # the Descrip.MMS here so that a later make realclean still has it to use.
1211 foreach $dir (@{$self->{DIR}}) { # clean subdirectories first
1212 my($vmsdir) = $self->fixpath($dir,1);
1213 push( @m, ' If F$Search("'.$vmsdir.'$(MAKEFILE)") Then \\',"\n\t",
1214 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) clean`;"',"\n");
1216 push @m, ' $(RM_F) *.Map *.lis *.cpp *$(OBJ_EXT) *$(LIB_EXT) *.Opt $(BOOTSTRAP) $(BASEEXT).bso
1219 my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
1220 push(@otherfiles, $attribs{FILES}) if $attribs{FILES};
1221 push(@otherfiles, 'blib.dir', '$(MAKE_APERL_FILE)', 'extralibs.ld', 'perlmain.c');
1222 push(@otherfiles,$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'));
1224 $line = ''; #avoid unitialized var warning
1225 foreach $file (@otherfiles) {
1226 $file = $self->fixpath($file);
1227 if (length($line) + length($file) > 80) {
1228 push @m, "\t\$(RM_RF) $line\n";
1231 else { $line .= " $file"; }
1233 push @m, "\t\$(RM_RF) $line\n\n";
1234 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1240 my($self, %attribs) = @_;
1242 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1243 $self = $ExtUtils::MakeMaker::Parent[-1];
1247 # Delete temporary files (via clean) and also delete installed files
1250 foreach(@{$self->{DIR}}){
1251 my($vmsdir) = $self->fixpath($_,1);
1252 push(@m, ' If F$Search("'."$vmsdir".'$(MAKEFILE)").nes."" Then \\',"\n\t",
1253 '$(PERL) -e "chdir ',"'$vmsdir'",'; print `$(MMS) realclean`;"',"\n");
1255 push @m,' $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
1257 # We can't expand several of the MMS macros here, since they don't have
1258 # corresponding %$self keys (i.e. they're defined in Descrip.MMS as a
1259 # combination of macros). In order to stay below DCL's 255 char limit,
1260 # we put only 2 on a line.
1261 my($file,$line,$fcnt);
1262 my(@files) = qw{ *.Opt $(INST_DYNAMIC) $(INST_STATIC) $(INST_BOOT) $(INST_PM) $(OBJECT) $(MAKEFILE) $(MAKEFILE)_old };
1263 $line = ''; #avoid unitialized var warning
1264 foreach $file (@files) {
1265 $file = $self->fixpath($file);
1266 if (length($line) + length($file) > 80 || ++$fcnt >= 2) {
1267 push @m, "\t\$(RM_F) $line\n";
1271 else { $line .= " $file"; }
1273 push @m, "\t\$(RM_F) $line\n";
1274 if ($attribs{FILES} && ref $attribs{FILES} eq 'ARRAY') {
1276 foreach $file (@{$attribs{'FILES'}}) {
1277 $file = $self->fixpath($file);
1278 if (length($line) + length($file) > 80) {
1279 push @m, "\t\$(RM_RF) $line\n";
1282 else { $line .= " $file"; }
1284 push @m, "\t\$(RM_RF) $line\n";
1286 push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP};
1294 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1295 $self = $ExtUtils::MakeMaker::Parent[-1];
1298 distclean :: realclean distcheck
1302 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; fullcheck()"
1305 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&fullcheck\'; skipcheck()"
1308 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest \'&mkmanifest\'; mkmanifest()"
1316 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1317 $self = $ExtUtils::MakeMaker::Parent[-1];
1320 dist : $(DIST_DEFAULT)
1323 zipdist : $(DISTVNAME).zip$(SUFFIX)
1326 $(DISTVNAME).zip$(SUFFIX) : distdir
1328 $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) $(SRC)
1329 $(RM_RF) $(DISTVNAME)
1334 $(SHARE) $(SRC) $(DISTVNAME).share$(SUFFIX)
1335 $(RM_RF) $(DISTVNAME)
1344 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1345 $self = $ExtUtils::MakeMaker::Parent[-1];
1349 $(RM_RF) $(DISTVNAME)
1350 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e "use ExtUtils::Manifest '/mani/';" \\
1351 -e "manicopy(maniread(),'$(DISTVNAME)','$(DIST_CP)');"
1359 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1360 $self = $ExtUtils::MakeMaker::Parent[-1];
1364 startdir = F$Environment("Default")
1365 Set Default [.$(DISTVNAME)]
1366 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL
1369 Set Default 'startdir'
1376 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1377 $self = $ExtUtils::MakeMaker::Parent[-1];
1383 # --- Test and Installation Sections ---
1388 my($self, %attribs) = @_;
1390 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1391 $self = $ExtUtils::MakeMaker::Parent[-1];
1396 },$self->{NOECHO},q{Write Sys$Output "Appending installation info to $(INST_ARCHLIB)perllocal.pod"
1397 },$self->{NOECHO},q{$(PERL) "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\
1398 -e "use ExtUtils::MakeMaker; MY->new({})->writedoc('Module', '$(NAME)', \\
1399 'LINKTYPE=$(LINKTYPE)', 'VERSION=$(VERSION)', 'XS_VERSION=$(XS_VERSION)', 'EXE_FILES=$(EXE_FILES)')" \\
1400 >>$(INSTALLARCHLIB)perllocal.pod
1404 install :: pure_install doc_install
1407 # Interim solution for VMS; assumes directory tree of same structure under
1408 # both \$(INST_LIB) and \$(INSTALLPRIVLIB). This operation will be assumed
1409 # into MakeMaker in a (near) future version.
1412 # # install subdirectories first
1413 # foreach(@{$self->{DIR}}){
1414 # my($vmsdir) = $self->fixpath($_,1);
1415 # push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1416 # '; print `$(MMS) install`"'."\n");
1419 # push(@m, ' ',$self->{NOECHO},'$(PERL) "-I$(PERL_LIB)" -e "use File::Path; mkpath(\@ARGV)" $(INSTALLPRIVLIB) $(INSTALLARCHLIB)
1420 # ',$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)
1421 # ',$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)',"
1422 # # Can't install manpages here -- INST_MAN%DIR macros make line >255 chars
1423 # \$(MMS) \$(USEMACROS)INST_LIB=$self->{INSTALLPRIVLIB},INST_ARCHLIB=$self->{INSTALLARCHLIB},INST_EXE=$self->{INSTALLBIN}\$(MACROEND)",'
1424 # ',$self->{NOECHO},'$(PERL) -i_bak -lne "print unless $seen{$_}++" $(INST_ARCHAUTODIR).packlist
1427 my($curtop,$insttop);
1428 ($curtop = $self->fixpath($self->{INST_LIB},1)) =~ s/]$//;
1429 ($insttop = $self->fixpath($self->{INSTALLPRIVLIB},1)) =~ s/]$//;
1430 push(@m," Backup/Log ${curtop}...]*.*; ${insttop}...]/New_Version/By_Owner=Parent\n");
1432 my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
1434 # This song and dance brought to you by DCL\'s 255 char limit
1437 my($oldpacklist) = $self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist');
1438 if ("\L$oldpacklist" ne "\L$self->{INST_ARCHAUTODIR}.packlist") {
1439 push(@m,' If F$Search("',$oldpacklist,'").nes."" Then Append/New ',$oldpacklist,' $(INST_ARCHAUTODIR).packlist');
1442 $(PERL) -ne "BEGIN{exit unless -e $ARGV[0];}print unless $s{$_}++;" $(INST_ARCHAUTODIR).packlist >.MM_tmp
1443 If F$Search(".MM_tmp").nes."" Then Copy/NoConfirm .MM_tmp $(INST_ARCHAUTODIR).packlist
1444 If F$Search(".MM_tmp").nes."" Then Delete/NoConfirm .MM_tmp;
1450 # Comment on .packlist rewrite above:
1451 # Read both .packlist files: the old one in PERL_ARCHLIB/auto/FULLEXT, and the new one
1452 # in INSTARCHAUTODIR. Don't croak if they are missing. Write to the one
1453 # in INSTARCHAUTODIR.
1457 ##### UNINSTALL IS STILL EXPERIMENTAL ####
1460 foreach(@{$self->{DIR}}){
1461 my($vmsdir) = $self->fixpath($_,1);
1462 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1463 '; print `$(MMS) uninstall`"'."\n");
1465 push @m, "\t".'$(PERL) -le "use File::Path; foreach (<>) {s/',"$curtop/$insttop/;",'rmtree($_,1,0);}" <$(INST_ARCHAUTODIR).packlist
1475 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1476 $self = $ExtUtils::MakeMaker::Parent[-1];
1481 $(OBJECT) : $(PERL_INC)EXTERN.h, $(PERL_INC)INTERN.h, $(PERL_INC)XSUB.h, $(PERL_INC)av.h
1482 $(OBJECT) : $(PERL_INC)cop.h, $(PERL_INC)cv.h, $(PERL_INC)embed.h, $(PERL_INC)form.h
1483 $(OBJECT) : $(PERL_INC)gv.h, $(PERL_INC)handy.h, $(PERL_INC)hv.h, $(PERL_INC)keywords.h
1484 $(OBJECT) : $(PERL_INC)mg.h, $(PERL_INC)op.h, $(PERL_INC)opcode.h, $(PERL_INC)patchlevel.h
1485 $(OBJECT) : $(PERL_INC)perl.h, $(PERL_INC)perly.h, $(PERL_INC)pp.h, $(PERL_INC)proto.h
1486 $(OBJECT) : $(PERL_INC)regcomp.h, $(PERL_INC)regexp.h, $(PERL_INC)scope.h, $(PERL_INC)sv.h
1487 $(OBJECT) : $(PERL_INC)vmsish.h, $(PERL_INC)util.h, $(PERL_INC)config.h
1489 ' if $self->{OBJECT};
1492 # Check for unpropagated config.sh changes. Should never happen.
1493 # We do NOT just update config.h because that is not sufficient.
1494 # An out of date config.h is not fatal but complains loudly!
1495 #$(PERL_INC)config.h : $(PERL_SRC)config.sh
1496 $(PERL_INC)config.h : $(PERL_VMS)config.vms
1497 ',$self->{NOECHO},'Write Sys$Error "Warning: $(PERL_INC)config.h out of date with $(PERL_VMS)config.vms"
1499 #$(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh
1500 $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
1501 ',$self->{NOECHO},'Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
1502 olddef = F$Environment("Default")
1503 Set Default $(PERL_SRC)
1504 $(MMS) $(USEMAKEFILE)[.VMS]$(MAKEFILE) [.lib.',$Config{'arch'},']config.pm
1505 Set Default \'olddef\'
1506 ') if $self->{PERL_SRC};
1508 push(@m, join(" ", map($self->fixpath($_),values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n")
1517 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1518 $self = $ExtUtils::MakeMaker::Parent[-1];
1521 # We do not know what target was originally specified so we
1522 # must force a manual rerun to be sure. But as it should only
1523 # happen very rarely it is not a significant problem.
1525 $(OBJECT) : $(FIRST_MAKEFILE)
1526 ' if $self->{OBJECT};
1529 # We take a very conservative approach here, but it\'s worth it.
1530 # We move $(MAKEFILE) to $(MAKEFILE)_old here to avoid gnu make looping.
1531 $(MAKEFILE) : Makefile.PL $(CONFIGDEP)
1532 ',$self->{NOECHO},'Write Sys$Output "$(MAKEFILE) out-of-date with respect to $(MMS$SOURCE_LIST)"
1533 ',$self->{NOECHO},'Write Sys$Output "Cleaning current config before rebuilding $(MAKEFILE) ..."
1534 - $(MV) $(MAKEFILE) $(MAKEFILE)_old
1535 - $(MMS) $(USEMAKEFILE)$(MAKEFILE)_old clean
1536 $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL ',join(' ',@ARGV),'
1537 ',$self->{NOECHO},'Write Sys$Output "$(MAKEFILE) has been rebuilt."
1538 ',$self->{NOECHO},'Write Sys$Output "Please run $(MMS) to build the extension."
1546 my($self, %attribs) = @_;
1548 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1549 $self = $ExtUtils::MakeMaker::Parent[-1];
1551 my($tests) = $attribs{TESTS} || ( -d 't' ? 't/*.t' : '');
1555 TEST_TYPE=test_\$(LINKTYPE)
1557 test : \$(TEST_TYPE)
1560 foreach(@{$self->{DIR}}){
1561 my($vmsdir) = $self->fixpath($_,1);
1562 push(@m, ' If F$Search("',$vmsdir,'$(MAKEFILE)").nes."" Then $(PERL) -e "chdir ',"'$vmsdir'",
1563 '; print `$(MMS) $(PASTHRU2) test`'."\n");
1565 push(@m, "\t$self->{NOECHO}Write Sys\$Output 'No tests defined for \$(NAME) extension.'\n")
1566 unless $tests or -f "test.pl" or @{$self->{DIR}};
1569 push(@m, "test_dynamic :: all\n");
1570 push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests;
1571 push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl";
1574 # Occasionally we may face this degenerate target:
1575 push @m, "test_ : test_dynamic\n\n";
1577 if ($self->needs_linking()) {
1578 push(@m, "test_static :: all \$(MAP_TARGET)\n");
1579 push(@m, $self->test_via_harness('$(MAP_TARGET)', $tests)) if $tests;
1580 push(@m, $self->test_via_script('$(MAP_TARGET)', 'test.pl')) if -f "test.pl";
1584 push @m, "test_static :: test_dynamic\n";
1591 sub test_via_harness {
1592 my($self,$perl,$tests) = @_;
1594 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1595 $self = $ExtUtils::MakeMaker::Parent[-1];
1597 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)" \\'."\n\t".
1598 '-e "use Test::Harness qw(&runtests $verbose); $verbose=$(TEST_VERBOSE); runtests @ARGV;" \\'."\n\t$tests\n";
1602 sub test_via_script {
1603 my($self,$perl,$script) = @_;
1605 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1606 $self = $ExtUtils::MakeMaker::Parent[-1];
1608 " $perl".' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" test.pl
1614 my($self, %attribs) = @_;
1616 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1617 $self = $ExtUtils::MakeMaker::Parent[-1];
1619 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
1620 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
1623 # --- MakeMaker makeaperl section ---
1624 MAP_TARGET = $target
1626 return join '', @m if $self->{PARENT};
1628 my($dir) = join ":", @{$self->{DIR}};
1630 unless ($self->{MAKEAPERL}) {
1632 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
1633 },$self->{NOECHO},q{Write Sys$Output "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)"
1634 },$self->{NOECHO},q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
1635 Makefile.PL DIR=}, $dir, q{ \
1636 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
1637 MAKEAPERL=1 NORECURS=1
1639 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
1640 $(MMS)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET)
1642 push @m, map( " \\\n\t\t$_", @ARGV );
1649 my($linkcmd,@staticopts,@staticpkgs,$extralist,$target,$targdir,$libperldir);
1651 # The front matter of the linkcommand...
1652 $linkcmd = join ' ', $Config{'ld'},
1653 grep($_, @Config{qw(large split ldflags ccdlflags)});
1654 $linkcmd =~ s/\s+/ /g;
1656 # Which *.olb files could we make use of...
1658 $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)";
1659 File::Find::find(sub {
1660 return unless m/\Q$self->{LIB_EXT}\E$/;
1661 return if m/^libperl/;
1662 $olbs{$ENV{DEFAULT}} = $_;
1663 }, grep( -d $_, @{$searchdirs || []}));
1665 # We trust that what has been handed in as argument will be buildable
1666 $static = [] unless $static;
1667 @olbs{@{$static}} = (1) x @{$static};
1669 $extra = [] unless $extra && ref $extra eq 'ARRAY';
1670 # Sort the object libraries in inverse order of
1671 # filespec length to try to insure that dependent extensions
1672 # will appear before their parents, so the linker will
1673 # search the parent library to resolve references.
1674 # (e.g. Intuit::DWIM will precede Intuit, so unresolved
1675 # references from [.intuit.dwim]dwim.obj can be found
1676 # in [.intuit]intuit.olb).
1677 for (sort keys %olbs) {
1678 next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/;
1679 my($dir) = $self->fixpath($_,1);
1680 my($extralibs) = $dir . "extralibs.ld";
1681 my($extopt) = $dir . $olbs{$_};
1682 $extopt =~ s/$self->{LIB_EXT}$/.opt/;
1683 if (-f $extralibs ) {
1684 open LIST,$extralibs or warn $!,next;
1685 push @$extra, <LIST>;
1689 open OPT,$extopt or die $!;
1691 next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/;
1692 # ExtUtils::Miniperl expects Unix paths
1693 (my($pkg) = "$1_$1$self->{LIB_EXT}") =~ s#_*#/#g;
1694 push @staticpkgs,$pkg;
1696 push @staticopts, $extopt;
1700 $target = "Perl.Exe" unless $target;
1701 ($shrtarget,$targdir) = fileparse($target);
1702 $shrtarget =~ s/^([^.]*)/$1Shr/;
1703 $shrtarget = $targdir . $shrtarget;
1704 $target = "Perlshr.$Config{'dlext'}" unless $target;
1705 $tmp = "[]" unless $tmp;
1706 $tmp = $self->fixpath($tmp,1);
1708 $extralist = join(' ',@$extra);
1709 $extralist =~ s/[,\s\n]+/, /g;
1711 else { $extralist = ''; }
1713 unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) {
1714 print STDOUT "Warning: $libperl not found\n";
1719 if (defined $self->{PERL_SRC}) {
1720 $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}");
1721 } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) {
1723 print STDOUT "Warning: $libperl not found
1724 If you're going to build a static perl binary, make sure perl is installed
1725 otherwise ignore this warning\n";
1728 $libperldir = $self->fixpath((fileparse($libperl))[1],1);
1731 # Fill in the target you want to produce if it\'s not perl
1732 MAP_TARGET = ',$self->fixpath($target),'
1733 MAP_SHRTARGET = ',$self->fixpath($shrtarget),"
1734 MAP_LINKCMD = $linkcmd
1735 MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : '','
1736 # We use the linker options files created with each extension, rather than
1737 #specifying the object files directly on the command line.
1738 MAP_STATIC = ',@staticopts ? join(' ', @staticopts) : '','
1739 MAP_OPTS = ',@staticopts ? ','.join(',', map($_.'/Option', @staticopts)) : '',"
1740 MAP_EXTRA = $extralist
1741 MAP_LIBPERL = ",$self->fixpath($libperl),'
1746 $(MAP_SHRTARGET) : $(MAP_LIBPERL) $(MAP_STATIC) ',"${libperldir}Perlshr_Attr.Opt",'
1747 $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_OPTS), $(MAP_EXTRA), $(MAP_LIBPERL) ',"${libperldir}Perlshr_Attr.Opt",'
1748 $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmp}perlmain\$(OBJ_EXT) ${tmp}PerlShr.Opt",'
1749 $(MAP_LINKCMD) ',"${tmp}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option
1750 ',$self->{NOECHO},'Write Sys$Output "To install the new ""$(MAP_TARGET)"" binary, say"
1751 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)"
1752 ',$self->{NOECHO},'Write Sys$Output "To remove the intermediate files, say
1753 ',$self->{NOECHO},'Write Sys$Output " $(MMS)$(USEMAKEFILE)$(MAKEFILE) map_clean"
1756 ',"${tmp}perlmain.c",' : $(MAKEFILE)
1757 ',$self->{NOECHO},'$(PERL) $(MAP_PERLINC) -e "use ExtUtils::Miniperl; writemain(qw|',@staticpkgs,'|)" >$(MMS$TARGET)
1762 },$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)')"
1766 inst_perl : pure_inst_perl doc_inst_perl
1769 pure_inst_perl : \$(MAP_TARGET)
1770 $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1),"
1771 $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1),"
1777 \$(RM_F) ${tmp}perlmain\$(OBJ_EXT) ${tmp}perlmain.c \$(MAKEFILE)
1778 \$(RM_F) ${tmp}PerlShr.Opt \$(MAP_TARGET)
1787 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1788 $self = $ExtUtils::MakeMaker::Parent[-1];
1794 # --- Make-Directories section (internal method) ---
1795 # dir_target(@array) returns a Makefile entry for the file .exists in each
1796 # named directory. Returns nothing, if the entry has already been processed.
1797 # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar".
1798 # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the
1799 # prerequisite, because there has to be one, something that doesn't change
1803 my($self,@dirs) = @_;
1805 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1806 $self = $ExtUtils::MakeMaker::Parent[-1];
1809 foreach $dir (@dirs) {
1810 next if $self->{DIR_TARGET}{$self}{$dir}++;
1811 my($vmsdir) = $self->fixpath($dir,1);
1813 ${vmsdir}.exists :: \$(PERL_INC)perl.h
1814 $self->{NOECHO}\$(MKPATH) $vmsdir
1815 $self->{NOECHO}\$(TOUCH) ${vmsdir}.exists
1822 # --- Output postprocessing section ---
1825 # Insure that colons marking targets are preceded by space -
1826 # most Unix Makes don't need this, but it's necessary under VMS
1827 # to distinguish the target delimiter from a colon appearing as
1828 # part of a filespec.
1830 my($self,$text) = @_;
1832 ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]);
1833 $self = $ExtUtils::MakeMaker::Parent[-1];
1835 $text =~ s/([^\s:])(:+\s)/$1 $2/gs;
1845 ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
1849 See ExtUtils::MM_Unix for a documentation of the methods provided
1850 there. This package overrides the implementation of these methods, not