| 1 | package ExtUtils::MM_VMS; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | |||
| 5 | use ExtUtils::MakeMaker::Config; | ||
| 6 | require Exporter; | ||
| 7 | |||
| 8 | BEGIN { | ||
| 9 | # so we can compile the thing on non-VMS platforms. | ||
| 10 | if( $^O eq 'VMS' ) { | ||
| 11 | require VMS::Filespec; | ||
| 12 | VMS::Filespec->import; | ||
| 13 | } | ||
| 14 | } | ||
| 15 | |||
| 16 | use File::Basename; | ||
| 17 | |||
| 18 | our $VERSION = '7.13_01'; | ||
| 19 | $VERSION = eval $VERSION; | ||
| 20 | |||
| 21 | require ExtUtils::MM_Any; | ||
| 22 | require ExtUtils::MM_Unix; | ||
| 23 | our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); | ||
| 24 | |||
| 25 | use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562); | ||
| 26 | our $Revision = $ExtUtils::MakeMaker::Revision; | ||
| 27 | |||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker | ||
| 32 | |||
| 33 | =head1 SYNOPSIS | ||
| 34 | |||
| 35 | Do not use this directly. | ||
| 36 | Instead, use ExtUtils::MM and it will figure out which MM_* | ||
| 37 | class to use for you. | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | See ExtUtils::MM_Unix for a documentation of the methods provided | ||
| 42 | there. This package overrides the implementation of these methods, not | ||
| 43 | the semantics. | ||
| 44 | |||
| 45 | =head2 Methods always loaded | ||
| 46 | |||
| 47 | =over 4 | ||
| 48 | |||
| 49 | =item wraplist | ||
| 50 | |||
| 51 | Converts a list into a string wrapped at approximately 80 columns. | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | sub wraplist { | ||
| 56 | my($self) = shift; | ||
| 57 | my($line,$hlen) = ('',0); | ||
| 58 | |||
| 59 | foreach my $word (@_) { | ||
| 60 | # Perl bug -- seems to occasionally insert extra elements when | ||
| 61 | # traversing array (scalar(@array) doesn't show them, but | ||
| 62 | # foreach(@array) does) (5.00307) | ||
| 63 | next unless $word =~ /\w/; | ||
| 64 | $line .= ' ' if length($line); | ||
| 65 | if ($hlen > 80) { $line .= "\\\n\t"; $hlen = 0; } | ||
| 66 | $line .= $word; | ||
| 67 | $hlen += length($word) + 2; | ||
| 68 | } | ||
| 69 | $line; | ||
| 70 | } | ||
| 71 | |||
| 72 | |||
| 73 | # This isn't really an override. It's just here because ExtUtils::MM_VMS | ||
| 74 | # appears in @MM::ISA before ExtUtils::Liblist::Kid, so if there isn't an ext() | ||
| 75 | # in MM_VMS, then AUTOLOAD is called, and bad things happen. So, we just | ||
| 76 | # mimic inheritance here and hand off to ExtUtils::Liblist::Kid. | ||
| 77 | # XXX This hackery will die soon. --Schwern | ||
| 78 | sub ext { | ||
| 79 | require ExtUtils::Liblist::Kid; | ||
| 80 | goto &ExtUtils::Liblist::Kid::ext; | ||
| 81 | } | ||
| 82 | |||
| 83 | =back | ||
| 84 | |||
| 85 | =head2 Methods | ||
| 86 | |||
| 87 | Those methods which override default MM_Unix methods are marked | ||
| 88 | "(override)", while methods unique to MM_VMS are marked "(specific)". | ||
| 89 | For overridden methods, documentation is limited to an explanation | ||
| 90 | of why this method overrides the MM_Unix method; see the ExtUtils::MM_Unix | ||
| 91 | documentation for more details. | ||
| 92 | |||
| 93 | =over 4 | ||
| 94 | |||
| 95 | =item guess_name (override) | ||
| 96 | |||
| 97 | Try to determine name of extension being built. We begin with the name | ||
| 98 | of the current directory. Since VMS filenames are case-insensitive, | ||
| 99 | however, we look for a F<.pm> file whose name matches that of the current | ||
| 100 | directory (presumably the 'main' F<.pm> file for this extension), and try | ||
| 101 | to find a C<package> statement from which to obtain the Mixed::Case | ||
| 102 | package name. | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | sub guess_name { | ||
| 107 | my($self) = @_; | ||
| 108 | my($defname,$defpm,@pm,%xs); | ||
| 109 | local *PM; | ||
| 110 | |||
| 111 | $defname = basename(fileify($ENV{'DEFAULT'})); | ||
| 112 | $defname =~ s![\d\-_]*\.dir.*$!!; # Clip off .dir;1 suffix, and package version | ||
| 113 | $defpm = $defname; | ||
| 114 | # Fallback in case for some reason a user has copied the files for an | ||
| 115 | # extension into a working directory whose name doesn't reflect the | ||
| 116 | # extension's name. We'll use the name of a unique .pm file, or the | ||
| 117 | # first .pm file with a matching .xs file. | ||
| 118 | if (not -e "${defpm}.pm") { | ||
| 119 | @pm = glob('*.pm'); | ||
| 120 | s/.pm$// for @pm; | ||
| 121 | if (@pm == 1) { ($defpm = $pm[0]) =~ s/.pm$//; } | ||
| 122 | elsif (@pm) { | ||
| 123 | %xs = map { s/.xs$//; ($_,1) } glob('*.xs'); ## no critic | ||
| 124 | if (keys %xs) { | ||
| 125 | foreach my $pm (@pm) { | ||
| 126 | $defpm = $pm, last if exists $xs{$pm}; | ||
| 127 | } | ||
| 128 | } | ||
| 129 | } | ||
| 130 | } | ||
| 131 | if (open(my $pm, '<', "${defpm}.pm")){ | ||
| 132 | while (<$pm>) { | ||
| 133 | if (/^\s*package\s+([^;]+)/i) { | ||
| 134 | $defname = $1; | ||
| 135 | last; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | print "Warning (non-fatal): Couldn't find package name in ${defpm}.pm;\n\t", | ||
| 139 | "defaulting package name to $defname\n" | ||
| 140 | if eof($pm); | ||
| 141 | close $pm; | ||
| 142 | } | ||
| 143 | else { | ||
| 144 | print "Warning (non-fatal): Couldn't find ${defpm}.pm;\n\t", | ||
| 145 | "defaulting package name to $defname\n"; | ||
| 146 | } | ||
| 147 | $defname =~ s#[\d.\-_]+$##; | ||
| 148 | $defname; | ||
| 149 | } | ||
| 150 | |||
| 151 | =item find_perl (override) | ||
| 152 | |||
| 153 | Use VMS file specification syntax and CLI commands to find and | ||
| 154 | invoke Perl images. | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | sub find_perl { | ||
| 159 | my($self, $ver, $names, $dirs, $trace) = @_; | ||
| 160 | my($vmsfile,@sdirs,@snames,@cand); | ||
| 161 | my($rslt); | ||
| 162 | my($inabs) = 0; | ||
| 163 | local *TCF; | ||
| 164 | |||
| 165 | if( $self->{PERL_CORE} ) { | ||
| 166 | # Check in relative directories first, so we pick up the current | ||
| 167 | # version of Perl if we're running MakeMaker as part of the main build. | ||
| 168 | @sdirs = sort { my($absa) = $self->file_name_is_absolute($a); | ||
| 169 | my($absb) = $self->file_name_is_absolute($b); | ||
| 170 | if ($absa && $absb) { return $a cmp $b } | ||
| 171 | else { return $absa ? 1 : ($absb ? -1 : ($a cmp $b)); } | ||
| 172 | } @$dirs; | ||
| 173 | # Check miniperl before perl, and check names likely to contain | ||
| 174 | # version numbers before "generic" names, so we pick up an | ||
| 175 | # executable that's less likely to be from an old installation. | ||
| 176 | @snames = sort { my($ba) = $a =~ m!([^:>\]/]+)$!; # basename | ||
| 177 | my($bb) = $b =~ m!([^:>\]/]+)$!; | ||
| 178 | my($ahasdir) = (length($a) - length($ba) > 0); | ||
| 179 | my($bhasdir) = (length($b) - length($bb) > 0); | ||
| 180 | if ($ahasdir and not $bhasdir) { return 1; } | ||
| 181 | elsif ($bhasdir and not $ahasdir) { return -1; } | ||
| 182 | else { $bb =~ /\d/ <=> $ba =~ /\d/ | ||
| 183 | or substr($ba,0,1) cmp substr($bb,0,1) | ||
| 184 | or length($bb) <=> length($ba) } } @$names; | ||
| 185 | } | ||
| 186 | else { | ||
| 187 | @sdirs = @$dirs; | ||
| 188 | @snames = @$names; | ||
| 189 | } | ||
| 190 | |||
| 191 | # Image names containing Perl version use '_' instead of '.' under VMS | ||
| 192 | s/\.(\d+)$/_$1/ for @snames; | ||
| 193 | if ($trace >= 2){ | ||
| 194 | print "Looking for perl $ver by these names:\n"; | ||
| 195 | print "\t@snames,\n"; | ||
| 196 | print "in these dirs:\n"; | ||
| 197 | print "\t@sdirs\n"; | ||
| 198 | } | ||
| 199 | foreach my $dir (@sdirs){ | ||
| 200 | next unless defined $dir; # $self->{PERL_SRC} may be undefined | ||
| 201 | $inabs++ if $self->file_name_is_absolute($dir); | ||
| 202 | if ($inabs == 1) { | ||
| 203 | # We've covered relative dirs; everything else is an absolute | ||
| 204 | # dir (probably an installed location). First, we'll try | ||
| 205 | # potential command names, to see whether we can avoid a long | ||
| 206 | # MCR expression. | ||
| 207 | foreach my $name (@snames) { | ||
| 208 | push(@cand,$name) if $name =~ /^[\w\-\$]+$/; | ||
| 209 | } | ||
| 210 | $inabs++; # Should happen above in next $dir, but just in case... | ||
| 211 | } | ||
| 212 | foreach my $name (@snames){ | ||
| 213 | push @cand, ($name !~ m![/:>\]]!) ? $self->catfile($dir,$name) | ||
| 214 | : $self->fixpath($name,0); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | foreach my $name (@cand) { | ||
| 218 | print "Checking $name\n" if $trace >= 2; | ||
| 219 | # If it looks like a potential command, try it without the MCR | ||
| 220 | if ($name =~ /^[\w\-\$]+$/) { | ||
| 221 | open(my $tcf, ">", "temp_mmvms.com") | ||
| 222 | or die('unable to open temp file'); | ||
| 223 | print $tcf "\$ set message/nofacil/nosever/noident/notext\n"; | ||
| 224 | print $tcf "\$ $name -e \"require $ver; print \"\"VER_OK\\n\"\"\"\n"; | ||
| 225 | close $tcf; | ||
| 226 | $rslt = `\@temp_mmvms.com` ; | ||
| 227 | unlink('temp_mmvms.com'); | ||
| 228 | if ($rslt =~ /VER_OK/) { | ||
| 229 | print "Using PERL=$name\n" if $trace; | ||
| 230 | return $name; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | next unless $vmsfile = $self->maybe_command($name); | ||
| 234 | $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well | ||
| 235 | print "Executing $vmsfile\n" if ($trace >= 2); | ||
| 236 | open(my $tcf, '>', "temp_mmvms.com") | ||
| 237 | or die('unable to open temp file'); | ||
| 238 | print $tcf "\$ set message/nofacil/nosever/noident/notext\n"; | ||
| 239 | print $tcf "\$ mcr $vmsfile -e \"require $ver; print \"\"VER_OK\\n\"\"\" \n"; | ||
| 240 | close $tcf; | ||
| 241 | $rslt = `\@temp_mmvms.com`; | ||
| 242 | unlink('temp_mmvms.com'); | ||
| 243 | if ($rslt =~ /VER_OK/) { | ||
| 244 | print "Using PERL=MCR $vmsfile\n" if $trace; | ||
| 245 | return "MCR $vmsfile"; | ||
| 246 | } | ||
| 247 | } | ||
| 248 | print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; | ||
| 249 | 0; # false and not empty | ||
| 250 | } | ||
| 251 | |||
| 252 | =item _fixin_replace_shebang (override) | ||
| 253 | |||
| 254 | Helper routine for MM->fixin(), overridden because there's no such thing as an | ||
| 255 | actual shebang line that will be interpreted by the shell, so we just prepend | ||
| 256 | $Config{startperl} and preserve the shebang line argument for any switches it | ||
| 257 | may contain. | ||
| 258 | |||
| 259 | =cut | ||
| 260 | |||
| 261 | sub _fixin_replace_shebang { | ||
| 262 | my ( $self, $file, $line ) = @_; | ||
| 263 | |||
| 264 | my ( undef, $arg ) = split ' ', $line, 2; | ||
| 265 | |||
| 266 | return $Config{startperl} . "\n" . $Config{sharpbang} . "perl $arg\n"; | ||
| 267 | } | ||
| 268 | |||
| 269 | =item maybe_command (override) | ||
| 270 | |||
| 271 | Follows VMS naming conventions for executable files. | ||
| 272 | If the name passed in doesn't exactly match an executable file, | ||
| 273 | appends F<.Exe> (or equivalent) to check for executable image, and F<.Com> | ||
| 274 | to check for DCL procedure. If this fails, checks directories in DCL$PATH | ||
| 275 | and finally F<Sys$System:> for an executable file having the name specified, | ||
| 276 | with or without the F<.Exe>-equivalent suffix. | ||
| 277 | |||
| 278 | =cut | ||
| 279 | |||
| 280 | sub maybe_command { | ||
| 281 | my($self,$file) = @_; | ||
| 282 | return $file if -x $file && ! -d _; | ||
| 283 | my(@dirs) = (''); | ||
| 284 | my(@exts) = ('',$Config{'exe_ext'},'.exe','.com'); | ||
| 285 | |||
| 286 | if ($file !~ m![/:>\]]!) { | ||
| 287 | for (my $i = 0; defined $ENV{"DCL\$PATH;$i"}; $i++) { | ||
| 288 | my $dir = $ENV{"DCL\$PATH;$i"}; | ||
| 289 | $dir .= ':' unless $dir =~ m%[\]:]$%; | ||
| 290 | push(@dirs,$dir); | ||
| 291 | } | ||
| 292 | push(@dirs,'Sys$System:'); | ||
| 293 | foreach my $dir (@dirs) { | ||
| 294 | my $sysfile = "$dir$file"; | ||
| 295 | foreach my $ext (@exts) { | ||
| 296 | return $file if -x "$sysfile$ext" && ! -d _; | ||
| 297 | } | ||
| 298 | } | ||
| 299 | } | ||
| 300 | return 0; | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 304 | =item pasthru (override) | ||
| 305 | |||
| 306 | The list of macro definitions to be passed through must be specified using | ||
| 307 | the /MACRO qualifier and must not add another /DEFINE qualifier. We prepend | ||
| 308 | our own comma here to the contents of $(PASTHRU_DEFINE) because it is often | ||
| 309 | empty and a comma always present in CCFLAGS would generate a missing | ||
| 310 | qualifier value error. | ||
| 311 | |||
| 312 | =cut | ||
| 313 | |||
| 314 | sub pasthru { | ||
| 315 | my($self) = shift; | ||
| 316 | my $pasthru = $self->SUPER::pasthru; | ||
| 317 | $pasthru =~ s|(PASTHRU\s*=\s*)|$1/MACRO=(|; | ||
| 318 | $pasthru =~ s|\n\z|)\n|m; | ||
| 319 | $pasthru =~ s|/defi?n?e?=\(?([^\),]+)\)?|,$1|ig; | ||
| 320 | |||
| 321 | return $pasthru; | ||
| 322 | } | ||
| 323 | |||
| 324 | |||
| 325 | =item pm_to_blib (override) | ||
| 326 | |||
| 327 | VMS wants a dot in every file so we can't have one called 'pm_to_blib', | ||
| 328 | it becomes 'pm_to_blib.' and MMS/K isn't smart enough to know that when | ||
| 329 | you have a target called 'pm_to_blib' it should look for 'pm_to_blib.'. | ||
| 330 | |||
| 331 | So in VMS its pm_to_blib.ts. | ||
| 332 | |||
| 333 | =cut | ||
| 334 | |||
| 335 | sub pm_to_blib { | ||
| 336 | my $self = shift; | ||
| 337 | |||
| 338 | my $make = $self->SUPER::pm_to_blib; | ||
| 339 | |||
| 340 | $make =~ s{^pm_to_blib :}{pm_to_blib.ts :}m; | ||
| 341 | $make =~ s{\$\(TOUCH\) pm_to_blib}{\$(TOUCH) pm_to_blib.ts}; | ||
| 342 | |||
| 343 | $make = <<'MAKE' . $make; | ||
| 344 | # Dummy target to match Unix target name; we use pm_to_blib.ts as | ||
| 345 | # timestamp file to avoid repeated invocations under VMS | ||
| 346 | pm_to_blib : pm_to_blib.ts | ||
| 347 | $(NOECHO) $(NOOP) | ||
| 348 | |||
| 349 | MAKE | ||
| 350 | |||
| 351 | return $make; | ||
| 352 | } | ||
| 353 | |||
| 354 | |||
| 355 | =item perl_script (override) | ||
| 356 | |||
| 357 | If name passed in doesn't specify a readable file, appends F<.com> or | ||
| 358 | F<.pl> and tries again, since it's customary to have file types on all files | ||
| 359 | under VMS. | ||
| 360 | |||
| 361 | =cut | ||
| 362 | |||
| 363 | sub perl_script { | ||
| 364 | my($self,$file) = @_; | ||
| 365 | return $file if -r $file && ! -d _; | ||
| 366 | return "$file.com" if -r "$file.com"; | ||
| 367 | return "$file.pl" if -r "$file.pl"; | ||
| 368 | return ''; | ||
| 369 | } | ||
| 370 | |||
| 371 | |||
| 372 | =item replace_manpage_separator | ||
| 373 | |||
| 374 | Use as separator a character which is legal in a VMS-syntax file name. | ||
| 375 | |||
| 376 | =cut | ||
| 377 | |||
| 378 | sub replace_manpage_separator { | ||
| 379 | my($self,$man) = @_; | ||
| 380 | $man = unixify($man); | ||
| 381 | $man =~ s#/+#__#g; | ||
| 382 | $man; | ||
| 383 | } | ||
| 384 | |||
| 385 | =item init_DEST | ||
| 386 | |||
| 387 | (override) Because of the difficulty concatenating VMS filepaths we | ||
| 388 | must pre-expand the DEST* variables. | ||
| 389 | |||
| 390 | =cut | ||
| 391 | |||
| 392 | sub init_DEST { | ||
| 393 | my $self = shift; | ||
| 394 | |||
| 395 | $self->SUPER::init_DEST; | ||
| 396 | |||
| 397 | # Expand DEST variables. | ||
| 398 | foreach my $var ($self->installvars) { | ||
| 399 | my $destvar = 'DESTINSTALL'.$var; | ||
| 400 | $self->{$destvar} = $self->eliminate_macros($self->{$destvar}); | ||
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 | |||
| 405 | =item init_DIRFILESEP | ||
| 406 | |||
| 407 | No separator between a directory path and a filename on VMS. | ||
| 408 | |||
| 409 | =cut | ||
| 410 | |||
| 411 | sub init_DIRFILESEP { | ||
| 412 | my($self) = shift; | ||
| 413 | |||
| 414 | $self->{DIRFILESEP} = ''; | ||
| 415 | return 1; | ||
| 416 | } | ||
| 417 | |||
| 418 | |||
| 419 | =item init_main (override) | ||
| 420 | |||
| 421 | |||
| 422 | =cut | ||
| 423 | |||
| 424 | sub init_main { | ||
| 425 | my($self) = shift; | ||
| 426 | |||
| 427 | $self->SUPER::init_main; | ||
| 428 | |||
| 429 | $self->{DEFINE} ||= ''; | ||
| 430 | if ($self->{DEFINE} ne '') { | ||
| 431 | my(@terms) = split(/\s+/,$self->{DEFINE}); | ||
| 432 | my(@defs,@udefs); | ||
| 433 | foreach my $def (@terms) { | ||
| 434 | next unless $def; | ||
| 435 | my $targ = \@defs; | ||
| 436 | if ($def =~ s/^-([DU])//) { # If it was a Unix-style definition | ||
| 437 | $targ = \@udefs if $1 eq 'U'; | ||
| 438 | $def =~ s/='(.*)'$/=$1/; # then remove shell-protection '' | ||
| 439 | $def =~ s/^'(.*)'$/$1/; # from entire term or argument | ||
| 440 | } | ||
| 441 | if ($def =~ /=/) { | ||
| 442 | $def =~ s/"/""/g; # Protect existing " from DCL | ||
| 443 | $def = qq["$def"]; # and quote to prevent parsing of = | ||
| 444 | } | ||
| 445 | push @$targ, $def; | ||
| 446 | } | ||
| 447 | |||
| 448 | $self->{DEFINE} = ''; | ||
| 449 | if (@defs) { | ||
| 450 | $self->{DEFINE} = '/Define=(' . join(',',@defs) . ')'; | ||
| 451 | } | ||
| 452 | if (@udefs) { | ||
| 453 | $self->{DEFINE} .= '/Undef=(' . join(',',@udefs) . ')'; | ||
| 454 | } | ||
| 455 | } | ||
| 456 | } | ||
| 457 | |||
| 458 | =item init_tools (override) | ||
| 459 | |||
| 460 | Provide VMS-specific forms of various utility commands. | ||
| 461 | |||
| 462 | Sets DEV_NULL to nothing because I don't know how to do it on VMS. | ||
| 463 | |||
| 464 | Changes EQUALIZE_TIMESTAMP to set revision date of target file to | ||
| 465 | one second later than source file, since MMK interprets precisely | ||
| 466 | equal revision dates for a source and target file as a sign that the | ||
| 467 | target needs to be updated. | ||
| 468 | |||
| 469 | =cut | ||
| 470 | |||
| 471 | sub init_tools { | ||
| 472 | my($self) = @_; | ||
| 473 | |||
| 474 | $self->{NOOP} = 'Continue'; | ||
| 475 | $self->{NOECHO} ||= '@ '; | ||
| 476 | |||
| 477 | $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE} || 'Descrip.MMS'; | ||
| 478 | $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE}; | ||
| 479 | $self->{MAKE_APERL_FILE} ||= 'Makeaperl.MMS'; | ||
| 480 | $self->{MAKEFILE_OLD} ||= $self->eliminate_macros('$(FIRST_MAKEFILE)_old'); | ||
| 481 | # | ||
| 482 | # If an extension is not specified, then MMS/MMK assumes an | ||
| 483 | # an extension of .MMS. If there really is no extension, | ||
| 484 | # then a trailing "." needs to be appended to specify a | ||
| 485 | # a null extension. | ||
| 486 | # | ||
| 487 | $self->{MAKEFILE} .= '.' unless $self->{MAKEFILE} =~ m/\./; | ||
| 488 | $self->{FIRST_MAKEFILE} .= '.' unless $self->{FIRST_MAKEFILE} =~ m/\./; | ||
| 489 | $self->{MAKE_APERL_FILE} .= '.' unless $self->{MAKE_APERL_FILE} =~ m/\./; | ||
| 490 | $self->{MAKEFILE_OLD} .= '.' unless $self->{MAKEFILE_OLD} =~ m/\./; | ||
| 491 | |||
| 492 | $self->{MACROSTART} ||= '/Macro=('; | ||
| 493 | $self->{MACROEND} ||= ')'; | ||
| 494 | $self->{USEMAKEFILE} ||= '/Descrip='; | ||
| 495 | |||
| 496 | $self->{EQUALIZE_TIMESTAMP} ||= '$(ABSPERLRUN) -we "open F,qq{>>$ARGV[1]};close F;utime(0,(stat($ARGV[0]))[9]+1,$ARGV[1])"'; | ||
| 497 | |||
| 498 | $self->{MOD_INSTALL} ||= | ||
| 499 | $self->oneliner(<<'CODE', ['-MExtUtils::Install']); | ||
| 500 | install([ from_to => {split('\|', <STDIN>)}, verbose => '$(VERBINST)', uninstall_shadows => '$(UNINST)', dir_mode => '$(PERM_DIR)' ]); | ||
| 501 | CODE | ||
| 502 | |||
| 503 | $self->{UMASK_NULL} = '! '; | ||
| 504 | |||
| 505 | $self->SUPER::init_tools; | ||
| 506 | |||
| 507 | # Use the default shell | ||
| 508 | $self->{SHELL} ||= 'Posix'; | ||
| 509 | |||
| 510 | # Redirection on VMS goes before the command, not after as on Unix. | ||
| 511 | # $(DEV_NULL) is used once and its not worth going nuts over making | ||
| 512 | # it work. However, Unix's DEV_NULL is quite wrong for VMS. | ||
| 513 | $self->{DEV_NULL} = ''; | ||
| 514 | |||
| 515 | return; | ||
| 516 | } | ||
| 517 | |||
| 518 | =item init_platform (override) | ||
| 519 | |||
| 520 | Add PERL_VMS, MM_VMS_REVISION and MM_VMS_VERSION. | ||
| 521 | |||
| 522 | MM_VMS_REVISION is for backwards compatibility before MM_VMS had a | ||
| 523 | $VERSION. | ||
| 524 | |||
| 525 | =cut | ||
| 526 | |||
| 527 | sub init_platform { | ||
| 528 | my($self) = shift; | ||
| 529 | |||
| 530 | $self->{MM_VMS_REVISION} = $Revision; | ||
| 531 | $self->{MM_VMS_VERSION} = $VERSION; | ||
| 532 | $self->{PERL_VMS} = $self->catdir($self->{PERL_SRC}, 'VMS') | ||
| 533 | if $self->{PERL_SRC}; | ||
| 534 | } | ||
| 535 | |||
| 536 | |||
| 537 | =item platform_constants | ||
| 538 | |||
| 539 | =cut | ||
| 540 | |||
| 541 | sub platform_constants { | ||
| 542 | my($self) = shift; | ||
| 543 | my $make_frag = ''; | ||
| 544 | |||
| 545 | foreach my $macro (qw(PERL_VMS MM_VMS_REVISION MM_VMS_VERSION)) | ||
| 546 | { | ||
| 547 | next unless defined $self->{$macro}; | ||
| 548 | $make_frag .= "$macro = $self->{$macro}\n"; | ||
| 549 | } | ||
| 550 | |||
| 551 | return $make_frag; | ||
| 552 | } | ||
| 553 | |||
| 554 | |||
| 555 | =item init_VERSION (override) | ||
| 556 | |||
| 557 | Override the *DEFINE_VERSION macros with VMS semantics. Translate the | ||
| 558 | MAKEMAKER filepath to VMS style. | ||
| 559 | |||
| 560 | =cut | ||
| 561 | |||
| 562 | sub init_VERSION { | ||
| 563 | my $self = shift; | ||
| 564 | |||
| 565 | $self->SUPER::init_VERSION; | ||
| 566 | |||
| 567 | $self->{DEFINE_VERSION} = '"$(VERSION_MACRO)=""$(VERSION)"""'; | ||
| 568 | $self->{XS_DEFINE_VERSION} = '"$(XS_VERSION_MACRO)=""$(XS_VERSION)"""'; | ||
| 569 | $self->{MAKEMAKER} = vmsify($INC{'ExtUtils/MakeMaker.pm'}); | ||
| 570 | } | ||
| 571 | |||
| 572 | |||
| 573 | =item constants (override) | ||
| 574 | |||
| 575 | Fixes up numerous file and directory macros to insure VMS syntax | ||
| 576 | regardless of input syntax. Also makes lists of files | ||
| 577 | comma-separated. | ||
| 578 | |||
| 579 | =cut | ||
| 580 | |||
| 581 | sub constants { | ||
| 582 | my($self) = @_; | ||
| 583 | |||
| 584 | # Be kind about case for pollution | ||
| 585 | for (@ARGV) { $_ = uc($_) if /POLLUTE/i; } | ||
| 586 | |||
| 587 | # Cleanup paths for directories in MMS macros. | ||
| 588 | foreach my $macro ( qw [ | ||
| 589 | INST_BIN INST_SCRIPT INST_LIB INST_ARCHLIB | ||
| 590 | PERL_LIB PERL_ARCHLIB | ||
| 591 | PERL_INC PERL_SRC ], | ||
| 592 | (map { 'INSTALL'.$_ } $self->installvars) | ||
| 593 | ) | ||
| 594 | { | ||
| 595 | next unless defined $self->{$macro}; | ||
| 596 | next if $macro =~ /MAN/ && $self->{$macro} eq 'none'; | ||
| 597 | $self->{$macro} = $self->fixpath($self->{$macro},1); | ||
| 598 | } | ||
| 599 | |||
| 600 | # Cleanup paths for files in MMS macros. | ||
| 601 | foreach my $macro ( qw[LIBPERL_A FIRST_MAKEFILE MAKEFILE_OLD | ||
| 602 | MAKE_APERL_FILE MYEXTLIB] ) | ||
| 603 | { | ||
| 604 | next unless defined $self->{$macro}; | ||
| 605 | $self->{$macro} = $self->fixpath($self->{$macro},0); | ||
| 606 | } | ||
| 607 | |||
| 608 | # Fixup files for MMS macros | ||
| 609 | # XXX is this list complete? | ||
| 610 | for my $macro (qw/ | ||
| 611 | FULLEXT VERSION_FROM | ||
| 612 | / ) { | ||
| 613 | next unless defined $self->{$macro}; | ||
| 614 | $self->{$macro} = $self->fixpath($self->{$macro},0); | ||
| 615 | } | ||
| 616 | |||
| 617 | |||
| 618 | for my $macro (qw/ | ||
| 619 | OBJECT LDFROM | ||
| 620 | / ) { | ||
| 621 | next unless defined $self->{$macro}; | ||
| 622 | |||
| 623 | # Must expand macros before splitting on unescaped whitespace. | ||
| 624 | $self->{$macro} = $self->eliminate_macros($self->{$macro}); | ||
| 625 | if ($self->{$macro} =~ /(?<!\^)\s/) { | ||
| 626 | $self->{$macro} =~ s/(\\)?\n+\s+/ /g; | ||
| 627 | $self->{$macro} = $self->wraplist( | ||
| 628 | map $self->fixpath($_,0), split /,?(?<!\^)\s+/, $self->{$macro} | ||
| 629 | ); | ||
| 630 | } | ||
| 631 | else { | ||
| 632 | $self->{$macro} = $self->fixpath($self->{$macro},0); | ||
| 633 | } | ||
| 634 | } | ||
| 635 | |||
| 636 | for my $macro (qw/ XS MAN1PODS MAN3PODS PM /) { | ||
| 637 | # Where is the space coming from? --jhi | ||
| 638 | next unless $self ne " " && defined $self->{$macro}; | ||
| 639 | my %tmp = (); | ||
| 640 | for my $key (keys %{$self->{$macro}}) { | ||
| 641 | $tmp{$self->fixpath($key,0)} = | ||
| 642 | $self->fixpath($self->{$macro}{$key},0); | ||
| 643 | } | ||
| 644 | $self->{$macro} = \%tmp; | ||
| 645 | } | ||
| 646 | |||
| 647 | for my $macro (qw/ C O_FILES H /) { | ||
| 648 | next unless defined $self->{$macro}; | ||
| 649 | my @tmp = (); | ||
| 650 | for my $val (@{$self->{$macro}}) { | ||
| 651 | push(@tmp,$self->fixpath($val,0)); | ||
| 652 | } | ||
| 653 | $self->{$macro} = \@tmp; | ||
| 654 | } | ||
| 655 | |||
| 656 | # mms/k does not define a $(MAKE) macro. | ||
| 657 | $self->{MAKE} = '$(MMS)$(MMSQUALIFIERS)'; | ||
| 658 | |||
| 659 | return $self->SUPER::constants; | ||
| 660 | } | ||
| 661 | |||
| 662 | |||
| 663 | =item special_targets | ||
| 664 | |||
| 665 | Clear the default .SUFFIXES and put in our own list. | ||
| 666 | |||
| 667 | =cut | ||
| 668 | |||
| 669 | sub special_targets { | ||
| 670 | my $self = shift; | ||
| 671 | |||
| 672 | my $make_frag .= <<'MAKE_FRAG'; | ||
| 673 | .SUFFIXES : | ||
| 674 | .SUFFIXES : $(OBJ_EXT) .c .cpp .cxx .xs | ||
| 675 | |||
| 676 | MAKE_FRAG | ||
| 677 | |||
| 678 | return $make_frag; | ||
| 679 | } | ||
| 680 | |||
| 681 | =item cflags (override) | ||
| 682 | |||
| 683 | Bypass shell script and produce qualifiers for CC directly (but warn | ||
| 684 | user if a shell script for this extension exists). Fold multiple | ||
| 685 | /Defines into one, since some C compilers pay attention to only one | ||
| 686 | instance of this qualifier on the command line. | ||
| 687 | |||
| 688 | =cut | ||
| 689 | |||
| 690 | sub cflags { | ||
| 691 | my($self,$libperl) = @_; | ||
| 692 | my($quals) = $self->{CCFLAGS} || $Config{'ccflags'}; | ||
| 693 | my($definestr,$undefstr,$flagoptstr) = ('','',''); | ||
| 694 | my($incstr) = '/Include=($(PERL_INC)'; | ||
| 695 | my($name,$sys,@m); | ||
| 696 | |||
| 697 | ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; | ||
| 698 | print "Unix shell script ".$Config{"$self->{'BASEEXT'}_cflags"}. | ||
| 699 | " required to modify CC command for $self->{'BASEEXT'}\n" | ||
| 700 | if ($Config{$name}); | ||
| 701 | |||
| 702 | if ($quals =~ / -[DIUOg]/) { | ||
| 703 | while ($quals =~ / -([Og])(\d*)\b/) { | ||
| 704 | my($type,$lvl) = ($1,$2); | ||
| 705 | $quals =~ s/ -$type$lvl\b\s*//; | ||
| 706 | if ($type eq 'g') { $flagoptstr = '/NoOptimize'; } | ||
| 707 | else { $flagoptstr = '/Optimize' . (defined($lvl) ? "=$lvl" : ''); } | ||
| 708 | } | ||
| 709 | while ($quals =~ / -([DIU])(\S+)/) { | ||
| 710 | my($type,$def) = ($1,$2); | ||
| 711 | $quals =~ s/ -$type$def\s*//; | ||
| 712 | $def =~ s/"/""/g; | ||
| 713 | if ($type eq 'D') { $definestr .= qq["$def",]; } | ||
| 714 | elsif ($type eq 'I') { $incstr .= ',' . $self->fixpath($def,1); } | ||
| 715 | else { $undefstr .= qq["$def",]; } | ||
| 716 | } | ||
| 717 | } | ||
| 718 | if (length $quals and $quals !~ m!/!) { | ||
| 719 | warn "MM_VMS: Ignoring unrecognized CCFLAGS elements \"$quals\"\n"; | ||
| 720 | $quals = ''; | ||
| 721 | } | ||
| 722 | $definestr .= q["PERL_POLLUTE",] if $self->{POLLUTE}; | ||
| 723 | if (length $definestr) { chop($definestr); $quals .= "/Define=($definestr)"; } | ||
| 724 | if (length $undefstr) { chop($undefstr); $quals .= "/Undef=($undefstr)"; } | ||
| 725 | # Deal with $self->{DEFINE} here since some C compilers pay attention | ||
| 726 | # to only one /Define clause on command line, so we have to | ||
| 727 | # conflate the ones from $Config{'ccflags'} and $self->{DEFINE} | ||
| 728 | # ($self->{DEFINE} has already been VMSified in constants() above) | ||
| 729 | if ($self->{DEFINE}) { $quals .= $self->{DEFINE}; } | ||
| 730 | for my $type (qw(Def Undef)) { | ||
| 731 | my(@terms); | ||
| 732 | while ($quals =~ m:/${type}i?n?e?=([^/]+):ig) { | ||
| 733 | my $term = $1; | ||
| 734 | $term =~ s:^\((.+)\)$:$1:; | ||
| 735 | push @terms, $term; | ||
| 736 | } | ||
| 737 | if ($type eq 'Def') { | ||
| 738 | push @terms, qw[ $(DEFINE_VERSION) $(XS_DEFINE_VERSION) ]; | ||
| 739 | } | ||
| 740 | if (@terms) { | ||
| 741 | $quals =~ s:/${type}i?n?e?=[^/]+::ig; | ||
| 742 | # PASTHRU_DEFINE will have its own comma | ||
| 743 | $quals .= "/${type}ine=(" . join(',',@terms) . ($type eq 'Def' ? '$(PASTHRU_DEFINE)' : '') . ')'; | ||
| 744 | } | ||
| 745 | } | ||
| 746 | |||
| 747 | $libperl or $libperl = $self->{LIBPERL_A} || "libperl.olb"; | ||
| 748 | |||
| 749 | # Likewise with $self->{INC} and /Include | ||
| 750 | if ($self->{'INC'}) { | ||
| 751 | my(@includes) = split(/\s+/,$self->{INC}); | ||
| 752 | foreach (@includes) { | ||
| 753 | s/^-I//; | ||
| 754 | $incstr .= ','.$self->fixpath($_,1); | ||
| 755 | } | ||
| 756 | } | ||
| 757 | $quals .= "$incstr)"; | ||
| 758 | # $quals =~ s/,,/,/g; $quals =~ s/\(,/(/g; | ||
| 759 | $self->{CCFLAGS} = $quals; | ||
| 760 | |||
| 761 | $self->{PERLTYPE} ||= ''; | ||
| 762 | |||
| 763 | $self->{OPTIMIZE} ||= $flagoptstr || $Config{'optimize'}; | ||
| 764 | if ($self->{OPTIMIZE} !~ m!/!) { | ||
| 765 | if ($self->{OPTIMIZE} =~ m!-g!) { $self->{OPTIMIZE} = '/Debug/NoOptimize' } | ||
| 766 | elsif ($self->{OPTIMIZE} =~ /-O(\d*)/) { | ||
| 767 | $self->{OPTIMIZE} = '/Optimize' . (defined($1) ? "=$1" : ''); | ||
| 768 | } | ||
| 769 | else { | ||
| 770 | warn "MM_VMS: Can't parse OPTIMIZE \"$self->{OPTIMIZE}\"; using default\n" if length $self->{OPTIMIZE}; | ||
| 771 | $self->{OPTIMIZE} = '/Optimize'; | ||
| 772 | } | ||
| 773 | } | ||
| 774 | |||
| 775 | return $self->{CFLAGS} = qq{ | ||
| 776 | CCFLAGS = $self->{CCFLAGS} | ||
| 777 | OPTIMIZE = $self->{OPTIMIZE} | ||
| 778 | PERLTYPE = $self->{PERLTYPE} | ||
| 779 | }; | ||
| 780 | } | ||
| 781 | |||
| 782 | =item const_cccmd (override) | ||
| 783 | |||
| 784 | Adds directives to point C preprocessor to the right place when | ||
| 785 | handling #include E<lt>sys/foo.hE<gt> directives. Also constructs CC | ||
| 786 | command line a bit differently than MM_Unix method. | ||
| 787 | |||
| 788 | =cut | ||
| 789 | |||
| 790 | sub const_cccmd { | ||
| 791 | my($self,$libperl) = @_; | ||
| 792 | my(@m); | ||
| 793 | |||
| 794 | return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; | ||
| 795 | return '' unless $self->needs_linking(); | ||
| 796 | if ($Config{'vms_cc_type'} eq 'gcc') { | ||
| 797 | push @m,' | ||
| 798 | .FIRST | ||
| 799 | ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" Then Define/NoLog SYS GNU_CC_Include:[VMS]'; | ||
| 800 | } | ||
| 801 | elsif ($Config{'vms_cc_type'} eq 'vaxc') { | ||
| 802 | push @m,' | ||
| 803 | .FIRST | ||
| 804 | ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").eqs."" Then Define/NoLog SYS Sys$Library | ||
| 805 | ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("VAXC$Include").nes."" Then Define/NoLog SYS VAXC$Include'; | ||
| 806 | } | ||
| 807 | else { | ||
| 808 | push @m,' | ||
| 809 | .FIRST | ||
| 810 | ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").eqs."" Then Define/NoLog SYS ', | ||
| 811 | ($Config{'archname'} eq 'VMS_AXP' ? 'Sys$Library' : 'DECC$Library_Include'),' | ||
| 812 | ',$self->{NOECHO},'If F$TrnLnm("Sys").eqs."" .and. F$TrnLnm("DECC$System_Include").nes."" Then Define/NoLog SYS DECC$System_Include'; | ||
| 813 | } | ||
| 814 | |||
| 815 | push(@m, "\n\nCCCMD = $Config{'cc'} \$(CCFLAGS)\$(OPTIMIZE)\n"); | ||
| 816 | |||
| 817 | $self->{CONST_CCCMD} = join('',@m); | ||
| 818 | } | ||
| 819 | |||
| 820 | |||
| 821 | =item tools_other (override) | ||
| 822 | |||
| 823 | Throw in some dubious extra macros for Makefile args. | ||
| 824 | |||
| 825 | Also keep around the old $(SAY) macro in case somebody's using it. | ||
| 826 | |||
| 827 | =cut | ||
| 828 | |||
| 829 | sub tools_other { | ||
| 830 | my($self) = @_; | ||
| 831 | |||
| 832 | # XXX Are these necessary? Does anyone override them? They're longer | ||
| 833 | # than just typing the literal string. | ||
| 834 | my $extra_tools = <<'EXTRA_TOOLS'; | ||
| 835 | |||
| 836 | # Just in case anyone is using the old macro. | ||
| 837 | USEMACROS = $(MACROSTART) | ||
| 838 | SAY = $(ECHO) | ||
| 839 | |||
| 840 | EXTRA_TOOLS | ||
| 841 | |||
| 842 | return $self->SUPER::tools_other . $extra_tools; | ||
| 843 | } | ||
| 844 | |||
| 845 | =item init_dist (override) | ||
| 846 | |||
| 847 | VMSish defaults for some values. | ||
| 848 | |||
| 849 | macro description default | ||
| 850 | |||
| 851 | ZIPFLAGS flags to pass to ZIP -Vu | ||
| 852 | |||
| 853 | COMPRESS compression command to gzip | ||
| 854 | use for tarfiles | ||
| 855 | SUFFIX suffix to put on -gz | ||
| 856 | compressed files | ||
| 857 | |||
| 858 | SHAR shar command to use vms_share | ||
| 859 | |||
| 860 | DIST_DEFAULT default target to use to tardist | ||
| 861 | create a distribution | ||
| 862 | |||
| 863 | DISTVNAME Use VERSION_SYM instead of $(DISTNAME)-$(VERSION_SYM) | ||
| 864 | VERSION for the name | ||
| 865 | |||
| 866 | =cut | ||
| 867 | |||
| 868 | sub init_dist { | ||
| 869 | my($self) = @_; | ||
| 870 | $self->{ZIPFLAGS} ||= '-Vu'; | ||
| 871 | $self->{COMPRESS} ||= 'gzip'; | ||
| 872 | $self->{SUFFIX} ||= '-gz'; | ||
| 873 | $self->{SHAR} ||= 'vms_share'; | ||
| 874 | $self->{DIST_DEFAULT} ||= 'zipdist'; | ||
| 875 | |||
| 876 | $self->SUPER::init_dist; | ||
| 877 | |||
| 878 | $self->{DISTVNAME} = "$self->{DISTNAME}-$self->{VERSION_SYM}" | ||
| 879 | unless $self->{ARGS}{DISTVNAME}; | ||
| 880 | |||
| 881 | return; | ||
| 882 | } | ||
| 883 | |||
| 884 | =item c_o (override) | ||
| 885 | |||
| 886 | Use VMS syntax on command line. In particular, $(DEFINE) and | ||
| 887 | $(PERL_INC) have been pulled into $(CCCMD). Also use MM[SK] macros. | ||
| 888 | |||
| 889 | =cut | ||
| 890 | |||
| 891 | sub c_o { | ||
| 892 | my($self) = @_; | ||
| 893 | return '' unless $self->needs_linking(); | ||
| 894 | ' | ||
| 895 | .c$(OBJ_EXT) : | ||
| 896 | $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) | ||
| 897 | |||
| 898 | .cpp$(OBJ_EXT) : | ||
| 899 | $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cpp /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) | ||
| 900 | |||
| 901 | .cxx$(OBJ_EXT) : | ||
| 902 | $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).cxx /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) | ||
| 903 | |||
| 904 | '; | ||
| 905 | } | ||
| 906 | |||
| 907 | =item xs_c (override) | ||
| 908 | |||
| 909 | Use MM[SK] macros. | ||
| 910 | |||
| 911 | =cut | ||
| 912 | |||
| 913 | sub xs_c { | ||
| 914 | my($self) = @_; | ||
| 915 | return '' unless $self->needs_linking(); | ||
| 916 | ' | ||
| 917 | .xs.c : | ||
| 918 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).xsc | ||
| 919 | $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c | ||
| 920 | '; | ||
| 921 | } | ||
| 922 | |||
| 923 | =item xs_o (override) | ||
| 924 | |||
| 925 | Use MM[SK] macros, and VMS command line for C compiler. | ||
| 926 | |||
| 927 | =cut | ||
| 928 | |||
| 929 | sub xs_o { | ||
| 930 | my ($self) = @_; | ||
| 931 | return '' unless $self->needs_linking(); | ||
| 932 | my $frag = ' | ||
| 933 | .xs$(OBJ_EXT) : | ||
| 934 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs >$(MMS$TARGET_NAME).xsc | ||
| 935 | $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c | ||
| 936 | $(CCCMD) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) | ||
| 937 | '; | ||
| 938 | if ($self->{XSMULTI}) { | ||
| 939 | for my $ext ($self->_xs_list_basenames) { | ||
| 940 | my $version = $self->parse_version("$ext.pm"); | ||
| 941 | my $ccflags = $self->{CCFLAGS}; | ||
| 942 | $ccflags =~ s/\$\(DEFINE_VERSION\)/\"VERSION_MACRO=\\"\"$version\\"\"/; | ||
| 943 | $ccflags =~ s/\$\(XS_DEFINE_VERSION\)/\"XS_VERSION_MACRO=\\"\"$version\\"\"/; | ||
| 944 | $self->_xsbuild_replace_macro($ccflags, 'xs', $ext, 'INC'); | ||
| 945 | $self->_xsbuild_replace_macro($ccflags, 'xs', $ext, 'DEFINE'); | ||
| 946 | |||
| 947 | $frag .= _sprintf562 <<'EOF', $ext, $ccflags; | ||
| 948 | |||
| 949 | %1$s$(OBJ_EXT) : %1$s.xs | ||
| 950 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(MMS$TARGET_NAME).xs > $(MMS$TARGET_NAME).xsc | ||
| 951 | $(MV) $(MMS$TARGET_NAME).xsc $(MMS$TARGET_NAME).c | ||
| 952 | $(CC)%2$s$(OPTIMIZE) $(CCCDLFLAGS) $(MMS$TARGET_NAME).c /OBJECT=$(MMS$TARGET_NAME)$(OBJ_EXT) | ||
| 953 | EOF | ||
| 954 | } | ||
| 955 | } | ||
| 956 | $frag; | ||
| 957 | } | ||
| 958 | |||
| 959 | =item _xsbuild_replace_macro (override) | ||
| 960 | |||
| 961 | There is no simple replacement possible since a qualifier and all its | ||
| 962 | subqualifiers must be considered together, so we use our own utility | ||
| 963 | routine for the replacement. | ||
| 964 | |||
| 965 | =cut | ||
| 966 | |||
| 967 | sub _xsbuild_replace_macro { | ||
| 968 | my ($self, undef, $xstype, $ext, $varname) = @_; | ||
| 969 | my $value = $self->_xsbuild_value($xstype, $ext, $varname); | ||
| 970 | return unless defined $value; | ||
| 971 | $_[1] = _vms_replace_qualifier($self, $_[1], $value, $varname); | ||
| 972 | } | ||
| 973 | |||
| 974 | =item _xsbuild_value (override) | ||
| 975 | |||
| 976 | Convert the extension spec to Unix format, as that's what will | ||
| 977 | match what's in the XSBUILD data structure. | ||
| 978 | |||
| 979 | =cut | ||
| 980 | |||
| 981 | sub _xsbuild_value { | ||
| 982 | my ($self, $xstype, $ext, $varname) = @_; | ||
| 983 | $ext = unixify($ext); | ||
| 984 | return $self->SUPER::_xsbuild_value($xstype, $ext, $varname); | ||
| 985 | } | ||
| 986 | |||
| 987 | sub _vms_replace_qualifier { | ||
| 988 | my ($self, $flags, $newflag, $macro) = @_; | ||
| 989 | my $qual_type; | ||
| 990 | my $type_suffix; | ||
| 991 | my $quote_subquals = 0; | ||
| 992 | my @subquals_new = split /\s+/, $newflag; | ||
| 993 | |||
| 994 | if ($macro eq 'DEFINE') { | ||
| 995 | $qual_type = 'Def'; | ||
| 996 | $type_suffix = 'ine'; | ||
| 997 | map { $_ =~ s/^-D// } @subquals_new; | ||
| 998 | $quote_subquals = 1; | ||
| 999 | } | ||
| 1000 | elsif ($macro eq 'INC') { | ||
| 1001 | $qual_type = 'Inc'; | ||
| 1002 | $type_suffix = 'lude'; | ||
| 1003 | map { $_ =~ s/^-I//; $_ = $self->fixpath($_) } @subquals_new; | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | my @subquals = (); | ||
| 1007 | while ($flags =~ m:/${qual_type}\S{0,4}=([^/]+):ig) { | ||
| 1008 | my $term = $1; | ||
| 1009 | $term =~ s/\"//g; | ||
| 1010 | $term =~ s:^\((.+)\)$:$1:; | ||
| 1011 | push @subquals, split /,/, $term; | ||
| 1012 | } | ||
| 1013 | for my $new (@subquals_new) { | ||
| 1014 | my ($sq_new, $sqval_new) = split /=/, $new; | ||
| 1015 | my $replaced_old = 0; | ||
| 1016 | for my $old (@subquals) { | ||
| 1017 | my ($sq, $sqval) = split /=/, $old; | ||
| 1018 | if ($sq_new eq $sq) { | ||
| 1019 | $old = $sq_new; | ||
| 1020 | $old .= '=' . $sqval_new if defined($sqval_new) and length($sqval_new); | ||
| 1021 | $replaced_old = 1; | ||
| 1022 | last; | ||
| 1023 | } | ||
| 1024 | } | ||
| 1025 | push @subquals, $new unless $replaced_old; | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | if (@subquals) { | ||
| 1029 | $flags =~ s:/${qual_type}\S{0,4}=[^/]+::ig; | ||
| 1030 | # add quotes if requested but not for unexpanded macros | ||
| 1031 | map { $_ = qq/"$_"/ if $_ !~ m/^\$\(/ } @subquals if $quote_subquals; | ||
| 1032 | $flags .= "/${qual_type}$type_suffix=(" . join(',',@subquals) . ')'; | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | return $flags; | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | |||
| 1039 | sub xs_dlsyms_ext { | ||
| 1040 | '.opt'; | ||
| 1041 | } | ||
| 1042 | |||
| 1043 | =item dlsyms (override) | ||
| 1044 | |||
| 1045 | Create VMS linker options files specifying universal symbols for this | ||
| 1046 | extension's shareable image(s), and listing other shareable images or | ||
| 1047 | libraries to which it should be linked. | ||
| 1048 | |||
| 1049 | =cut | ||
| 1050 | |||
| 1051 | sub dlsyms { | ||
| 1052 | my ($self, %attribs) = @_; | ||
| 1053 | return '' unless $self->needs_linking; | ||
| 1054 | $self->xs_dlsyms_iterator; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | sub xs_make_dlsyms { | ||
| 1058 | my ($self, $attribs, $target, $dep, $name, $dlbase, $funcs, $funclist, $imports, $vars, $extra) = @_; | ||
| 1059 | my @m; | ||
| 1060 | my $instloc; | ||
| 1061 | if ($self->{XSMULTI}) { | ||
| 1062 | my ($v, $d, $f) = File::Spec->splitpath($target); | ||
| 1063 | my @d = File::Spec->splitdir($d); | ||
| 1064 | shift @d if $d[0] eq 'lib'; | ||
| 1065 | $instloc = $self->catfile('$(INST_ARCHLIB)', 'auto', @d, $f); | ||
| 1066 | push @m,"\ndynamic :: $instloc\n\t\$(NOECHO) \$(NOOP)\n" | ||
| 1067 | unless $self->{SKIPHASH}{'dynamic'}; | ||
| 1068 | push @m,"\nstatic :: $instloc\n\t\$(NOECHO) \$(NOOP)\n" | ||
| 1069 | unless $self->{SKIPHASH}{'static'}; | ||
| 1070 | push @m, "\n", sprintf <<'EOF', $instloc, $target; | ||
| 1071 | %s : %s | ||
| 1072 | $(CP) $(MMS$SOURCE) $(MMS$TARGET) | ||
| 1073 | EOF | ||
| 1074 | } | ||
| 1075 | else { | ||
| 1076 | push @m,"\ndynamic :: \$(INST_ARCHAUTODIR)$self->{BASEEXT}.opt\n\t\$(NOECHO) \$(NOOP)\n" | ||
| 1077 | unless $self->{SKIPHASH}{'dynamic'}; | ||
| 1078 | push @m,"\nstatic :: \$(INST_ARCHAUTODIR)$self->{BASEEXT}.opt\n\t\$(NOECHO) \$(NOOP)\n" | ||
| 1079 | unless $self->{SKIPHASH}{'static'}; | ||
| 1080 | push @m, "\n", sprintf <<'EOF', $target; | ||
| 1081 | $(INST_ARCHAUTODIR)$(BASEEXT).opt : %s | ||
| 1082 | $(CP) $(MMS$SOURCE) $(MMS$TARGET) | ||
| 1083 | EOF | ||
| 1084 | } | ||
| 1085 | push @m, | ||
| 1086 | "\n$target : $dep\n\t", | ||
| 1087 | q!$(PERLRUN) -MExtUtils::Mksymlists -e "Mksymlists('NAME'=>'!, $name, | ||
| 1088 | q!', 'DLBASE' => '!,$dlbase, | ||
| 1089 | q!', 'DL_FUNCS' => !,neatvalue($funcs), | ||
| 1090 | q!, 'FUNCLIST' => !,neatvalue($funclist), | ||
| 1091 | q!, 'IMPORTS' => !,neatvalue($imports), | ||
| 1092 | q!, 'DL_VARS' => !, neatvalue($vars); | ||
| 1093 | push @m, $extra if defined $extra; | ||
| 1094 | push @m, qq!);"\n\t!; | ||
| 1095 | # Can't use dlbase as it's been through mod2fname. | ||
| 1096 | my $olb_base = basename($target, '.opt'); | ||
| 1097 | if ($self->{XSMULTI}) { | ||
| 1098 | # We've been passed everything but the kitchen sink -- and the location of the | ||
| 1099 | # static library we're using to build the dynamic library -- so concoct that | ||
| 1100 | # location from what we do have. | ||
| 1101 | my $olb_dir = $self->catdir(dirname($instloc), $olb_base); | ||
| 1102 | push @m, qq!\$(PERL) -e "print ""${olb_dir}${olb_base}\$(LIB_EXT)/Include=!; | ||
| 1103 | push @m, ($Config{d_vms_case_sensitive_symbols} ? uc($olb_base) : $olb_base); | ||
| 1104 | push @m, '\n' . $olb_dir . $olb_base . '$(LIB_EXT)/Library\n"";" >>$(MMS$TARGET)',"\n"; | ||
| 1105 | } | ||
| 1106 | else { | ||
| 1107 | push @m, qq!\$(PERL) -e "print ""\$(INST_ARCHAUTODIR)${olb_base}\$(LIB_EXT)/Include=!; | ||
| 1108 | if ($self->{OBJECT} =~ /\bBASEEXT\b/ or | ||
| 1109 | $self->{OBJECT} =~ /\b$self->{BASEEXT}\b/i) { | ||
| 1110 | push @m, ($Config{d_vms_case_sensitive_symbols} | ||
| 1111 | ? uc($self->{BASEEXT}) :'$(BASEEXT)'); | ||
| 1112 | } | ||
| 1113 | else { # We don't have a "main" object file, so pull 'em all in | ||
| 1114 | # Upcase module names if linker is being case-sensitive | ||
| 1115 | my($upcase) = $Config{d_vms_case_sensitive_symbols}; | ||
| 1116 | my(@omods) = split ' ', $self->eliminate_macros($self->{OBJECT}); | ||
| 1117 | for (@omods) { | ||
| 1118 | s/\.[^.]*$//; # Trim off file type | ||
| 1119 | s[\$\(\w+_EXT\)][]; # even as a macro | ||
| 1120 | s/.*[:>\/\]]//; # Trim off dir spec | ||
| 1121 | $_ = uc if $upcase; | ||
| 1122 | }; | ||
| 1123 | my(@lines); | ||
| 1124 | my $tmp = shift @omods; | ||
| 1125 | foreach my $elt (@omods) { | ||
| 1126 | $tmp .= ",$elt"; | ||
| 1127 | if (length($tmp) > 80) { push @lines, $tmp; $tmp = ''; } | ||
| 1128 | } | ||
| 1129 | push @lines, $tmp; | ||
| 1130 | push @m, '(', join( qq[, -\\n\\t"";" >>\$(MMS\$TARGET)\n\t\$(PERL) -e "print ""], @lines),')'; | ||
| 1131 | } | ||
| 1132 | push @m, '\n$(INST_ARCHAUTODIR)' . $olb_base . '$(LIB_EXT)/Library\n"";" >>$(MMS$TARGET)',"\n"; | ||
| 1133 | } | ||
| 1134 | if (length $self->{LDLOADLIBS}) { | ||
| 1135 | my($line) = ''; | ||
| 1136 | foreach my $lib (split ' ', $self->{LDLOADLIBS}) { | ||
| 1137 | $lib =~ s%\$%\\\$%g; # Escape '$' in VMS filespecs | ||
| 1138 | if (length($line) + length($lib) > 160) { | ||
| 1139 | push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n"; | ||
| 1140 | $line = $lib . '\n'; | ||
| 1141 | } | ||
| 1142 | else { $line .= $lib . '\n'; } | ||
| 1143 | } | ||
| 1144 | push @m, "\t\$(PERL) -e \"print qq{$line}\" >>\$(MMS\$TARGET)\n" if $line; | ||
| 1145 | } | ||
| 1146 | join '', @m; | ||
| 1147 | } | ||
| 1148 | |||
| 1149 | |||
| 1150 | =item xs_obj_opt | ||
| 1151 | |||
| 1152 | Override to fixup -o flags. | ||
| 1153 | |||
| 1154 | =cut | ||
| 1155 | |||
| 1156 | sub xs_obj_opt { | ||
| 1157 | my ($self, $output_file) = @_; | ||
| 1158 | "/OBJECT=$output_file"; | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | =item dynamic_lib (override) | ||
| 1162 | |||
| 1163 | Use VMS Link command. | ||
| 1164 | |||
| 1165 | =cut | ||
| 1166 | |||
| 1167 | sub xs_dynamic_lib_macros { | ||
| 1168 | my ($self, $attribs) = @_; | ||
| 1169 | my $otherldflags = $attribs->{OTHERLDFLAGS} || ""; | ||
| 1170 | my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; | ||
| 1171 | sprintf <<'EOF', $otherldflags, $inst_dynamic_dep; | ||
| 1172 | # This section creates the dynamically loadable objects from relevant | ||
| 1173 | # objects and possibly $(MYEXTLIB). | ||
| 1174 | OTHERLDFLAGS = %s | ||
| 1175 | INST_DYNAMIC_DEP = %s | ||
| 1176 | EOF | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | sub xs_make_dynamic_lib { | ||
| 1180 | my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_; | ||
| 1181 | my $shr = $Config{'dbgprefix'} . 'PerlShr'; | ||
| 1182 | $exportlist =~ s/.def$/.opt/; # it's a linker options file | ||
| 1183 | # 1 2 3 4 5 | ||
| 1184 | _sprintf562 <<'EOF', $to, $todir, $exportlist, $shr, "$shr Sys\$Share:$shr.$Config{'dlext'}"; | ||
| 1185 | %1$s : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt %2$s$(DFSEP).exists %3$s $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) | ||
| 1186 | If F$TrnLNm("%4$s").eqs."" Then Define/NoLog/User %5$s | ||
| 1187 | Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) %3$s/Option,$(PERL_INC)perlshr_attr.opt/Option | ||
| 1188 | EOF | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | =item xs_make_static_lib (override) | ||
| 1192 | |||
| 1193 | Use VMS commands to manipulate object library. | ||
| 1194 | |||
| 1195 | =cut | ||
| 1196 | |||
| 1197 | sub xs_make_static_lib { | ||
| 1198 | my ($self, $object, $to, $todir) = @_; | ||
| 1199 | |||
| 1200 | my @objects; | ||
| 1201 | if ($self->{XSMULTI}) { | ||
| 1202 | # The extension name should be the main object file name minus file type. | ||
| 1203 | my $lib = $object; | ||
| 1204 | $lib =~ s/\$\(OBJ_EXT\)\z//; | ||
| 1205 | my $override = $self->_xsbuild_value('xs', $lib, 'OBJECT'); | ||
| 1206 | $object = $override if defined $override; | ||
| 1207 | @objects = map { $self->fixpath($_,0) } split /(?<!\^)\s+/, $object; | ||
| 1208 | } | ||
| 1209 | else { | ||
| 1210 | push @objects, $object; | ||
| 1211 | } | ||
| 1212 | |||
| 1213 | my @m; | ||
| 1214 | for my $obj (@objects) { | ||
| 1215 | push(@m, sprintf "\n%s : %s\$(DFSEP).exists", $obj, $todir); | ||
| 1216 | } | ||
| 1217 | push(@m, sprintf "\n\n%s : %s \$(MYEXTLIB)\n", $to, (join ' ', @objects)); | ||
| 1218 | |||
| 1219 | # If this extension has its own library (eg SDBM_File) | ||
| 1220 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. | ||
| 1221 | push(@m, "\t",'$(CP) $(MYEXTLIB) $(MMS$TARGET)',"\n") if $self->{MYEXTLIB}; | ||
| 1222 | |||
| 1223 | push(@m,"\t",'If F$Search("$(MMS$TARGET)").eqs."" Then Library/Object/Create $(MMS$TARGET)',"\n"); | ||
| 1224 | |||
| 1225 | # if there was a library to copy, then we can't use MMS$SOURCE_LIST, | ||
| 1226 | # 'cause it's a library and you can't stick them in other libraries. | ||
| 1227 | # In that case, we use $OBJECT instead and hope for the best | ||
| 1228 | if ($self->{MYEXTLIB}) { | ||
| 1229 | for my $obj (@objects) { | ||
| 1230 | push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) ' . $obj,"\n"); | ||
| 1231 | } | ||
| 1232 | } | ||
| 1233 | else { | ||
| 1234 | push(@m,"\t",'Library/Object/Replace $(MMS$TARGET) $(MMS$SOURCE_LIST)',"\n"); | ||
| 1235 | } | ||
| 1236 | |||
| 1237 | push @m, "\t\$(NOECHO) \$(PERL) -e 1 >\$(INST_ARCHAUTODIR)extralibs.ld\n"; | ||
| 1238 | foreach my $lib (split ' ', $self->{EXTRALIBS}) { | ||
| 1239 | push(@m,"\t",'$(NOECHO) $(PERL) -e "print qq{',$lib,'\n}" >>$(INST_ARCHAUTODIR)extralibs.ld',"\n"); | ||
| 1240 | } | ||
| 1241 | join('',@m); | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | |||
| 1245 | =item extra_clean_files | ||
| 1246 | |||
| 1247 | Clean up some OS specific files. Plus the temp file used to shorten | ||
| 1248 | a lot of commands. And the name mangler database. | ||
| 1249 | |||
| 1250 | =cut | ||
| 1251 | |||
| 1252 | sub extra_clean_files { | ||
| 1253 | return qw( | ||
| 1254 | *.Map *.Dmp *.Lis *.cpp *.$(DLEXT) *.Opt $(BASEEXT).bso | ||
| 1255 | .MM_Tmp cxx_repository | ||
| 1256 | ); | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | |||
| 1260 | =item zipfile_target | ||
| 1261 | |||
| 1262 | =item tarfile_target | ||
| 1263 | |||
| 1264 | =item shdist_target | ||
| 1265 | |||
| 1266 | Syntax for invoking shar, tar and zip differs from that for Unix. | ||
| 1267 | |||
| 1268 | =cut | ||
| 1269 | |||
| 1270 | sub zipfile_target { | ||
| 1271 | my($self) = shift; | ||
| 1272 | |||
| 1273 | return <<'MAKE_FRAG'; | ||
| 1274 | $(DISTVNAME).zip : distdir | ||
| 1275 | $(PREOP) | ||
| 1276 | $(ZIP) "$(ZIPFLAGS)" $(MMS$TARGET) [.$(DISTVNAME)...]*.*; | ||
| 1277 | $(RM_RF) $(DISTVNAME) | ||
| 1278 | $(POSTOP) | ||
| 1279 | MAKE_FRAG | ||
| 1280 | } | ||
| 1281 | |||
| 1282 | sub tarfile_target { | ||
| 1283 | my($self) = shift; | ||
| 1284 | |||
| 1285 | return <<'MAKE_FRAG'; | ||
| 1286 | $(DISTVNAME).tar$(SUFFIX) : distdir | ||
| 1287 | $(PREOP) | ||
| 1288 | $(TO_UNIX) | ||
| 1289 | $(TAR) "$(TARFLAGS)" $(DISTVNAME).tar [.$(DISTVNAME)...] | ||
| 1290 | $(RM_RF) $(DISTVNAME) | ||
| 1291 | $(COMPRESS) $(DISTVNAME).tar | ||
| 1292 | $(POSTOP) | ||
| 1293 | MAKE_FRAG | ||
| 1294 | } | ||
| 1295 | |||
| 1296 | sub shdist_target { | ||
| 1297 | my($self) = shift; | ||
| 1298 | |||
| 1299 | return <<'MAKE_FRAG'; | ||
| 1300 | shdist : distdir | ||
| 1301 | $(PREOP) | ||
| 1302 | $(SHAR) [.$(DISTVNAME)...]*.*; $(DISTVNAME).share | ||
| 1303 | $(RM_RF) $(DISTVNAME) | ||
| 1304 | $(POSTOP) | ||
| 1305 | MAKE_FRAG | ||
| 1306 | } | ||
| 1307 | |||
| 1308 | |||
| 1309 | # --- Test and Installation Sections --- | ||
| 1310 | |||
| 1311 | =item install (override) | ||
| 1312 | |||
| 1313 | Work around DCL's 255 character limit several times,and use | ||
| 1314 | VMS-style command line quoting in a few cases. | ||
| 1315 | |||
| 1316 | =cut | ||
| 1317 | |||
| 1318 | sub install { | ||
| 1319 | my($self, %attribs) = @_; | ||
| 1320 | my(@m); | ||
| 1321 | |||
| 1322 | push @m, q[ | ||
| 1323 | install :: all pure_install doc_install | ||
| 1324 | $(NOECHO) $(NOOP) | ||
| 1325 | |||
| 1326 | install_perl :: all pure_perl_install doc_perl_install | ||
| 1327 | $(NOECHO) $(NOOP) | ||
| 1328 | |||
| 1329 | install_site :: all pure_site_install doc_site_install | ||
| 1330 | $(NOECHO) $(NOOP) | ||
| 1331 | |||
| 1332 | install_vendor :: all pure_vendor_install doc_vendor_install | ||
| 1333 | $(NOECHO) $(NOOP) | ||
| 1334 | |||
| 1335 | pure_install :: pure_$(INSTALLDIRS)_install | ||
| 1336 | $(NOECHO) $(NOOP) | ||
| 1337 | |||
| 1338 | doc_install :: doc_$(INSTALLDIRS)_install | ||
| 1339 | $(NOECHO) $(NOOP) | ||
| 1340 | |||
| 1341 | pure__install : pure_site_install | ||
| 1342 | $(NOECHO) $(ECHO) "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site" | ||
| 1343 | |||
| 1344 | doc__install : doc_site_install | ||
| 1345 | $(NOECHO) $(ECHO) "INSTALLDIRS not defined, defaulting to INSTALLDIRS=site" | ||
| 1346 | |||
| 1347 | # This hack brought to you by DCL's 255-character command line limit | ||
| 1348 | pure_perl_install :: | ||
| 1349 | ]; | ||
| 1350 | push @m, | ||
| 1351 | q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp | ||
| 1352 | $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp | ||
| 1353 | ] unless $self->{NO_PACKLIST}; | ||
| 1354 | |||
| 1355 | push @m, | ||
| 1356 | q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLPRIVLIB)|" >>.MM_tmp | ||
| 1357 | $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLARCHLIB)|" >>.MM_tmp | ||
| 1358 | $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLBIN)|" >>.MM_tmp | ||
| 1359 | $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp | ||
| 1360 | $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) " >>.MM_tmp | ||
| 1361 | $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLMAN3DIR)" >>.MM_tmp | ||
| 1362 | $(NOECHO) $(MOD_INSTALL) <.MM_tmp | ||
| 1363 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1364 | $(NOECHO) $(WARN_IF_OLD_PACKLIST) "].$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[" | ||
| 1365 | |||
| 1366 | # Likewise | ||
| 1367 | pure_site_install :: | ||
| 1368 | ]; | ||
| 1369 | push @m, | ||
| 1370 | q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp | ||
| 1371 | $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp | ||
| 1372 | ] unless $self->{NO_PACKLIST}; | ||
| 1373 | |||
| 1374 | push @m, | ||
| 1375 | q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLSITELIB)|" >>.MM_tmp | ||
| 1376 | $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLSITEARCH)|" >>.MM_tmp | ||
| 1377 | $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLSITEBIN)|" >>.MM_tmp | ||
| 1378 | $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp | ||
| 1379 | $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR)|$(DESTINSTALLSITEMAN1DIR)|" >>.MM_tmp | ||
| 1380 | $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLSITEMAN3DIR)" >>.MM_tmp | ||
| 1381 | $(NOECHO) $(MOD_INSTALL) <.MM_tmp | ||
| 1382 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1383 | $(NOECHO) $(WARN_IF_OLD_PACKLIST) "].$self->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[" | ||
| 1384 | |||
| 1385 | pure_vendor_install :: | ||
| 1386 | ]; | ||
| 1387 | push @m, | ||
| 1388 | q[ $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'read|'.File::Spec->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').'|'" >.MM_tmp | ||
| 1389 | $(NOECHO) $(PERLRUN) "-MFile::Spec" -e "print 'write|'.File::Spec->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').'|'" >>.MM_tmp | ||
| 1390 | ] unless $self->{NO_PACKLIST}; | ||
| 1391 | |||
| 1392 | push @m, | ||
| 1393 | q[ $(NOECHO) $(ECHO_N) "$(INST_LIB)|$(DESTINSTALLVENDORLIB)|" >>.MM_tmp | ||
| 1394 | $(NOECHO) $(ECHO_N) "$(INST_ARCHLIB)|$(DESTINSTALLVENDORARCH)|" >>.MM_tmp | ||
| 1395 | $(NOECHO) $(ECHO_N) "$(INST_BIN)|$(DESTINSTALLVENDORBIN)|" >>.MM_tmp | ||
| 1396 | $(NOECHO) $(ECHO_N) "$(INST_SCRIPT)|$(DESTINSTALLSCRIPT)|" >>.MM_tmp | ||
| 1397 | $(NOECHO) $(ECHO_N) "$(INST_MAN1DIR)|$(DESTINSTALLVENDORMAN1DIR)|" >>.MM_tmp | ||
| 1398 | $(NOECHO) $(ECHO_N) "$(INST_MAN3DIR)|$(DESTINSTALLVENDORMAN3DIR)" >>.MM_tmp | ||
| 1399 | $(NOECHO) $(MOD_INSTALL) <.MM_tmp | ||
| 1400 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1401 | |||
| 1402 | ]; | ||
| 1403 | |||
| 1404 | push @m, q[ | ||
| 1405 | # Ditto | ||
| 1406 | doc_perl_install :: | ||
| 1407 | $(NOECHO) $(NOOP) | ||
| 1408 | |||
| 1409 | # And again | ||
| 1410 | doc_site_install :: | ||
| 1411 | $(NOECHO) $(NOOP) | ||
| 1412 | |||
| 1413 | doc_vendor_install :: | ||
| 1414 | $(NOECHO) $(NOOP) | ||
| 1415 | |||
| 1416 | ] if $self->{NO_PERLLOCAL}; | ||
| 1417 | |||
| 1418 | push @m, q[ | ||
| 1419 | # Ditto | ||
| 1420 | doc_perl_install :: | ||
| 1421 | $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" | ||
| 1422 | $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) | ||
| 1423 | $(NOECHO) $(ECHO_N) "installed into|$(INSTALLPRIVLIB)|" >.MM_tmp | ||
| 1424 | $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp | ||
| 1425 | $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ | ||
| 1426 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1427 | |||
| 1428 | # And again | ||
| 1429 | doc_site_install :: | ||
| 1430 | $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" | ||
| 1431 | $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) | ||
| 1432 | $(NOECHO) $(ECHO_N) "installed into|$(INSTALLSITELIB)|" >.MM_tmp | ||
| 1433 | $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp | ||
| 1434 | $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ | ||
| 1435 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1436 | |||
| 1437 | doc_vendor_install :: | ||
| 1438 | $(NOECHO) $(ECHO) "Appending installation info to ].$self->catfile($self->{DESTINSTALLARCHLIB}, 'perllocal.pod').q[" | ||
| 1439 | $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) | ||
| 1440 | $(NOECHO) $(ECHO_N) "installed into|$(INSTALLVENDORLIB)|" >.MM_tmp | ||
| 1441 | $(NOECHO) $(ECHO_N) "LINKTYPE|$(LINKTYPE)|VERSION|$(VERSION)|EXE_FILES|$(EXE_FILES) " >>.MM_tmp | ||
| 1442 | $(NOECHO) $(DOC_INSTALL) "Module" "$(NAME)" <.MM_tmp >>].$self->catfile($self->{DESTINSTALLARCHLIB},'perllocal.pod').q[ | ||
| 1443 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1444 | |||
| 1445 | ] unless $self->{NO_PERLLOCAL}; | ||
| 1446 | |||
| 1447 | push @m, q[ | ||
| 1448 | uninstall :: uninstall_from_$(INSTALLDIRS)dirs | ||
| 1449 | $(NOECHO) $(NOOP) | ||
| 1450 | |||
| 1451 | uninstall_from_perldirs :: | ||
| 1452 | $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{PERL_ARCHLIB},'auto',$self->{FULLEXT},'.packlist').q[ | ||
| 1453 | |||
| 1454 | uninstall_from_sitedirs :: | ||
| 1455 | $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{SITEARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[ | ||
| 1456 | |||
| 1457 | uninstall_from_vendordirs :: | ||
| 1458 | $(NOECHO) $(UNINSTALL) ].$self->catfile($self->{VENDORARCHEXP},'auto',$self->{FULLEXT},'.packlist').q[ | ||
| 1459 | ]; | ||
| 1460 | |||
| 1461 | join('',@m); | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | =item perldepend (override) | ||
| 1465 | |||
| 1466 | Use VMS-style syntax for files; it's cheaper to just do it directly here | ||
| 1467 | than to have the MM_Unix method call C<catfile> repeatedly. Also, if | ||
| 1468 | we have to rebuild Config.pm, use MM[SK] to do it. | ||
| 1469 | |||
| 1470 | =cut | ||
| 1471 | |||
| 1472 | sub perldepend { | ||
| 1473 | my($self) = @_; | ||
| 1474 | my(@m); | ||
| 1475 | |||
| 1476 | if ($self->{OBJECT}) { | ||
| 1477 | # Need to add an object file dependency on the perl headers. | ||
| 1478 | # this is very important for XS modules in perl.git development. | ||
| 1479 | |||
| 1480 | push @m, $self->_perl_header_files_fragment(""); # empty separator on VMS as its in the $(PERL_INC) | ||
| 1481 | } | ||
| 1482 | |||
| 1483 | if ($self->{PERL_SRC}) { | ||
| 1484 | my(@macros); | ||
| 1485 | my($mmsquals) = '$(USEMAKEFILE)[.vms]$(FIRST_MAKEFILE)'; | ||
| 1486 | push(@macros,'__AXP__=1') if $Config{'archname'} eq 'VMS_AXP'; | ||
| 1487 | push(@macros,'DECC=1') if $Config{'vms_cc_type'} eq 'decc'; | ||
| 1488 | push(@macros,'GNUC=1') if $Config{'vms_cc_type'} eq 'gcc'; | ||
| 1489 | push(@macros,'SOCKET=1') if $Config{'d_has_sockets'}; | ||
| 1490 | push(@macros,qq["CC=$Config{'cc'}"]) if $Config{'cc'} =~ m!/!; | ||
| 1491 | $mmsquals .= '$(USEMACROS)' . join(',',@macros) . '$(MACROEND)' if @macros; | ||
| 1492 | push(@m,q[ | ||
| 1493 | # Check for unpropagated config.sh changes. Should never happen. | ||
| 1494 | # We do NOT just update config.h because that is not sufficient. | ||
| 1495 | # An out of date config.h is not fatal but complains loudly! | ||
| 1496 | $(PERL_INC)config.h : $(PERL_SRC)config.sh | ||
| 1497 | $(NOOP) | ||
| 1498 | |||
| 1499 | $(PERL_ARCHLIB)Config.pm : $(PERL_SRC)config.sh | ||
| 1500 | $(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.h or genconfig.pl" | ||
| 1501 | olddef = F$Environment("Default") | ||
| 1502 | Set Default $(PERL_SRC) | ||
| 1503 | $(MMS)],$mmsquals,); | ||
| 1504 | if ($self->{PERL_ARCHLIB} =~ m|\[-| && $self->{PERL_SRC} =~ m|(\[-+)|) { | ||
| 1505 | my($prefix,$target) = ($1,$self->fixpath('$(PERL_ARCHLIB)Config.pm',0)); | ||
| 1506 | $target =~ s/\Q$prefix/[/; | ||
| 1507 | push(@m," $target"); | ||
| 1508 | } | ||
| 1509 | else { push(@m,' $(MMS$TARGET)'); } | ||
| 1510 | push(@m,q[ | ||
| 1511 | Set Default 'olddef' | ||
| 1512 | ]); | ||
| 1513 | } | ||
| 1514 | |||
| 1515 | push(@m, join(" ", map($self->fixpath($_,0),sort values %{$self->{XS}}))." : \$(XSUBPPDEPS)\n") | ||
| 1516 | if %{$self->{XS}}; | ||
| 1517 | |||
| 1518 | join('',@m); | ||
| 1519 | } | ||
| 1520 | |||
| 1521 | |||
| 1522 | =item makeaperl (override) | ||
| 1523 | |||
| 1524 | Undertake to build a new set of Perl images using VMS commands. Since | ||
| 1525 | VMS does dynamic loading, it's not necessary to statically link each | ||
| 1526 | extension into the Perl image, so this isn't the normal build path. | ||
| 1527 | Consequently, it hasn't really been tested, and may well be incomplete. | ||
| 1528 | |||
| 1529 | =cut | ||
| 1530 | |||
| 1531 | our %olbs; # needs to be localized | ||
| 1532 | |||
| 1533 | sub makeaperl { | ||
| 1534 | my($self, %attribs) = @_; | ||
| 1535 | my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmpdir, $libperl) = | ||
| 1536 | @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; | ||
| 1537 | my(@m); | ||
| 1538 | push @m, " | ||
| 1539 | # --- MakeMaker makeaperl section --- | ||
| 1540 | MAP_TARGET = $target | ||
| 1541 | "; | ||
| 1542 | return join '', @m if $self->{PARENT}; | ||
| 1543 | |||
| 1544 | my($dir) = join ":", @{$self->{DIR}}; | ||
| 1545 | |||
| 1546 | unless ($self->{MAKEAPERL}) { | ||
| 1547 | push @m, q{ | ||
| 1548 | $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) | ||
| 1549 | $(NOECHO) $(ECHO) "Writing ""$(MMS$TARGET)"" for this $(MAP_TARGET)" | ||
| 1550 | $(NOECHO) $(PERLRUNINST) \ | ||
| 1551 | Makefile.PL DIR=}, $dir, q{ \ | ||
| 1552 | FIRST_MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ | ||
| 1553 | MAKEAPERL=1 NORECURS=1 }; | ||
| 1554 | |||
| 1555 | push @m, map(q[ \\\n\t\t"$_"], @ARGV),q{ | ||
| 1556 | |||
| 1557 | $(MAP_TARGET) :: $(MAKE_APERL_FILE) | ||
| 1558 | $(MAKE)$(USEMAKEFILE)$(MAKE_APERL_FILE) static $(MMS$TARGET) | ||
| 1559 | }; | ||
| 1560 | push @m, "\n"; | ||
| 1561 | |||
| 1562 | return join '', @m; | ||
| 1563 | } | ||
| 1564 | |||
| 1565 | |||
| 1566 | my($linkcmd,@optlibs,@staticpkgs,$extralist,$targdir,$libperldir,%libseen); | ||
| 1567 | local($_); | ||
| 1568 | |||
| 1569 | # The front matter of the linkcommand... | ||
| 1570 | $linkcmd = join ' ', $Config{'ld'}, | ||
| 1571 | grep($_, @Config{qw(large split ldflags ccdlflags)}); | ||
| 1572 | $linkcmd =~ s/\s+/ /g; | ||
| 1573 | |||
| 1574 | # Which *.olb files could we make use of... | ||
| 1575 | local(%olbs); # XXX can this be lexical? | ||
| 1576 | $olbs{$self->{INST_ARCHAUTODIR}} = "$self->{BASEEXT}\$(LIB_EXT)"; | ||
| 1577 | require File::Find; | ||
| 1578 | File::Find::find(sub { | ||
| 1579 | return unless m/\Q$self->{LIB_EXT}\E$/; | ||
| 1580 | return if m/^libperl/; | ||
| 1581 | |||
| 1582 | if( exists $self->{INCLUDE_EXT} ){ | ||
| 1583 | my $found = 0; | ||
| 1584 | |||
| 1585 | (my $xx = $File::Find::name) =~ s,.*?/auto/,,; | ||
| 1586 | $xx =~ s,/?$_,,; | ||
| 1587 | $xx =~ s,/,::,g; | ||
| 1588 | |||
| 1589 | # Throw away anything not explicitly marked for inclusion. | ||
| 1590 | # DynaLoader is implied. | ||
| 1591 | foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ | ||
| 1592 | if( $xx eq $incl ){ | ||
| 1593 | $found++; | ||
| 1594 | last; | ||
| 1595 | } | ||
| 1596 | } | ||
| 1597 | return unless $found; | ||
| 1598 | } | ||
| 1599 | elsif( exists $self->{EXCLUDE_EXT} ){ | ||
| 1600 | (my $xx = $File::Find::name) =~ s,.*?/auto/,,; | ||
| 1601 | $xx =~ s,/?$_,,; | ||
| 1602 | $xx =~ s,/,::,g; | ||
| 1603 | |||
| 1604 | # Throw away anything explicitly marked for exclusion | ||
| 1605 | foreach my $excl (@{$self->{EXCLUDE_EXT}}){ | ||
| 1606 | return if( $xx eq $excl ); | ||
| 1607 | } | ||
| 1608 | } | ||
| 1609 | |||
| 1610 | $olbs{$ENV{DEFAULT}} = $_; | ||
| 1611 | }, grep( -d $_, @{$searchdirs || []})); | ||
| 1612 | |||
| 1613 | # We trust that what has been handed in as argument will be buildable | ||
| 1614 | $static = [] unless $static; | ||
| 1615 | @olbs{@{$static}} = (1) x @{$static}; | ||
| 1616 | |||
| 1617 | $extra = [] unless $extra && ref $extra eq 'ARRAY'; | ||
| 1618 | # Sort the object libraries in inverse order of | ||
| 1619 | # filespec length to try to insure that dependent extensions | ||
| 1620 | # will appear before their parents, so the linker will | ||
| 1621 | # search the parent library to resolve references. | ||
| 1622 | # (e.g. Intuit::DWIM will precede Intuit, so unresolved | ||
| 1623 | # references from [.intuit.dwim]dwim.obj can be found | ||
| 1624 | # in [.intuit]intuit.olb). | ||
| 1625 | for (sort { length($a) <=> length($b) || $a cmp $b } keys %olbs) { | ||
| 1626 | next unless $olbs{$_} =~ /\Q$self->{LIB_EXT}\E$/; | ||
| 1627 | my($dir) = $self->fixpath($_,1); | ||
| 1628 | my($extralibs) = $dir . "extralibs.ld"; | ||
| 1629 | my($extopt) = $dir . $olbs{$_}; | ||
| 1630 | $extopt =~ s/$self->{LIB_EXT}$/.opt/; | ||
| 1631 | push @optlibs, "$dir$olbs{$_}"; | ||
| 1632 | # Get external libraries this extension will need | ||
| 1633 | if (-f $extralibs ) { | ||
| 1634 | my %seenthis; | ||
| 1635 | open my $list, "<", $extralibs or warn $!,next; | ||
| 1636 | while (<$list>) { | ||
| 1637 | chomp; | ||
| 1638 | # Include a library in the link only once, unless it's mentioned | ||
| 1639 | # multiple times within a single extension's options file, in which | ||
| 1640 | # case we assume the builder needed to search it again later in the | ||
| 1641 | # link. | ||
| 1642 | my $skip = exists($libseen{$_}) && !exists($seenthis{$_}); | ||
| 1643 | $libseen{$_}++; $seenthis{$_}++; | ||
| 1644 | next if $skip; | ||
| 1645 | push @$extra,$_; | ||
| 1646 | } | ||
| 1647 | } | ||
| 1648 | # Get full name of extension for ExtUtils::Miniperl | ||
| 1649 | if (-f $extopt) { | ||
| 1650 | open my $opt, '<', $extopt or die $!; | ||
| 1651 | while (<$opt>) { | ||
| 1652 | next unless /(?:UNIVERSAL|VECTOR)=boot_([\w_]+)/; | ||
| 1653 | my $pkg = $1; | ||
| 1654 | $pkg =~ s#__*#::#g; | ||
| 1655 | push @staticpkgs,$pkg; | ||
| 1656 | } | ||
| 1657 | } | ||
| 1658 | } | ||
| 1659 | # Place all of the external libraries after all of the Perl extension | ||
| 1660 | # libraries in the final link, in order to maximize the opportunity | ||
| 1661 | # for XS code from multiple extensions to resolve symbols against the | ||
| 1662 | # same external library while only including that library once. | ||
| 1663 | push @optlibs, @$extra; | ||
| 1664 | |||
| 1665 | $target = "Perl$Config{'exe_ext'}" unless $target; | ||
| 1666 | my $shrtarget; | ||
| 1667 | ($shrtarget,$targdir) = fileparse($target); | ||
| 1668 | $shrtarget =~ s/^([^.]*)/$1Shr/; | ||
| 1669 | $shrtarget = $targdir . $shrtarget; | ||
| 1670 | $target = "Perlshr.$Config{'dlext'}" unless $target; | ||
| 1671 | $tmpdir = "[]" unless $tmpdir; | ||
| 1672 | $tmpdir = $self->fixpath($tmpdir,1); | ||
| 1673 | if (@optlibs) { $extralist = join(' ',@optlibs); } | ||
| 1674 | else { $extralist = ''; } | ||
| 1675 | # Let ExtUtils::Liblist find the necessary libs for us (but skip PerlShr) | ||
| 1676 | # that's what we're building here). | ||
| 1677 | push @optlibs, grep { !/PerlShr/i } split ' ', +($self->ext())[2]; | ||
| 1678 | if ($libperl) { | ||
| 1679 | unless (-f $libperl || -f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',$libperl))) { | ||
| 1680 | print "Warning: $libperl not found\n"; | ||
| 1681 | undef $libperl; | ||
| 1682 | } | ||
| 1683 | } | ||
| 1684 | unless ($libperl) { | ||
| 1685 | if (defined $self->{PERL_SRC}) { | ||
| 1686 | $libperl = $self->catfile($self->{PERL_SRC},"libperl$self->{LIB_EXT}"); | ||
| 1687 | } elsif (-f ($libperl = $self->catfile($Config{'installarchlib'},'CORE',"libperl$self->{LIB_EXT}")) ) { | ||
| 1688 | } else { | ||
| 1689 | print "Warning: $libperl not found | ||
| 1690 | If you're going to build a static perl binary, make sure perl is installed | ||
| 1691 | otherwise ignore this warning\n"; | ||
| 1692 | } | ||
| 1693 | } | ||
| 1694 | $libperldir = $self->fixpath((fileparse($libperl))[1],1); | ||
| 1695 | |||
| 1696 | push @m, ' | ||
| 1697 | # Fill in the target you want to produce if it\'s not perl | ||
| 1698 | MAP_TARGET = ',$self->fixpath($target,0),' | ||
| 1699 | MAP_SHRTARGET = ',$self->fixpath($shrtarget,0)," | ||
| 1700 | MAP_LINKCMD = $linkcmd | ||
| 1701 | MAP_PERLINC = ", $perlinc ? map('"$_" ',@{$perlinc}) : ''," | ||
| 1702 | MAP_EXTRA = $extralist | ||
| 1703 | MAP_LIBPERL = ",$self->fixpath($libperl,0),' | ||
| 1704 | '; | ||
| 1705 | |||
| 1706 | |||
| 1707 | push @m,"\n${tmpdir}Makeaperl.Opt : \$(MAP_EXTRA)\n"; | ||
| 1708 | foreach (@optlibs) { | ||
| 1709 | push @m,' $(NOECHO) $(PERL) -e "print q{',$_,'}" >>$(MMS$TARGET)',"\n"; | ||
| 1710 | } | ||
| 1711 | push @m,"\n${tmpdir}PerlShr.Opt :\n\t"; | ||
| 1712 | push @m,'$(NOECHO) $(PERL) -e "print q{$(MAP_SHRTARGET)}" >$(MMS$TARGET)',"\n"; | ||
| 1713 | |||
| 1714 | push @m,' | ||
| 1715 | $(MAP_SHRTARGET) : $(MAP_LIBPERL) Makeaperl.Opt ',"${libperldir}Perlshr_Attr.Opt",' | ||
| 1716 | $(MAP_LINKCMD)/Shareable=$(MMS$TARGET) $(MAP_LIBPERL), Makeaperl.Opt/Option ',"${libperldir}Perlshr_Attr.Opt/Option",' | ||
| 1717 | $(MAP_TARGET) : $(MAP_SHRTARGET) ',"${tmpdir}perlmain\$(OBJ_EXT) ${tmpdir}PerlShr.Opt",' | ||
| 1718 | $(MAP_LINKCMD) ',"${tmpdir}perlmain\$(OBJ_EXT)",', PerlShr.Opt/Option | ||
| 1719 | $(NOECHO) $(ECHO) "To install the new ""$(MAP_TARGET)"" binary, say" | ||
| 1720 | $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) inst_perl $(USEMACROS)MAP_TARGET=$(MAP_TARGET)$(ENDMACRO)" | ||
| 1721 | $(NOECHO) $(ECHO) "To remove the intermediate files, say | ||
| 1722 | $(NOECHO) $(ECHO) " $(MAKE)$(USEMAKEFILE)$(FIRST_MAKEFILE) map_clean" | ||
| 1723 | '; | ||
| 1724 | push @m,"\n${tmpdir}perlmain.c : \$(FIRST_MAKEFILE)\n\t\$(NOECHO) \$(PERL) -e 1 >${tmpdir}Writemain.tmp\n"; | ||
| 1725 | push @m, "# More from the 255-char line length limit\n"; | ||
| 1726 | foreach (@staticpkgs) { | ||
| 1727 | push @m,' $(NOECHO) $(PERL) -e "print q{',$_,qq[}" >>${tmpdir}Writemain.tmp\n]; | ||
| 1728 | } | ||
| 1729 | |||
| 1730 | push @m, sprintf <<'MAKE_FRAG', $tmpdir, $tmpdir; | ||
| 1731 | $(NOECHO) $(PERL) $(MAP_PERLINC) -ane "use ExtUtils::Miniperl; writemain(@F)" %sWritemain.tmp >$(MMS$TARGET) | ||
| 1732 | $(NOECHO) $(RM_F) %sWritemain.tmp | ||
| 1733 | MAKE_FRAG | ||
| 1734 | |||
| 1735 | push @m, q[ | ||
| 1736 | # Still more from the 255-char line length limit | ||
| 1737 | doc_inst_perl : | ||
| 1738 | $(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) | ||
| 1739 | $(NOECHO) $(ECHO) "Perl binary $(MAP_TARGET)|" >.MM_tmp | ||
| 1740 | $(NOECHO) $(ECHO) "MAP_STATIC|$(MAP_STATIC)|" >>.MM_tmp | ||
| 1741 | $(NOECHO) $(PERL) -pl040 -e " " ].$self->catfile('$(INST_ARCHAUTODIR)','extralibs.all'),q[ >>.MM_tmp | ||
| 1742 | $(NOECHO) $(ECHO) -e "MAP_LIBPERL|$(MAP_LIBPERL)|" >>.MM_tmp | ||
| 1743 | $(NOECHO) $(DOC_INSTALL) <.MM_tmp >>].$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q[ | ||
| 1744 | $(NOECHO) $(RM_F) .MM_tmp | ||
| 1745 | ]; | ||
| 1746 | |||
| 1747 | push @m, " | ||
| 1748 | inst_perl : pure_inst_perl doc_inst_perl | ||
| 1749 | \$(NOECHO) \$(NOOP) | ||
| 1750 | |||
| 1751 | pure_inst_perl : \$(MAP_TARGET) | ||
| 1752 | $self->{CP} \$(MAP_SHRTARGET) ",$self->fixpath($Config{'installbin'},1)," | ||
| 1753 | $self->{CP} \$(MAP_TARGET) ",$self->fixpath($Config{'installbin'},1)," | ||
| 1754 | |||
| 1755 | clean :: map_clean | ||
| 1756 | \$(NOECHO) \$(NOOP) | ||
| 1757 | |||
| 1758 | map_clean : | ||
| 1759 | \$(RM_F) ${tmpdir}perlmain\$(OBJ_EXT) ${tmpdir}perlmain.c \$(FIRST_MAKEFILE) | ||
| 1760 | \$(RM_F) ${tmpdir}Makeaperl.Opt ${tmpdir}PerlShr.Opt \$(MAP_TARGET) | ||
| 1761 | "; | ||
| 1762 | |||
| 1763 | join '', @m; | ||
| 1764 | } | ||
| 1765 | |||
| 1766 | |||
| 1767 | # --- Output postprocessing section --- | ||
| 1768 | |||
| 1769 | =item maketext_filter (override) | ||
| 1770 | |||
| 1771 | Ensure that colons marking targets are preceded by space, in order | ||
| 1772 | to distinguish the target delimiter from a colon appearing as | ||
| 1773 | part of a filespec. | ||
| 1774 | |||
| 1775 | =cut | ||
| 1776 | |||
| 1777 | sub maketext_filter { | ||
| 1778 | my($self, $text) = @_; | ||
| 1779 | |||
| 1780 | $text =~ s/^([^\s:=]+)(:+\s)/$1 $2/mg; | ||
| 1781 | return $text; | ||
| 1782 | } | ||
| 1783 | |||
| 1784 | =item prefixify (override) | ||
| 1785 | |||
| 1786 | prefixifying on VMS is simple. Each should simply be: | ||
| 1787 | |||
| 1788 | perl_root:[some.dir] | ||
| 1789 | |||
| 1790 | which can just be converted to: | ||
| 1791 | |||
| 1792 | volume:[your.prefix.some.dir] | ||
| 1793 | |||
| 1794 | otherwise you get the default layout. | ||
| 1795 | |||
| 1796 | In effect, your search prefix is ignored and $Config{vms_prefix} is | ||
| 1797 | used instead. | ||
| 1798 | |||
| 1799 | =cut | ||
| 1800 | |||
| 1801 | sub prefixify { | ||
| 1802 | my($self, $var, $sprefix, $rprefix, $default) = @_; | ||
| 1803 | |||
| 1804 | # Translate $(PERLPREFIX) to a real path. | ||
| 1805 | $rprefix = $self->eliminate_macros($rprefix); | ||
| 1806 | $rprefix = vmspath($rprefix) if $rprefix; | ||
| 1807 | $sprefix = vmspath($sprefix) if $sprefix; | ||
| 1808 | |||
| 1809 | $default = vmsify($default) | ||
| 1810 | unless $default =~ /\[.*\]/; | ||
| 1811 | |||
| 1812 | (my $var_no_install = $var) =~ s/^install//; | ||
| 1813 | my $path = $self->{uc $var} || | ||
| 1814 | $ExtUtils::MM_Unix::Config_Override{lc $var} || | ||
| 1815 | $Config{lc $var} || $Config{lc $var_no_install}; | ||
| 1816 | |||
| 1817 | if( !$path ) { | ||
| 1818 | warn " no Config found for $var.\n" if $Verbose >= 2; | ||
| 1819 | $path = $self->_prefixify_default($rprefix, $default); | ||
| 1820 | } | ||
| 1821 | elsif( !$self->{ARGS}{PREFIX} || !$self->file_name_is_absolute($path) ) { | ||
| 1822 | # do nothing if there's no prefix or if its relative | ||
| 1823 | } | ||
| 1824 | elsif( $sprefix eq $rprefix ) { | ||
| 1825 | warn " no new prefix.\n" if $Verbose >= 2; | ||
| 1826 | } | ||
| 1827 | else { | ||
| 1828 | |||
| 1829 | warn " prefixify $var => $path\n" if $Verbose >= 2; | ||
| 1830 | warn " from $sprefix to $rprefix\n" if $Verbose >= 2; | ||
| 1831 | |||
| 1832 | my($path_vol, $path_dirs) = $self->splitpath( $path ); | ||
| 1833 | if( $path_vol eq $Config{vms_prefix}.':' ) { | ||
| 1834 | warn " $Config{vms_prefix}: seen\n" if $Verbose >= 2; | ||
| 1835 | |||
| 1836 | $path_dirs =~ s{^\[}{\[.} unless $path_dirs =~ m{^\[\.}; | ||
| 1837 | $path = $self->_catprefix($rprefix, $path_dirs); | ||
| 1838 | } | ||
| 1839 | else { | ||
| 1840 | $path = $self->_prefixify_default($rprefix, $default); | ||
| 1841 | } | ||
| 1842 | } | ||
| 1843 | |||
| 1844 | print " now $path\n" if $Verbose >= 2; | ||
| 1845 | return $self->{uc $var} = $path; | ||
| 1846 | } | ||
| 1847 | |||
| 1848 | |||
| 1849 | sub _prefixify_default { | ||
| 1850 | my($self, $rprefix, $default) = @_; | ||
| 1851 | |||
| 1852 | warn " cannot prefix, using default.\n" if $Verbose >= 2; | ||
| 1853 | |||
| 1854 | if( !$default ) { | ||
| 1855 | warn "No default!\n" if $Verbose >= 1; | ||
| 1856 | return; | ||
| 1857 | } | ||
| 1858 | if( !$rprefix ) { | ||
| 1859 | warn "No replacement prefix!\n" if $Verbose >= 1; | ||
| 1860 | return ''; | ||
| 1861 | } | ||
| 1862 | |||
| 1863 | return $self->_catprefix($rprefix, $default); | ||
| 1864 | } | ||
| 1865 | |||
| 1866 | sub _catprefix { | ||
| 1867 | my($self, $rprefix, $default) = @_; | ||
| 1868 | |||
| 1869 | my($rvol, $rdirs) = $self->splitpath($rprefix); | ||
| 1870 | if( $rvol ) { | ||
| 1871 | return $self->catpath($rvol, | ||
| 1872 | $self->catdir($rdirs, $default), | ||
| 1873 | '' | ||
| 1874 | ) | ||
| 1875 | } | ||
| 1876 | else { | ||
| 1877 | return $self->catdir($rdirs, $default); | ||
| 1878 | } | ||
| 1879 | } | ||
| 1880 | |||
| 1881 | |||
| 1882 | =item cd | ||
| 1883 | |||
| 1884 | =cut | ||
| 1885 | |||
| 1886 | sub cd { | ||
| 1887 | my($self, $dir, @cmds) = @_; | ||
| 1888 | |||
| 1889 | $dir = vmspath($dir); | ||
| 1890 | |||
| 1891 | my $cmd = join "\n\t", map "$_", @cmds; | ||
| 1892 | |||
| 1893 | # No leading tab makes it look right when embedded | ||
| 1894 | my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd; | ||
| 1895 | startdir = F$Environment("Default") | ||
| 1896 | Set Default %s | ||
| 1897 | %s | ||
| 1898 | Set Default 'startdir' | ||
| 1899 | MAKE_FRAG | ||
| 1900 | |||
| 1901 | # No trailing newline makes this easier to embed | ||
| 1902 | chomp $make_frag; | ||
| 1903 | |||
| 1904 | return $make_frag; | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | |||
| 1908 | =item oneliner | ||
| 1909 | |||
| 1910 | =cut | ||
| 1911 | |||
| 1912 | sub oneliner { | ||
| 1913 | my($self, $cmd, $switches) = @_; | ||
| 1914 | $switches = [] unless defined $switches; | ||
| 1915 | |||
| 1916 | # Strip leading and trailing newlines | ||
| 1917 | $cmd =~ s{^\n+}{}; | ||
| 1918 | $cmd =~ s{\n+$}{}; | ||
| 1919 | |||
| 1920 | my @cmds = split /\n/, $cmd; | ||
| 1921 | $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds; | ||
| 1922 | $cmd = $self->escape_newlines($cmd); | ||
| 1923 | |||
| 1924 | # Switches must be quoted else they will be lowercased. | ||
| 1925 | $switches = join ' ', map { qq{"$_"} } @$switches; | ||
| 1926 | |||
| 1927 | return qq{\$(ABSPERLRUN) $switches -e $cmd "--"}; | ||
| 1928 | } | ||
| 1929 | |||
| 1930 | |||
| 1931 | =item B<echo> | ||
| 1932 | |||
| 1933 | perl trips up on "<foo>" thinking it's an input redirect. So we use the | ||
| 1934 | native Write command instead. Besides, it's faster. | ||
| 1935 | |||
| 1936 | =cut | ||
| 1937 | |||
| 1938 | sub echo { | ||
| 1939 | my($self, $text, $file, $opts) = @_; | ||
| 1940 | |||
| 1941 | # Compatibility with old options | ||
| 1942 | if( !ref $opts ) { | ||
| 1943 | my $append = $opts; | ||
| 1944 | $opts = { append => $append || 0 }; | ||
| 1945 | } | ||
| 1946 | my $opencmd = $opts->{append} ? 'Open/Append' : 'Open/Write'; | ||
| 1947 | |||
| 1948 | $opts->{allow_variables} = 0 unless defined $opts->{allow_variables}; | ||
| 1949 | |||
| 1950 | my $ql_opts = { allow_variables => $opts->{allow_variables} }; | ||
| 1951 | |||
| 1952 | my @cmds = ("\$(NOECHO) $opencmd MMECHOFILE $file "); | ||
| 1953 | push @cmds, map { '$(NOECHO) Write MMECHOFILE '.$self->quote_literal($_, $ql_opts) } | ||
| 1954 | split /\n/, $text; | ||
| 1955 | push @cmds, '$(NOECHO) Close MMECHOFILE'; | ||
| 1956 | return @cmds; | ||
| 1957 | } | ||
| 1958 | |||
| 1959 | |||
| 1960 | =item quote_literal | ||
| 1961 | |||
| 1962 | =cut | ||
| 1963 | |||
| 1964 | sub quote_literal { | ||
| 1965 | my($self, $text, $opts) = @_; | ||
| 1966 | $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; | ||
| 1967 | |||
| 1968 | # I believe this is all we should need. | ||
| 1969 | $text =~ s{"}{""}g; | ||
| 1970 | |||
| 1971 | $text = $opts->{allow_variables} | ||
| 1972 | ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); | ||
| 1973 | |||
| 1974 | return qq{"$text"}; | ||
| 1975 | } | ||
| 1976 | |||
| 1977 | =item escape_dollarsigns | ||
| 1978 | |||
| 1979 | Quote, don't escape. | ||
| 1980 | |||
| 1981 | =cut | ||
| 1982 | |||
| 1983 | sub escape_dollarsigns { | ||
| 1984 | my($self, $text) = @_; | ||
| 1985 | |||
| 1986 | # Quote dollar signs which are not starting a variable | ||
| 1987 | $text =~ s{\$ (?!\() }{"\$"}gx; | ||
| 1988 | |||
| 1989 | return $text; | ||
| 1990 | } | ||
| 1991 | |||
| 1992 | |||
| 1993 | =item escape_all_dollarsigns | ||
| 1994 | |||
| 1995 | Quote, don't escape. | ||
| 1996 | |||
| 1997 | =cut | ||
| 1998 | |||
| 1999 | sub escape_all_dollarsigns { | ||
| 2000 | my($self, $text) = @_; | ||
| 2001 | |||
| 2002 | # Quote dollar signs | ||
| 2003 | $text =~ s{\$}{"\$\"}gx; | ||
| 2004 | |||
| 2005 | return $text; | ||
| 2006 | } | ||
| 2007 | |||
| 2008 | =item escape_newlines | ||
| 2009 | |||
| 2010 | =cut | ||
| 2011 | |||
| 2012 | sub escape_newlines { | ||
| 2013 | my($self, $text) = @_; | ||
| 2014 | |||
| 2015 | $text =~ s{\n}{-\n}g; | ||
| 2016 | |||
| 2017 | return $text; | ||
| 2018 | } | ||
| 2019 | |||
| 2020 | =item max_exec_len | ||
| 2021 | |||
| 2022 | 256 characters. | ||
| 2023 | |||
| 2024 | =cut | ||
| 2025 | |||
| 2026 | sub max_exec_len { | ||
| 2027 | my $self = shift; | ||
| 2028 | |||
| 2029 | return $self->{_MAX_EXEC_LEN} ||= 256; | ||
| 2030 | } | ||
| 2031 | |||
| 2032 | =item init_linker | ||
| 2033 | |||
| 2034 | =cut | ||
| 2035 | |||
| 2036 | sub init_linker { | ||
| 2037 | my $self = shift; | ||
| 2038 | $self->{EXPORT_LIST} ||= '$(BASEEXT).opt'; | ||
| 2039 | |||
| 2040 | my $shr = $Config{dbgprefix} . 'PERLSHR'; | ||
| 2041 | if ($self->{PERL_SRC}) { | ||
| 2042 | $self->{PERL_ARCHIVE} ||= | ||
| 2043 | $self->catfile($self->{PERL_SRC}, "$shr.$Config{'dlext'}"); | ||
| 2044 | } | ||
| 2045 | else { | ||
| 2046 | $self->{PERL_ARCHIVE} ||= | ||
| 2047 | $ENV{$shr} ? $ENV{$shr} : "Sys\$Share:$shr.$Config{'dlext'}"; | ||
| 2048 | } | ||
| 2049 | |||
| 2050 | $self->{PERL_ARCHIVEDEP} ||= ''; | ||
| 2051 | $self->{PERL_ARCHIVE_AFTER} ||= ''; | ||
| 2052 | } | ||
| 2053 | |||
| 2054 | |||
| 2055 | =item catdir (override) | ||
| 2056 | |||
| 2057 | =item catfile (override) | ||
| 2058 | |||
| 2059 | Eliminate the macros in the output to the MMS/MMK file. | ||
| 2060 | |||
| 2061 | (File::Spec::VMS used to do this for us, but it's being removed) | ||
| 2062 | |||
| 2063 | =cut | ||
| 2064 | |||
| 2065 | sub catdir { | ||
| 2066 | my $self = shift; | ||
| 2067 | |||
| 2068 | # Process the macros on VMS MMS/MMK | ||
| 2069 | my @args = map { m{\$\(} ? $self->eliminate_macros($_) : $_ } @_; | ||
| 2070 | |||
| 2071 | my $dir = $self->SUPER::catdir(@args); | ||
| 2072 | |||
| 2073 | # Fix up the directory and force it to VMS format. | ||
| 2074 | $dir = $self->fixpath($dir, 1); | ||
| 2075 | |||
| 2076 | return $dir; | ||
| 2077 | } | ||
| 2078 | |||
| 2079 | sub catfile { | ||
| 2080 | my $self = shift; | ||
| 2081 | |||
| 2082 | # Process the macros on VMS MMS/MMK | ||
| 2083 | my @args = map { m{\$\(} ? $self->eliminate_macros($_) : $_ } @_; | ||
| 2084 | |||
| 2085 | my $file = $self->SUPER::catfile(@args); | ||
| 2086 | |||
| 2087 | $file = vmsify($file); | ||
| 2088 | |||
| 2089 | return $file | ||
| 2090 | } | ||
| 2091 | |||
| 2092 | |||
| 2093 | =item eliminate_macros | ||
| 2094 | |||
| 2095 | Expands MM[KS]/Make macros in a text string, using the contents of | ||
| 2096 | identically named elements of C<%$self>, and returns the result | ||
| 2097 | as a file specification in Unix syntax. | ||
| 2098 | |||
| 2099 | NOTE: This is the canonical version of the method. The version in | ||
| 2100 | File::Spec::VMS is deprecated. | ||
| 2101 | |||
| 2102 | =cut | ||
| 2103 | |||
| 2104 | sub eliminate_macros { | ||
| 2105 | my($self,$path) = @_; | ||
| 2106 | return '' unless $path; | ||
| 2107 | $self = {} unless ref $self; | ||
| 2108 | |||
| 2109 | my($npath) = unixify($path); | ||
| 2110 | # sometimes unixify will return a string with an off-by-one trailing null | ||
| 2111 | $npath =~ s{\0$}{}; | ||
| 2112 | |||
| 2113 | my($complex) = 0; | ||
| 2114 | my($head,$macro,$tail); | ||
| 2115 | |||
| 2116 | # perform m##g in scalar context so it acts as an iterator | ||
| 2117 | while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#gs) { | ||
| 2118 | if (defined $self->{$2}) { | ||
| 2119 | ($head,$macro,$tail) = ($1,$2,$3); | ||
| 2120 | if (ref $self->{$macro}) { | ||
| 2121 | if (ref $self->{$macro} eq 'ARRAY') { | ||
| 2122 | $macro = join ' ', @{$self->{$macro}}; | ||
| 2123 | } | ||
| 2124 | else { | ||
| 2125 | print "Note: can't expand macro \$($macro) containing ",ref($self->{$macro}), | ||
| 2126 | "\n\t(using MMK-specific deferred substitutuon; MMS will break)\n"; | ||
| 2127 | $macro = "\cB$macro\cB"; | ||
| 2128 | $complex = 1; | ||
| 2129 | } | ||
| 2130 | } | ||
| 2131 | else { | ||
| 2132 | $macro = $self->{$macro}; | ||
| 2133 | # Don't unixify if there is unescaped whitespace | ||
| 2134 | $macro = unixify($macro) unless ($macro =~ /(?<!\^)\s/); | ||
| 2135 | $macro =~ s#/\Z(?!\n)##; | ||
| 2136 | } | ||
| 2137 | $npath = "$head$macro$tail"; | ||
| 2138 | } | ||
| 2139 | } | ||
| 2140 | if ($complex) { $npath =~ s#\cB(.*?)\cB#\${$1}#gs; } | ||
| 2141 | $npath; | ||
| 2142 | } | ||
| 2143 | |||
| 2144 | =item fixpath | ||
| 2145 | |||
| 2146 | my $path = $mm->fixpath($path); | ||
| 2147 | my $path = $mm->fixpath($path, $is_dir); | ||
| 2148 | |||
| 2149 | Catchall routine to clean up problem MM[SK]/Make macros. Expands macros | ||
| 2150 | in any directory specification, in order to avoid juxtaposing two | ||
| 2151 | VMS-syntax directories when MM[SK] is run. Also expands expressions which | ||
| 2152 | are all macro, so that we can tell how long the expansion is, and avoid | ||
| 2153 | overrunning DCL's command buffer when MM[KS] is running. | ||
| 2154 | |||
| 2155 | fixpath() checks to see whether the result matches the name of a | ||
| 2156 | directory in the current default directory and returns a directory or | ||
| 2157 | file specification accordingly. C<$is_dir> can be set to true to | ||
| 2158 | force fixpath() to consider the path to be a directory or false to force | ||
| 2159 | it to be a file. | ||
| 2160 | |||
| 2161 | NOTE: This is the canonical version of the method. The version in | ||
| 2162 | File::Spec::VMS is deprecated. | ||
| 2163 | |||
| 2164 | =cut | ||
| 2165 | |||
| 2166 | sub fixpath { | ||
| 2167 | my($self,$path,$force_path) = @_; | ||
| 2168 | return '' unless $path; | ||
| 2169 | $self = bless {}, $self unless ref $self; | ||
| 2170 | my($fixedpath,$prefix,$name); | ||
| 2171 | |||
| 2172 | if ($path =~ m#^\$\([^\)]+\)\Z(?!\n)#s || $path =~ m#[/:>\]]#) { | ||
| 2173 | if ($force_path or $path =~ /(?:DIR\)|\])\Z(?!\n)/) { | ||
| 2174 | $fixedpath = vmspath($self->eliminate_macros($path)); | ||
| 2175 | } | ||
| 2176 | else { | ||
| 2177 | $fixedpath = vmsify($self->eliminate_macros($path)); | ||
| 2178 | } | ||
| 2179 | } | ||
| 2180 | elsif ((($prefix,$name) = ($path =~ m#^\$\(([^\)]+)\)(.+)#s)) && $self->{$prefix}) { | ||
| 2181 | my($vmspre) = $self->eliminate_macros("\$($prefix)"); | ||
| 2182 | # is it a dir or just a name? | ||
| 2183 | $vmspre = ($vmspre =~ m|/| or $prefix =~ /DIR\Z(?!\n)/) ? vmspath($vmspre) : ''; | ||
| 2184 | $fixedpath = ($vmspre ? $vmspre : $self->{$prefix}) . $name; | ||
| 2185 | $fixedpath = vmspath($fixedpath) if $force_path; | ||
| 2186 | } | ||
| 2187 | else { | ||
| 2188 | $fixedpath = $path; | ||
| 2189 | $fixedpath = vmspath($fixedpath) if $force_path; | ||
| 2190 | } | ||
| 2191 | # No hints, so we try to guess | ||
| 2192 | if (!defined($force_path) and $fixedpath !~ /[:>(.\]]/) { | ||
| 2193 | $fixedpath = vmspath($fixedpath) if -d $fixedpath; | ||
| 2194 | } | ||
| 2195 | |||
| 2196 | # Trim off root dirname if it's had other dirs inserted in front of it. | ||
| 2197 | $fixedpath =~ s/\.000000([\]>])/$1/; | ||
| 2198 | # Special case for VMS absolute directory specs: these will have had device | ||
| 2199 | # prepended during trip through Unix syntax in eliminate_macros(), since | ||
| 2200 | # Unix syntax has no way to express "absolute from the top of this device's | ||
| 2201 | # directory tree". | ||
| 2202 | if ($path =~ /^[\[>][^.\-]/) { $fixedpath =~ s/^[^\[<]+//; } | ||
| 2203 | |||
| 2204 | return $fixedpath; | ||
| 2205 | } | ||
| 2206 | |||
| 2207 | |||
| 2208 | =item os_flavor | ||
| 2209 | |||
| 2210 | VMS is VMS. | ||
| 2211 | |||
| 2212 | =cut | ||
| 2213 | |||
| 2214 | sub os_flavor { | ||
| 2215 | return('VMS'); | ||
| 2216 | } | ||
| 2217 | |||
| 2218 | |||
| 2219 | =item is_make_type (override) | ||
| 2220 | |||
| 2221 | None of the make types being checked for is viable on VMS, | ||
| 2222 | plus our $self->{MAKE} is an unexpanded (and unexpandable) | ||
| 2223 | macro whose value is known only to the make utility itself. | ||
| 2224 | |||
| 2225 | =cut | ||
| 2226 | |||
| 2227 | sub is_make_type { | ||
| 2228 | my($self, $type) = @_; | ||
| 2229 | return 0; | ||
| 2230 | } | ||
| 2231 | |||
| 2232 | |||
| 2233 | =item make_type (override) | ||
| 2234 | |||
| 2235 | Returns a suitable string describing the type of makefile being written. | ||
| 2236 | |||
| 2237 | =cut | ||
| 2238 | |||
| 2239 | sub make_type { "$Config{make}-style"; } | ||
| 2240 | |||
| 2241 | |||
| 2242 | =back | ||
| 2243 | |||
| 2244 | |||
| 2245 | =head1 AUTHOR | ||
| 2246 | |||
| 2247 | Original author Charles Bailey F<bailey@newman.upenn.edu> | ||
| 2248 | |||
| 2249 | Maintained by Michael G Schwern F<schwern@pobox.com> | ||
| 2250 | |||
| 2251 | See L<ExtUtils::MakeMaker> for patching and contact information. | ||
| 2252 | |||
| 2253 | |||
| 2254 | =cut | ||
| 2255 | |||
| 2256 | 1; | ||
| 2257 |