| 1 | package ExtUtils::MM_Win32; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | See ExtUtils::MM_Unix for a documentation of the methods provided | ||||||||||||||||||||||||||||
| 17 | there. This package overrides the implementation of these methods, not | ||||||||||||||||||||||||||||
| 18 | the semantics. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use ExtUtils::MakeMaker::Config; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use ExtUtils::MakeMaker qw(neatvalue _sprintf562); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 2 | require ExtUtils::MM_Any; | |||||||||||||||||||||||||||
| 28 | 2 | require ExtUtils::MM_Unix; | |||||||||||||||||||||||||||
| 29 | 2 | our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); | |||||||||||||||||||||||||||
| 30 | 2 | our $VERSION = '7.13_01'; | |||||||||||||||||||||||||||
| 31 | 2 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | $ENV{EMXSHELL} = 'sh'; # to run `commands` | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 2 | my ( $BORLAND, $GCC, $MSVC, $DLLTOOL ) = _identify_compiler_environment( \%Config ); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub _identify_compiler_environment { | ||||||||||||||||||||||||||||
| 38 | 2 | ▶ | my ( $config ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_identify_compiler_environment: called CC=5 SCAR=17.2
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | my $BORLAND = $config->{cc} =~ /\bbcc/i ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 2 | ▶ | my $GCC = $config->{cc} =~ /\bgcc\b/i ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 2 | ▶ | my $MSVC = $config->{cc} =~ /\b(?:cl|icl)/i ? 1 : 0; # MSVC can come as clarm.exe, icl=Intel C | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 2 | ▶ | my $DLLTOOL = $config->{dlltool} || 'dlltool'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$config->{'dlltool'} || 'dlltool'
MC/DC0%0/1
$config->{'dlltool'} || 'dlltool'
$config->{'dlltool'}
Truth table50%1/2
A
A= $config->{'dlltool'}
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | return ( $BORLAND, $GCC, $MSVC, $DLLTOOL ); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =head2 Overridden methods | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =over 4 | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =item B<dlsyms> | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =cut | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | sub dlsyms { | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my($self,%attribs) = @_; | ||||||||||||||||||||||||||
|
Subroutine
dlsyms: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | return '' if $self->{SKIPHASH}{'dynamic'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | $self->xs_dlsyms_iterator(\%attribs); | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =item xs_dlsyms_ext | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | On Win32, is C<.def>. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub xs_dlsyms_ext { | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | '.def'; | ||||||||||||||||||||||||||
|
Subroutine
xs_dlsyms_ext: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =item replace_manpage_separator | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Changes the path separator with . | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =cut | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | sub replace_manpage_separator { | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my($self,$man) = @_; | ||||||||||||||||||||||||||
|
Subroutine
replace_manpage_separator: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 81 | 0 | $man =~ s,/+,.,g; | |||||||||||||||||||||||||||
| 82 | 0 | $man; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =item B<maybe_command> | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | Since Windows has nothing as simple as an executable bit, we check the | ||||||||||||||||||||||||||||
| 89 | file extension. | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | The PATHEXT env variable will be used to get a list of extensions that | ||||||||||||||||||||||||||||
| 92 | might indicate a command, otherwise .com, .exe, .bat and .cmd will be | ||||||||||||||||||||||||||||
| 93 | used by default. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | sub maybe_command { | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my($self,$file) = @_; | ||||||||||||||||||||||||||
|
Subroutine
maybe_command: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 99 | my @e = exists($ENV{'PATHEXT'}) | ||||||||||||||||||||||||||||
| 100 | ? split(/;/, $ENV{PATHEXT}) | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | : qw(.com .exe .bat .cmd); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | my $e = ''; | |||||||||||||||||||||||||||
| 103 | 0 | for (@e) { $e .= "\Q$_\E|" } | |||||||||||||||||||||||||||
| 104 | 0 | chop $e; | |||||||||||||||||||||||||||
| 105 | # see if file ends in one of the known extensions | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | if ($file =~ /($e)$/i) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | return $file if -e $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | else { | ||||||||||||||||||||||||||||
| 110 | 0 | for (@e) { | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | return "$file$_" if -e "$file$_"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 0 | return; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =item B<init_DIRFILESEP> | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | Using \ for Windows, except for "gmake" where it is /. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | sub init_DIRFILESEP { | ||||||||||||||||||||||||||||
| 125 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_DIRFILESEP: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # The ^ makes sure its not interpreted as an escape in nmake | ||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $self->{DIRFILESEP} = $self->is_make_type('nmake') ? '^\\' : | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 129 | $self->is_make_type('dmake') ? '\\\\' : | ||||||||||||||||||||||||||||
| 130 | $self->is_make_type('gmake') ? '/' | ||||||||||||||||||||||||||||
| 131 | : '\\'; | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =item init_tools | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | Override some of the slower, portable commands with Windows specific ones. | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | =cut | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | sub init_tools { | ||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init_tools: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $self->{NOOP} ||= 'rem'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"NOOP"} ||= "rem"
MC/DC0%0/1
$self->{"NOOP"} ||= "rem"
$self->{"NOOP"}
Truth table0%0/2
A
A= $self->{"NOOP"}
| |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $self->{DEV_NULL} ||= '> NUL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"DEV_NULL"} ||= "> NUL"
MC/DC0%0/1
$self->{"DEV_NULL"} ||= "> NUL"
$self->{"DEV_NULL"}
Truth table0%0/2
A
A= $self->{"DEV_NULL"}
| |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | $self->{FIXIN} ||= $self->{PERL_CORE} ? | ||||||||||||||||||||||||||||
| 147 | 0 | ▶ | "\$(PERLRUN) $self->{PERL_SRC}\\win32\\bin\\pl2bat.pl" : | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"FIXIN"} ||= $self->{"PERL_CORE"} ? qq[\$(PERLRUN) $self->{"PERL_SRC"}\\win32\\bin\\pl2bat.pl] : "pl2bat.bat"
MC/DC0%0/2
$self->{"FIXIN"} ||= $self->{"PERL_CORE"} ? qq[\$(PERLRUN) $self->{"PERL_SRC"}\\win32\\bin\\pl2bat.pl] : "pl2bat.bat"
$self->{"FIXIN"}
$self->{"PERL_CORE"} ? qq[\$(PERLRUN) $self->{"PERL_SRC"}\\win32\\bin\\pl2bat.pl] : "pl2bat.bat"
Truth table0%0/3
A ||= B
A= $self->{"FIXIN"}B= $self->{"PERL_CORE"} ? qq[\$(PERLRUN) $self->{"PERL_SRC"}\\win32\\bin\\pl2bat.pl] : "pl2bat.bat"
| |||||||||||||||||||||||||||||
| 148 | 'pl2bat.bat'; | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | $self->SUPER::init_tools; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | # Setting SHELL from $Config{sh} can break dmake. Its ok without it. | ||||||||||||||||||||||||||||
| 153 | 0 | delete $self->{SHELL}; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | return; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =item init_others | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | Override the default link and compile tools. | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | LDLOADLIBS's default is changed to $Config{libs}. | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | Adjustments are made for Borland's quirks needing -L to come first. | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =cut | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | sub init_others { | ||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_others: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $self->{LD} ||= 'link'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"LD"} ||= "link"
MC/DC0%0/1
$self->{"LD"} ||= "link"
$self->{"LD"}
Truth table0%0/2
A
A= $self->{"LD"}
| |||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $self->{AR} ||= 'lib'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"AR"} ||= "lib"
MC/DC0%0/1
$self->{"AR"} ||= "lib"
$self->{"AR"}
Truth table0%0/2
A
A= $self->{"AR"}
| |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | $self->SUPER::init_others; | |||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $self->{LDLOADLIBS} ||= $Config{libs}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"LDLOADLIBS"} ||= $ExtUtils::MM_Win32::Config{"libs"}
MC/DC0%0/2
$self->{"LDLOADLIBS"} ||= $ExtUtils::MM_Win32::Config{"libs"}
$self->{"LDLOADLIBS"}
$ExtUtils::MM_Win32::Config{"libs"}
Truth table0%0/3
A ||= B
A= $self->{"LDLOADLIBS"}B= $ExtUtils::MM_Win32::Config{"libs"}
| |||||||||||||||||||||||||||||
| 178 | # -Lfoo must come first for Borland, so we put it in LDDLFLAGS | ||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($BORLAND) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 0 | my $libs = $self->{LDLOADLIBS}; | |||||||||||||||||||||||||||
| 181 | 0 | my $libpath = ''; | |||||||||||||||||||||||||||
| 182 | 0 | ▶ | while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $libpath .= ' ' if length $libpath; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | $libpath .= $1; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | $self->{LDLOADLIBS} = $libs; | |||||||||||||||||||||||||||
| 187 | 0 | ▶ | $self->{LDDLFLAGS} ||= $Config{lddlflags}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"LDDLFLAGS"} ||= $ExtUtils::MM_Win32::Config{"lddlflags"}
MC/DC0%0/2
$self->{"LDDLFLAGS"} ||= $ExtUtils::MM_Win32::Config{"lddlflags"}
$self->{"LDDLFLAGS"}
$ExtUtils::MM_Win32::Config{"lddlflags"}
Truth table0%0/3
A ||= B
A= $self->{"LDDLFLAGS"}B= $ExtUtils::MM_Win32::Config{"lddlflags"}
| |||||||||||||||||||||||||||||
| 188 | 0 | $self->{LDDLFLAGS} .= " $libpath"; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | return; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | =item init_platform | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | Add MM_Win32_VERSION. | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | =item platform_constants | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | sub init_platform { | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_platform: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | $self->{MM_Win32_VERSION} = $VERSION; | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | return; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | sub platform_constants { | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
platform_constants: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 213 | 0 | my $make_frag = ''; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | foreach my $macro (qw(MM_Win32_VERSION)) | |||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||
| 217 | 0 | ▶ | next unless defined $self->{$macro}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | $make_frag .= "$macro = $self->{$macro}\n"; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | return $make_frag; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =item specify_shell | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Set SHELL to $ENV{COMSPEC} only if make is type 'gmake'. | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | =cut | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | sub specify_shell { | ||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
specify_shell: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | return '' unless $self->is_make_type('gmake'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 0 | "\nSHELL = $ENV{COMSPEC}\n"; | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | =item constants | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | Add MAXLINELENGTH for dmake before all the constants are output. | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =cut | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | sub constants { | ||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
constants: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | my $make_text = $self->SUPER::constants; | |||||||||||||||||||||||||||
| 246 | 0 | ▶ | return $make_text unless $self->is_make_type('dmake'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | # dmake won't read any single "line" (even those with escaped newlines) | ||||||||||||||||||||||||||||
| 249 | # larger than a certain size which can be as small as 8k. PM_TO_BLIB | ||||||||||||||||||||||||||||
| 250 | # on large modules like DateTime::TimeZone can create lines over 32k. | ||||||||||||||||||||||||||||
| 251 | # So we'll crank it up to a <ironic>WHOPPING</ironic> 64k. | ||||||||||||||||||||||||||||
| 252 | # | ||||||||||||||||||||||||||||
| 253 | # This has to come here before all the constants and not in | ||||||||||||||||||||||||||||
| 254 | # platform_constants which is after constants. | ||||||||||||||||||||||||||||
| 255 | 0 | ▶ | my $size = $self->{MAXLINELENGTH} || 800000; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'MAXLINELENGTH'} || 800000
MC/DC0%0/1
$self->{'MAXLINELENGTH'} || 800000
$self->{'MAXLINELENGTH'}
Truth table0%0/2
A
A= $self->{'MAXLINELENGTH'}
| |||||||||||||||||||||||||||||
| 256 | 0 | my $prefix = qq{ | |||||||||||||||||||||||||||
| 257 | # Get dmake to read long commands like PM_TO_BLIB | ||||||||||||||||||||||||||||
| 258 | MAXLINELENGTH = $size | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | }; | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | return $prefix . $make_text; | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =item special_targets | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | Add .USESHELL target for dmake. | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =cut | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | sub special_targets { | ||||||||||||||||||||||||||||
| 273 | 0 | ▶ | my($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
special_targets: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 0 | my $make_frag = $self->SUPER::special_targets; | |||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $make_frag .= <<'MAKE_FRAG' if $self->is_make_type('dmake'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | .USESHELL : | ||||||||||||||||||||||||||||
| 279 | MAKE_FRAG | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 0 | return $make_frag; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =item static_lib_pure_cmd | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | Defines how to run the archive utility | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | sub static_lib_pure_cmd { | ||||||||||||||||||||||||||||
| 291 | 0 | ▶ | my ($self, $from) = @_; | ||||||||||||||||||||||||||
|
Subroutine
static_lib_pure_cmd: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 292 | 0 | ▶ | $from =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $from | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 294 | : ($GCC ? '-ru $@ ' . $from | ||||||||||||||||||||||||||||
| 295 | : '-out:$@ ' . $from)); | ||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =item dynamic_lib | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | Methods are overridden here: not dynamic_lib itself, but the utility | ||||||||||||||||||||||||||||
| 301 | ones that do the OS-specific work. | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | =cut | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | sub xs_make_dynamic_lib { | ||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_; | ||||||||||||||||||||||||||
|
Subroutine
xs_make_dynamic_lib: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 307 | 0 | my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(INST_DYNAMIC_DEP)'."\n", $to, $from, $todir, $exportlist; | |||||||||||||||||||||||||||
| 308 | 0 | ▶ | if ($GCC) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 309 | # per https://rt.cpan.org/Ticket/Display.html?id=78395 no longer | ||||||||||||||||||||||||||||
| 310 | # uses dlltool - relies on post 2002 MinGW | ||||||||||||||||||||||||||||
| 311 | # 1 2 | ||||||||||||||||||||||||||||
| 312 | 0 | push @m, _sprintf562 <<'EOF', $exportlist, $ldfrom; | |||||||||||||||||||||||||||
| 313 | $(LD) %1$s -o $@ $(LDDLFLAGS) %2$s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -Wl,--enable-auto-image-base | ||||||||||||||||||||||||||||
| 314 | EOF | ||||||||||||||||||||||||||||
| 315 | } elsif ($BORLAND) { | ||||||||||||||||||||||||||||
| 316 | 0 | ▶ | my $ldargs = $self->is_make_type('dmake') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | ? q{"$(PERL_ARCHIVE:s,/,\,)" $(LDLOADLIBS:s,/,\,) $(MYEXTLIB:s,/,\,),} | ||||||||||||||||||||||||||||
| 318 | : q{"$(subst /,\,$(PERL_ARCHIVE))" $(subst /,\,$(LDLOADLIBS)) $(subst /,\,$(MYEXTLIB)),}; | ||||||||||||||||||||||||||||
| 319 | 0 | my $subbed; | |||||||||||||||||||||||||||
| 320 | 0 | ▶ | if ($exportlist eq '$(EXPORT_LIST)') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | 0 | ▶ | $subbed = $self->is_make_type('dmake') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 322 | ? q{$(EXPORT_LIST:s,/,\,)} | ||||||||||||||||||||||||||||
| 323 | : q{$(subst /,\,$(EXPORT_LIST))}; | ||||||||||||||||||||||||||||
| 324 | } else { | ||||||||||||||||||||||||||||
| 325 | # in XSMULTI, exportlist is per-XS, so have to sub in perl not make | ||||||||||||||||||||||||||||
| 326 | 0 | ($subbed = $exportlist) =~ s#/#\\#g; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | 0 | push @m, sprintf <<'EOF', $ldfrom, $ldargs . $subbed; | |||||||||||||||||||||||||||
| 329 | $(LD) $(LDDLFLAGS) $(OTHERLDFLAGS) %s,$@,,%s,$(RESFILES) | ||||||||||||||||||||||||||||
| 330 | EOF | ||||||||||||||||||||||||||||
| 331 | } else { # VC | ||||||||||||||||||||||||||||
| 332 | 0 | push @m, sprintf <<'EOF', $ldfrom, $exportlist; | |||||||||||||||||||||||||||
| 333 | $(LD) -out:$@ $(LDDLFLAGS) %s $(OTHERLDFLAGS) $(MYEXTLIB) "$(PERL_ARCHIVE)" $(LDLOADLIBS) -def:%s | ||||||||||||||||||||||||||||
| 334 | EOF | ||||||||||||||||||||||||||||
| 335 | # Embed the manifest file if it exists | ||||||||||||||||||||||||||||
| 336 | 0 | push(@m, q{ if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 | |||||||||||||||||||||||||||
| 337 | if exist $@.manifest del $@.manifest}); | ||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | 0 | push @m, "\n\t\$(CHMOD) \$(PERM_RWX) \$\@\n"; | |||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 0 | join '', @m; | |||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | sub xs_dynamic_lib_macros { | ||||||||||||||||||||||||||||
| 345 | 0 | ▶ | my ($self, $attribs) = @_; | ||||||||||||||||||||||||||
|
Subroutine
xs_dynamic_lib_macros: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 346 | 0 | ▶ | my $otherldflags = $attribs->{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$attribs->{'OTHERLDFLAGS'} || ($BORLAND ? 'c0d32.obj' : '')
MC/DC0%0/2
$attribs->{'OTHERLDFLAGS'} || ($BORLAND ? 'c0d32.obj' : '')
$attribs->{'OTHERLDFLAGS'}
($BORLAND ? 'c0d32.obj' : '')
Truth table0%0/3
A || B
A= $attribs->{'OTHERLDFLAGS'}B= ($BORLAND ? 'c0d32.obj' : '')
| |||||||||||||||||||||||||||||
| 347 | 0 | ▶ | my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
$attribs->{'INST_DYNAMIC_DEP'} || ''
MC/DC0%0/1
$attribs->{'INST_DYNAMIC_DEP'} || ''
$attribs->{'INST_DYNAMIC_DEP'}
Truth table0%0/2
A
A= $attribs->{'INST_DYNAMIC_DEP'}
| |||||||||||||||||||||||||||||
| 348 | 0 | sprintf <<'EOF', $otherldflags, $inst_dynamic_dep; | |||||||||||||||||||||||||||
| 349 | # This section creates the dynamically loadable objects from relevant | ||||||||||||||||||||||||||||
| 350 | # objects and possibly $(MYEXTLIB). | ||||||||||||||||||||||||||||
| 351 | OTHERLDFLAGS = %s | ||||||||||||||||||||||||||||
| 352 | INST_DYNAMIC_DEP = %s | ||||||||||||||||||||||||||||
| 353 | EOF | ||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =item extra_clean_files | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | Clean out some extra dll.{base,exp} files which might be generated by | ||||||||||||||||||||||||||||
| 359 | gcc. Otherwise, take out all *.pdb files. | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | =cut | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | sub extra_clean_files { | ||||||||||||||||||||||||||||
| 364 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
extra_clean_files: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 0 | ▶ | return $GCC ? (qw(dll.base dll.exp)) : ('*.pdb'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | =item init_linker | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | sub init_linker { | ||||||||||||||||||||||||||||
| 374 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
init_linker: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 0 | $self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}"; | |||||||||||||||||||||||||||
| 377 | 0 | $self->{PERL_ARCHIVEDEP} = "\$(PERL_INCDEP)\\$Config{libperl}"; | |||||||||||||||||||||||||||
| 378 | 0 | $self->{PERL_ARCHIVE_AFTER} = ''; | |||||||||||||||||||||||||||
| 379 | 0 | $self->{EXPORT_LIST} = '$(BASEEXT).def'; | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | =item perl_script | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | Checks for the perl program under several common perl extensions. | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | =cut | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | sub perl_script { | ||||||||||||||||||||||||||||
| 390 | 0 | ▶ | my($self,$file) = @_; | ||||||||||||||||||||||||||
|
Subroutine
perl_script: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 391 | 0 | ▶ | return $file if -r $file && -f _; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-r $file and -f _
MC/DC0%0/2
-r $file and -f _
-r $file
-f _
Truth table0%0/3
A and B
A= -r $fileB= -f _
| |||||||||||||||||||||||||||||
| 392 | 0 | ▶ | return "$file.pl" if -r "$file.pl" && -f _; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-r "$file.pl" and -f _
MC/DC0%0/2
-r "$file.pl" and -f _
-r "$file.pl"
-f _
Truth table0%0/3
A and B
A= -r "$file.pl"B= -f _
| |||||||||||||||||||||||||||||
| 393 | 0 | ▶ | return "$file.plx" if -r "$file.plx" && -f _; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-r "$file.plx" and -f _
MC/DC0%0/2
-r "$file.plx" and -f _
-r "$file.plx"
-f _
Truth table0%0/3
A and B
A= -r "$file.plx"B= -f _
| |||||||||||||||||||||||||||||
| 394 | 0 | ▶ | return "$file.bat" if -r "$file.bat" && -f _; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-r "$file.bat" and -f _
MC/DC0%0/2
-r "$file.bat" and -f _
-r "$file.bat"
-f _
Truth table0%0/3
A and B
A= -r "$file.bat"B= -f _
| |||||||||||||||||||||||||||||
| 395 | 0 | return; | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | sub can_dep_space { | ||||||||||||||||||||||||||||
| 399 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
can_dep_space: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 400 | 0 | 1; # with Win32::GetShortPathName | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | =item quote_dep | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | =cut | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | sub quote_dep { | ||||||||||||||||||||||||||||
| 408 | 0 | ▶ | my ($self, $arg) = @_; | ||||||||||||||||||||||||||
|
Subroutine
quote_dep: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if ($arg =~ / / and not $self->is_make_type('gmake')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg =~ / / and not $self->is_make_type("gmake")
MC/DC0%0/2
$arg =~ / / and not $self->is_make_type("gmake")
$arg =~ / /
not $self->is_make_type("gmake")
Truth table0%0/3
A and not(B)
A= $arg =~ / /B= not $self->is_make_type("gmake")
| |||||||||||||||||||||||||||||
| 410 | 0 | require Win32; | |||||||||||||||||||||||||||
| 411 | 0 | $arg = Win32::GetShortPathName($arg); | |||||||||||||||||||||||||||
| 412 | 0 | ▶ | die <<EOF if not defined $arg or $arg =~ / /; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $arg or $arg =~ / /
MC/DC0%0/2
not defined $arg or $arg =~ / /
not defined $arg
$arg =~ / /
Truth table0%0/3
not(A) or B
A= not defined $argB= $arg =~ / /
| |||||||||||||||||||||||||||||
| 413 | Tried to use make dependency with space for non-GNU make: | ||||||||||||||||||||||||||||
| 414 | '$arg' | ||||||||||||||||||||||||||||
| 415 | Fallback to short pathname failed. | ||||||||||||||||||||||||||||
| 416 | EOF | ||||||||||||||||||||||||||||
| 417 | 0 | return $arg; | |||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | 0 | return $self->SUPER::quote_dep($arg); | |||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | =item xs_obj_opt | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | Override to fixup -o flags for MSVC. | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | =cut | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | sub xs_obj_opt { | ||||||||||||||||||||||||||||
| 430 | 0 | ▶ | my ($self, $output_file) = @_; | ||||||||||||||||||||||||||
|
Subroutine
xs_obj_opt: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 431 | 0 | ▶ | ($MSVC ? "/Fo" : "-o ") . $output_file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | =item pasthru | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | All we send is -nologo to nmake to prevent it from printing its damned | ||||||||||||||||||||||||||||
| 438 | banner. | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =cut | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | sub pasthru { | ||||||||||||||||||||||||||||
| 443 | 0 | ▶ | my($self) = shift; | ||||||||||||||||||||||||||
|
Subroutine
pasthru: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 444 | 0 | my $old = $self->SUPER::pasthru; | |||||||||||||||||||||||||||
| 445 | 0 | ▶ | return $old unless $self->is_make_type('nmake'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 446 | 0 | $old =~ s/(PASTHRU\s*=\s*)/$1 -nologo /; | |||||||||||||||||||||||||||
| 447 | 0 | $old; | |||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | =item arch_check (override) | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | Normalize all arguments for consistency of comparison. | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | =cut | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | sub arch_check { | ||||||||||||||||||||||||||||
| 458 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
arch_check: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | # Win32 is an XS module, minperl won't have it. | ||||||||||||||||||||||||||||
| 461 | # arch_check() is not critical, so just fake it. | ||||||||||||||||||||||||||||
| 462 | 0 | ▶ | return 1 unless $self->can_load_xs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 463 | 0 | return $self->SUPER::arch_check( map { $self->_normalize_path_name($_) } @_); | |||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | sub _normalize_path_name { | ||||||||||||||||||||||||||||
| 467 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_normalize_path_name: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 468 | 0 | my $file = shift; | |||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | 0 | require Win32; | |||||||||||||||||||||||||||
| 471 | 0 | my $short = Win32::GetShortPathName($file); | |||||||||||||||||||||||||||
| 472 | 0 | ▶ | return defined $short ? lc $short : lc $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | =item oneliner | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | These are based on what command.com does on Win98. They may be wrong | ||||||||||||||||||||||||||||
| 479 | for other Windows shells, I don't know. | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | =cut | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | sub oneliner { | ||||||||||||||||||||||||||||
| 484 | 0 | ▶ | my($self, $cmd, $switches) = @_; | ||||||||||||||||||||||||||
|
Subroutine
oneliner: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 485 | 0 | ▶ | $switches = [] unless defined $switches; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | # Strip leading and trailing newlines | ||||||||||||||||||||||||||||
| 488 | 0 | $cmd =~ s{^\n+}{}; | |||||||||||||||||||||||||||
| 489 | 0 | $cmd =~ s{\n+$}{}; | |||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | 0 | $cmd = $self->quote_literal($cmd); | |||||||||||||||||||||||||||
| 492 | 0 | $cmd = $self->escape_newlines($cmd); | |||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | 0 | $switches = join ' ', @$switches; | |||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | 0 | return qq{\$(ABSPERLRUN) $switches -e $cmd --}; | |||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | sub quote_literal { | ||||||||||||||||||||||||||||
| 501 | 0 | ▶ | my($self, $text, $opts) = @_; | ||||||||||||||||||||||||||
|
Subroutine
quote_literal: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 502 | 0 | ▶ | $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | # See: http://www.autohotkey.net/~deleyd/parameters/parameters.htm#CPP | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | # Apply the Microsoft C/C++ parsing rules | ||||||||||||||||||||||||||||
| 507 | 0 | $text =~ s{\\\\"}{\\\\\\\\\\"}g; # \\" -> \\\\\" | |||||||||||||||||||||||||||
| 508 | 0 | $text =~ s{(?<!\\)\\"}{\\\\\\"}g; # \" -> \\\" | |||||||||||||||||||||||||||
| 509 | 0 | $text =~ s{(?<!\\)"}{\\"}g; # " -> \" | |||||||||||||||||||||||||||
| 510 | 0 | ▶ | $text = qq{"$text"} if $text =~ /[ \t]/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | # Apply the Command Prompt parsing rules (cmd.exe) | ||||||||||||||||||||||||||||
| 513 | 0 | my @text = split /("[^"]*")/, $text; | |||||||||||||||||||||||||||
| 514 | # We should also escape parentheses, but it breaks one-liners containing | ||||||||||||||||||||||||||||
| 515 | # $(MACRO)s in makefiles. | ||||||||||||||||||||||||||||
| 516 | 0 | s{([<>|&^@!])}{^$1}g foreach grep { !/^"[^"]*"$/ } @text; | |||||||||||||||||||||||||||
| 517 | 0 | $text = join('', @text); | |||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | # dmake expands {{ to { and }} to }. | ||||||||||||||||||||||||||||
| 520 | 0 | ▶ | if( $self->is_make_type('dmake') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 521 | 0 | $text =~ s/{/{{/g; | |||||||||||||||||||||||||||
| 522 | 0 | $text =~ s/}/}}/g; | |||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | $text = $opts->{allow_variables} | ||||||||||||||||||||||||||||
| 526 | 0 | ▶ | ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | 0 | return $text; | |||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | sub escape_newlines { | ||||||||||||||||||||||||||||
| 533 | 0 | ▶ | my($self, $text) = @_; | ||||||||||||||||||||||||||
|
Subroutine
escape_newlines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | # Escape newlines | ||||||||||||||||||||||||||||
| 536 | 0 | $text =~ s{\n}{\\\n}g; | |||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||
| 538 | 0 | return $text; | |||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | =item cd | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | dmake can handle Unix style cd'ing but nmake (at least 1.5) cannot. It | ||||||||||||||||||||||||||||
| 545 | wants: | ||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||
| 547 | cd dir1\dir2 | ||||||||||||||||||||||||||||
| 548 | command | ||||||||||||||||||||||||||||
| 549 | another_command | ||||||||||||||||||||||||||||
| 550 | cd ..\.. | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | =cut | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | sub cd { | ||||||||||||||||||||||||||||
| 555 | 2 | ▶ | my($self, $dir, @cmds) = @_; | ||||||||||||||||||||||||||
|
Subroutine
cd: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | 2 | ▶ | return $self->SUPER::cd($dir, @cmds) unless $self->is_make_type('nmake'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||
| 559 | 1 | my $cmd = join "\n\t", map "$_", @cmds; | |||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||
| 561 | 1 | my $updirs = $self->catdir(map { $self->updir } $self->splitdir($dir)); | |||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | # No leading tab and no trailing newline makes for easier embedding. | ||||||||||||||||||||||||||||
| 564 | 1 | my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd, $updirs; | |||||||||||||||||||||||||||
| 565 | cd %s | ||||||||||||||||||||||||||||
| 566 | %s | ||||||||||||||||||||||||||||
| 567 | cd %s | ||||||||||||||||||||||||||||
| 568 | MAKE_FRAG | ||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | 1 | chomp $make_frag; | |||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | 1 | return $make_frag; | |||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||
| 576 | =item max_exec_len | ||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||
| 578 | nmake 1.50 limits command length to 2048 characters. | ||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | =cut | ||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | sub max_exec_len { | ||||||||||||||||||||||||||||
| 583 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
max_exec_len: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | 0 | ▶ | return $self->{_MAX_EXEC_LEN} ||= 2 * 1024; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"_MAX_EXEC_LEN"} ||= 2048
MC/DC0%0/1
$self->{"_MAX_EXEC_LEN"} ||= 2048
$self->{"_MAX_EXEC_LEN"}
Truth table0%0/2
A
A= $self->{"_MAX_EXEC_LEN"}
| |||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | =item os_flavor | ||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | Windows is Win32. | ||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | =cut | ||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||
| 595 | sub os_flavor { | ||||||||||||||||||||||||||||
| 596 | 0 | ▶ | return('Win32'); | ||||||||||||||||||||||||||
|
Subroutine
os_flavor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | =item cflags | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | Defines the PERLDLL symbol if we are configured for static building since all | ||||||||||||||||||||||||||||
| 603 | code destined for the perl5xx.dll must be compiled with the PERLDLL symbol | ||||||||||||||||||||||||||||
| 604 | defined. | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | =cut | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | sub cflags { | ||||||||||||||||||||||||||||
| 609 | 0 | ▶ | my($self,$libperl)=@_; | ||||||||||||||||||||||||||
|
Subroutine
cflags: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 610 | 0 | ▶ | return $self->{CFLAGS} if $self->{CFLAGS}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 611 | 0 | ▶ | return '' unless $self->needs_linking(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | 0 | my $base = $self->SUPER::cflags($libperl); | |||||||||||||||||||||||||||
| 614 | 0 | foreach (split /\n/, $base) { | |||||||||||||||||||||||||||
| 615 | 0 | ▶ | /^(\S*)\s*=\s*(\S*)$/ and $self->{$1} = $2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 616 | }; | ||||||||||||||||||||||||||||
| 617 | 0 | ▶ | $self->{CCFLAGS} .= " -DPERLDLL" if ($self->{LINKTYPE} eq 'static'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | 0 | return $self->{CFLAGS} = qq{ | |||||||||||||||||||||||||||
| 620 | CCFLAGS = $self->{CCFLAGS} | ||||||||||||||||||||||||||||
| 621 | OPTIMIZE = $self->{OPTIMIZE} | ||||||||||||||||||||||||||||
| 622 | PERLTYPE = $self->{PERLTYPE} | ||||||||||||||||||||||||||||
| 623 | }; | ||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | =item make_type | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | Returns a suitable string describing the type of makefile being written. | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | =cut | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | sub make_type { | ||||||||||||||||||||||||||||
| 634 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_type: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 635 | 0 | my $make = $self->make; | |||||||||||||||||||||||||||
| 636 | 0 | $make = +( File::Spec->splitpath( $make ) )[-1]; | |||||||||||||||||||||||||||
| 637 | 0 | $make =~ s!\.exe$!!i; | |||||||||||||||||||||||||||
| 638 | 0 | ▶ | if ( $make =~ m![^A-Z0-9]!i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 639 | 0 | ($make) = grep { m!make!i } split m![^A-Z0-9]!i, $make; | |||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||
| 641 | 0 | return "$make-style"; | |||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||
| 644 | 2 | 1; | |||||||||||||||||||||||||||
| 645 | __END__ | ||||||||||||||||||||||||||||