lib/ExtUtils/MM_Unix.pm

filter: Statementstmt 82.6% 1212 / 1467 Branchbran 60.0% 460 / 766 Conditioncond 46.9% 229 / 488 MC/DCmcdc 25.6% 66 / 257 Subroutinesub 93.6% 118 / 126 Podpod 96.9% 96 / 99 totaltotal 68.0% 2181 / 3203 CC 625 SCAR 43.5
CC
625
Cov
70%
makeaperl
759.8
__ANON__
264.8
init_main
172.2
CRAP 77.1
« lib/ExtUtils/MM_OS2.pm ↑ Summary lib/ExtUtils/MakeMaker.pm »
1 package ExtUtils::MM_Unix;
2  
3 96 require 5.006;
4  
5 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 96 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 96 ▶use ExtUtils::MakeMaker::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 96 ▶use File::Basename qw(basename dirname);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 96 our %Config_Override;
13  
14 96 ▶use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # If $VERSION is in scope, parse_version() breaks
17 {
18 96 our $VERSION = '7.78';
19 96 $VERSION =~ tr/_//d;
20 }
21  
22 96 require ExtUtils::MM_Any;
23 96 our @ISA = qw(ExtUtils::MM_Any);
24  
25 96 my %Is;
26 96 ▶BEGIN {
Subroutine BEGIN: called CC=6 SCAR=21.6
27 96 $Is{OS2} = $^O eq 'os2';
28 96 ▶ $Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
Condition33%1/3
$^O eq 'MSWin32' || $ExtUtils::MM_Unix::Config{'osname'} eq 'NetWare'
l!l&&r!l&&!r
0096
MC/DC0%0/2
$^O eq 'MSWin32' || $ExtUtils::MM_Unix::Config{'osname'} eq 'NetWare'
$^O eq 'MSWin32' $ExtUtils::MM_Unix::Config{'osname'} eq 'NetWare'
Truth table33%1/3
A || B
A= $^O eq 'MSWin32'B= $ExtUtils::MM_Unix::Config{'osname'} eq 'NetWare'
ABresult
1X1
011
000
29 96 $Is{Dos} = $^O eq 'dos';
30 96 $Is{VMS} = $^O eq 'VMS';
31 96 $Is{OSF} = $^O eq 'dec_osf';
32 96 $Is{IRIX} = $^O eq 'irix';
33 96 $Is{NetBSD} = $^O eq 'netbsd';
34 96 $Is{Interix} = $^O eq 'interix';
35 96 $Is{SunOS4} = $^O eq 'sunos';
36 96 $Is{Solaris} = $^O eq 'solaris';
37 96 ▶ $Is{SunOS} = $Is{SunOS4} || $Is{Solaris};
Condition33%1/3
$Is{'SunOS4'} || $Is{'Solaris'}
l!l&&r!l&&!r
0096
MC/DC0%0/2
$Is{'SunOS4'} || $Is{'Solaris'}
$Is{'SunOS4'} $Is{'Solaris'}
Truth table33%1/3
A || B
A= $Is{'SunOS4'}B= $Is{'Solaris'}
ABresult
1X1
011
000
38 96 ▶ $Is{BSD} = ($^O =~ /^(?:free|midnight|net|open)bsd$/ or
Condition33%1/3
$^O =~ /^(?:free|midnight|net|open)bsd$/ || grep(($^O eq $_), ('bsdos', 'interix', 'dragonfly'))
l!l&&r!l&&!r
0096
MC/DC0%0/2
$^O =~ /^(?:free|midnight|net|open)bsd$/ || grep(($^O eq $_), ('bsdos', 'interix', 'dragonfly'))
$^O =~ /^(?:free|midnight|net|open)bsd$/ grep(($^O eq $_), ('bsdos', 'interix', 'dragonfly'))
Truth table33%1/3
A || B
A= $^O =~ /^(?:free|midnight|net|open)bsd$/B= grep(($^O eq $_), ('bsdos', 'interix', 'dragonfly'))
ABresult
1X1
011
000
39 grep( $^O eq $_, qw(bsdos interix dragonfly) )
40 );
41 96 $Is{Android} = $^O =~ /android/;
42 96 ▶ if ( $^O eq 'darwin' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "darwin") 0 96 96
43 0 my @osvers = split /\./, $Config{osvers};
44 0 ▶ if ( $^X eq '/usr/bin/perl' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X eq "/usr/bin/perl") 0 0 0
45 0 $Is{ApplCor} = ( $osvers[0] >= 18 );
46 }
47 0 $Is{AppleRPath} = ( $osvers[0] >= 9 );
48 }
49 }
50  
51 96 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=10.5
52 96 ▶ if( $Is{VMS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"}) 0 96 96
53 # For things like vmsify()
54 0 require VMS::Filespec;
55 0 VMS::Filespec->import;
56 }
57 }
58  
59  
60 =head1 NAME
61  
62 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
63  
64 =head1 SYNOPSIS
65  
66 require ExtUtils::MM_Unix;
67  
68 =head1 DESCRIPTION
69  
70 The methods provided by this package are designed to be used in
71 conjunction with L<ExtUtils::MakeMaker>. When MakeMaker writes a
72 Makefile, it creates one or more objects that inherit their methods
73 from a package L<MM|ExtUtils::MM>. MM itself doesn't provide any methods, but
74 it ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
75 specific packages take the responsibility for all the methods provided
76 by MM_Unix. We are trying to reduce the number of the necessary
77 overrides by defining rather primitive operations within
78 ExtUtils::MM_Unix.
79  
80 If you are going to write a platform specific MM package, please try
81 to limit the necessary overrides to primitive methods, and if it is not
82 possible to do so, let's work out how to achieve that gain.
83  
84 If you are overriding any of these methods in your Makefile.PL (in the
85 MY class), please report that to the makemaker mailing list. We are
86 trying to minimize the necessary method overrides and switch to data
87 driven Makefile.PLs wherever possible. In the long run less methods
88 will be overridable via the MY class.
89  
90 =head1 METHODS
91  
92 The following description of methods is still under
93 development. Please refer to the code for not suitably documented
94 sections and complain loudly to the makemaker@perl.org mailing list.
95 Better yet, provide a patch.
96  
97 Not all of the methods below are overridable in a
98 Makefile.PL. Overridable methods are marked as (o). All methods are
99 overridable by a platform specific MM_*.pm file.
100  
101 Cross-platform methods are being moved into L<MM_Any|ExtUtils::MM_Any>.
102 If you can't find something that used to be in here, look in MM_Any.
103  
104 =cut
105  
106 # So we don't have to keep calling the methods over and over again,
107 # we have these globals to cache the values. Faster and shrtr.
108 96 my $Curdir = __PACKAGE__->curdir;
109 96 my $Updir = __PACKAGE__->updir;
110  
111  
112 =head2 Methods
113  
114 =over 4
115  
116 =item os_flavor
117  
118 Simply says that we're Unix.
119  
120 =cut
121  
122 359 ▶sub os_flavor {
Subroutine os_flavor: called CC=1 SCAR=0.0
Pod documented
123 359 return('Unix');
124 }
125  
126  
127 =item c_o (o)
128  
129 Defines the suffix rules to compile different flavors of C files to
130 object files.
131  
132 =cut
133  
134 217 ▶sub c_o {
Subroutine c_o: called CC=12 SCAR=26.0
Pod documented
135 # --- Translation Sections ---
136  
137 217 my($self) = shift;
138 217 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
139 21 my(@m);
140  
141 21 my $command = '$(CCCMD)';
142 21 my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)';
143  
144 21 ▶ if ( $Is{ApplCor} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"ApplCor"}) 0 21 21
145 0 $flags =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/;
146 }
147  
148 21 ▶ if (my $cpp = $self->{CPPRUN}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cpp = $self->{"CPPRUN"}) 21 0 21
149 21 my $cpp_cmd = $self->const_cccmd;
150 21 $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/\$(CPPRUN)/;
151 21 push @m, qq{
152 .c.i:
153 $cpp_cmd $flags \$*.c > \$*.i
154 };
155 }
156  
157 21 ▶ my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*.s') : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'XSMULTI'} ? : 5 16 21
158 21 push @m, sprintf <<'EOF', $command, $flags, $m_o;
159  
160 .c.s :
161 %s -S %s $*.c %s
162 EOF
163  
164 21 my @exts = qw(c cpp cxx cc);
165 21 ▶ push @exts, 'C' if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific
Branch: 1 branch
BranchTrueFalseTotal
unless $Is{"OS2"} or $Is{"Win32"} or $Is{"Dos"} 21 0 21
Condition33%2/6
$Is{"OS2"} or $Is{"Win32"} or $Is{"Dos"}
l!l&&r!l&&!r
0021
$Is{"OS2"} or $Is{"Win32"}
l!l&&r!l&&!r
0021
MC/DC0%0/3
$Is{"OS2"} or $Is{"Win32"} or $Is{"Dos"}
$Is{"OS2"} $Is{"Win32"} $Is{"Dos"}
Truth table25%1/4
A or B or C
A= $Is{"OS2"}B= $Is{"Win32"}C= $Is{"Dos"}
ABCresult
1XX1
01X1
0011
0000
166 21 ▶ $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'XSMULTI'} ? : 5 16 21
167 21 my $dbgout = $self->dbgoutflag;
168 21 for my $ext (@exts) {
169 105 ▶ push @m, "\n.$ext\$(OBJ_EXT) :\n\t$command $flags "
Branch: 2 branches
BranchTrueFalseTotal
$dbgout ? : 0 105 105
$m_o ? : 25 80 105
170 .($dbgout?"$dbgout ":'')
171 ."\$*.$ext" . ( $m_o ? " $m_o" : '' ) . "\n";
172 }
173 21 return join "", @m;
174 }
175  
176  
177 =item xs_obj_opt
178  
179 Takes the object file as an argument, and returns the portion of compile
180 command-line that will output to the specified object file.
181  
182 =cut
183  
184 40 ▶sub xs_obj_opt {
Subroutine xs_obj_opt: called CC=1 SCAR=0.0
Pod documented
185 40 my ($self, $output_file) = @_;
186 40 "-o $output_file";
187 }
188  
189 =item dbgoutflag
190  
191 Returns a CC flag that tells the CC to emit a separate debugging symbol file
192 when compiling an object file.
193  
194 =cut
195  
196 42 ▶sub dbgoutflag {
Subroutine dbgoutflag: called CC=1 SCAR=0.0
Pod documented
197 42 '';
198 }
199  
200 =item cflags (o)
201  
202 Does very much the same as the cflags script in the perl
203 distribution. It doesn't return the whole compiler command line, but
204 initializes all of its parts. The const_cccmd method then actually
205 returns the definition of the CCCMD macro which uses these parts.
206  
207 =cut
208  
209 #'
210  
211 218 ▶sub cflags {
Subroutine cflags: called CC=29 SCAR=47.9
Pod documented
212 218 my($self,$libperl)=@_;
213 218 ▶ return $self->{CFLAGS} if $self->{CFLAGS};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CFLAGS"} 0 218 218
214 218 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 22 218
215  
216 22 my($prog, $uc, $perltype, %cflags);
217 22 ▶ $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
Condition33%2/6
$libperl ||= $self->{"LIBPERL_A"} || qq[libperl$self->{"LIB_EXT"}]
l!l&&r!l&&!r
0220
$self->{'LIBPERL_A'} || "libperl$self->{'LIB_EXT'}"
l!l
2200
MC/DC0%0/2
$libperl ||= $self->{"LIBPERL_A"} || qq[libperl$self->{"LIB_EXT"}]
$libperl $self->{'LIBPERL_A'}
Truth table33%1/3
A ||= B
A= $libperlB= $self->{'LIBPERL_A'}
ABresult
1X1
011
000
218 22 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
219  
220 @cflags{qw(cc ccflags optimize shellflags)}
221 22 = @Config{qw(cc ccflags optimize shellflags)};
222  
223 # Perl 5.21.4 adds the (gcc) warning (-Wall ...) and std (-std=c89)
224 # flags to the %Config, and the modules in the core should be built
225 # with the warning flags, but NOT the -std=c89 flags (the latter
226 # would break using any system header files that are strict C99).
227 22 my @ccextraflags = qw(ccwarnflags);
228 22 ▶ if ($ENV{PERL_CORE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"PERL_CORE"}) 0 22 22
229 0 for my $x (@ccextraflags) {
230 0 ▶ if (exists $Config{$x}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $ExtUtils::MM_Unix::Config{$x}) 0 0 0
231 0 $cflags{$x} = $Config{$x};
232 }
233 }
234 }
235  
236 22 my($optdebug) = "";
237  
238 22 ▶ $cflags{shellflags} ||= '';
Condition33%1/3
$cflags{"shellflags"} ||= ""
l!l
0220
MC/DC0%0/1
$cflags{"shellflags"} ||= ""
$cflags{"shellflags"}
Truth table50%1/2
A
A= $cflags{"shellflags"}
Aresult
11
00
239  
240 22 my(%map) = (
241 D => '-DDEBUGGING',
242 E => '-DEMBED',
243 DE => '-DDEBUGGING -DEMBED',
244 M => '-DEMBED -DMULTIPLICITY',
245 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
246 );
247  
248 22 ▶ if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
Branch: 1 branch
BranchTrueFalseTotal
if ($libperl =~ /libperl(\w*)\Q$self->{'LIB_EXT'}\E/) { } 22 0 22
249 22 $uc = uc($1);
250 } else {
251 0 $uc = ""; # avoid warning
252 }
253 22 ▶ $perltype = $map{$uc} ? $map{$uc} : "";
Branch: 1 branch
BranchTrueFalseTotal
$map{$uc} ? : 0 22 22
254  
255 22 ▶ if ($uc =~ /^D/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc =~ /^D/) 0 22 22
256 0 $optdebug = "-g";
257 }
258  
259  
260 22 my($name);
261 22 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
262 22 ▶ if ($prog = $Config{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prog = $ExtUtils::MM_Unix::Config{$name}) 0 22 22
263 # Expand hints for this extension via the shell
264 0 ▶ print "Processing $name hint:\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 0 0
265 0 my(@o)=`cc=\"$cflags{cc}\"
266 ccflags=\"$cflags{ccflags}\"
267 optimize=\"$cflags{optimize}\"
268 perltype=\"$cflags{perltype}\"
269 optdebug=\"$cflags{optdebug}\"
270 eval '$prog'
271 echo cc=\$cc
272 echo ccflags=\$ccflags
273 echo optimize=\$optimize
274 echo perltype=\$perltype
275 echo optdebug=\$optdebug
276 `;
277 0 foreach my $line (@o){
278 0 chomp $line;
279 0 ▶ if ($line =~ /(.*?)=\s*(.*)\s*$/){
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /(.*?)=\s*(.*)\s*$/) { } 0 0 0
280 0 $cflags{$1} = $2;
281 0 ▶ print " $1 = $2\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 0 0
282 } else {
283 0 print "Unrecognised result from hint: '$line'\n";
284 }
285 }
286 }
287  
288 22 ▶ if ($optdebug) {
Branch: 1 branch
BranchTrueFalseTotal
if ($optdebug) 0 22 22
289 0 $cflags{optimize} = $optdebug;
290 }
291  
292 22 for (qw(ccflags optimize perltype)) {
293 66 ▶ $cflags{$_} ||= '';
Condition66%2/3
$cflags{$_} ||= ""
l!l
44220
MC/DC100%1/1
$cflags{$_} ||= ""
$cflags{$_}
Truth table100%2/2
A
A= $cflags{$_}
Aresult
11
00
294 66 $cflags{$_} =~ s/^\s+//;
295 66 $cflags{$_} =~ s/\s+/ /g;
296 66 $cflags{$_} =~ s/\s+$//;
297 66 ▶ $self->{uc $_} ||= $cflags{$_};
Condition100%3/3
$$self{uc $_} ||= $cflags{$_}
l!l&&r!l&&!r
14322
MC/DC100%2/2
$$self{uc $_} ||= $cflags{$_}
$$self{uc $_} $cflags{$_}
Truth table100%3/3
A ||= B
A= $$self{uc $_}B= $cflags{$_}
ABresult
1X1
011
000
298 }
299  
300 22 ▶ if ($self->{POLLUTE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"POLLUTE"}) 0 22 22
301 0 $self->{CCFLAGS} .= ' -DPERL_POLLUTE ';
302 }
303  
304 22 for my $x (@ccextraflags) {
305 22 ▶ next unless exists $cflags{$x};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $cflags{$x} 22 0 22
306 0 ▶ $self->{CCFLAGS} .= $cflags{$x} =~ m!^\s! ? $cflags{$x} : ' ' . $cflags{$x};
Branch: 1 branch
BranchTrueFalseTotal
$cflags{$x} =~ /^\s/ ? : 0 0 0
307 }
308  
309 22 my $pollute = '';
310 22 ▶ if ($Config{usemymalloc} and not $Config{bincompat5005}
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::MM_Unix::Config{"usemymalloc"} and not $ExtUtils::MM_Unix::Config{"bincompat5005"} and not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/ and $self->{"PERL_MALLOC_OK"}) 0 22 22
Condition33%3/9
$ExtUtils::MM_Unix::Config{"usemymalloc"} and not $ExtUtils::MM_Unix::Config{"bincompat5005"} and not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/ and $self->{"PERL_MALLOC_OK"}
!ll&&!rl&&r
0220
$ExtUtils::MM_Unix::Config{"usemymalloc"} and not $ExtUtils::MM_Unix::Config{"bincompat5005"} and not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/
!ll&&!rl&&r
0022
$ExtUtils::MM_Unix::Config{"usemymalloc"} and not $ExtUtils::MM_Unix::Config{"bincompat5005"}
!ll&&!rl&&r
0022
MC/DC0%0/4
$ExtUtils::MM_Unix::Config{"usemymalloc"} and not $ExtUtils::MM_Unix::Config{"bincompat5005"} and not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/ and $self->{"PERL_MALLOC_OK"}
$ExtUtils::MM_Unix::Config{"usemymalloc"} not $ExtUtils::MM_Unix::Config{"bincompat5005"} not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/ $self->{"PERL_MALLOC_OK"}
Truth table20%1/5
A and not(B) and not(C) and D
A= $ExtUtils::MM_Unix::Config{"usemymalloc"}B= not $ExtUtils::MM_Unix::Config{"bincompat5005"}C= not $ExtUtils::MM_Unix::Config{"ccflags"} =~ /-DPERL_POLLUTE_MALLOC\b/D= $self->{"PERL_MALLOC_OK"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
311 and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/
312 and $self->{PERL_MALLOC_OK}) {
313 0 $pollute = '$(PERL_MALLOC_DEF)';
314 }
315  
316 22 return $self->{CFLAGS} = qq{
317 CCFLAGS = $self->{CCFLAGS}
318 OPTIMIZE = $self->{OPTIMIZE}
319 PERLTYPE = $self->{PERLTYPE}
320 MPOLLUTE = $pollute
321 };
322  
323 }
324  
325  
326 =item const_cccmd (o)
327  
328 Returns the full compiler call for C programs and stores the
329 definition in CONST_CCCMD.
330  
331 =cut
332  
333 238 ▶sub const_cccmd {
Subroutine const_cccmd: called CC=3 SCAR=11.0
Pod documented
334 238 my($self,$libperl)=@_;
335 238 ▶ return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONST_CCCMD"} 21 217 238
336 217 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
337 return $self->{CONST_CCCMD} =
338 21 q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\
339 $(CCFLAGS) $(OPTIMIZE) \\
340 $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\
341 $(XS_DEFINE_VERSION)};
342 }
343  
344 =item const_config (o)
345  
346 Sets SHELL if needed, then defines a couple of constants in the Makefile
347 that are imported from %Config.
348  
349 =cut
350  
351 218 ▶sub const_config {
Subroutine const_config: called CC=3 SCAR=11.0
Pod documented
352 # --- Constants Sections ---
353  
354 218 my($self) = shift;
355 218 my @m = $self->specify_shell(); # Usually returns empty string
356 218 push @m, <<"END";
357  
358 # These definitions are from config.sh (via $INC{'Config.pm'}).
359 # They may have been overridden via Makefile.PL or on the command line.
360 END
361  
362 218 my(%once_only);
363 218 foreach my $key (@{$self->{CONFIG}}){
364 # SITE*EXP macros are defined in &constants; avoid duplicates here
365 5014 ▶ next if $once_only{$key};
Branch: 1 branch
BranchTrueFalseTotal
if $once_only{$key} 0 5014 5014
366 5014 push @m, uc($key) , ' = ' , $self->{uc $key}, "\n";
367 5014 $once_only{$key} = 1;
368 }
369 218 join('', @m);
370 }
371  
372 =item const_loadlibs (o)
373  
374 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
375 L<ExtUtils::Liblist> for details.
376  
377 =cut
378  
379 217 ▶sub const_loadlibs {
Subroutine const_loadlibs: called CC=6 SCAR=18.7
Pod documented
380 217 my($self) = shift;
381 217 ▶ return "" unless $self->needs_linking;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
382 21 my @m;
383 21 push @m, qq{
384 # $self->{NAME} might depend on some other libraries:
385 # See ExtUtils::Liblist for details
386 #
387 };
388 21 for my $tmp (qw/
389 EXTRALIBS LDLOADLIBS BSLOADLIBS
390 /) {
391 63 ▶ next unless defined $self->{$tmp};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$tmp} 63 0 63
392 0 push @m, "$tmp = $self->{$tmp}\n";
393 }
394 # don't set LD_RUN_PATH if empty
395 21 for my $tmp (qw/
396 LD_RUN_PATH
397 /) {
398 21 ▶ next unless $self->{$tmp};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{$tmp} 21 0 21
399 0 push @m, "$tmp = $self->{$tmp}\n";
400 }
401 21 return join "", @m;
402 }
403  
404 =item constants (o)
405  
406 my $make_frag = $mm->constants;
407  
408 Prints out macros for lots of constants.
409  
410 =cut
411  
412 218 ▶sub constants {
Subroutine constants: called CC=8 SCAR=20.9
Pod documented
413 218 my ($self) = @_;
414 218 my @m = ();
415  
416 218 $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use
417  
418 218 for my $macro (qw(
419  
420 AR_STATIC_ARGS DIRFILESEP DFSEP
421 NAME NAME_SYM
422 VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
423 XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
424 INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB
425 INST_MAN1DIR INST_MAN3DIR
426 MAN1EXT MAN3EXT
427 MAN1SECTION MAN3SECTION
428 INSTALLDIRS INSTALL_BASE DESTDIR PREFIX
429 PERLPREFIX SITEPREFIX VENDORPREFIX
430 ),
431 3924 (map { ("INSTALL".$_,
432 "DESTINSTALL".$_)
433 } $self->installvars),
434 qw(
435 PERL_LIB
436 PERL_ARCHLIB
437 LIBPERL_A MYEXTLIB
438 FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE
439 PERLMAINCC PERL_SRC PERL_INC
440 PERL FULLPERL ABSPERL
441 PERLRUN FULLPERLRUN ABSPERLRUN
442 PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST
443 PERL_CORE
444 PERM_DIR PERM_RW PERM_RWX
445  
446 ))
447 {
448 19184 ▶ next unless defined $self->{$macro};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$macro} 668 18516 19184
449  
450 # pathnames can have sharp signs in them; escape them so
451 # make doesn't think it is a comment-start character.
452 18516 $self->{$macro} =~ s/#/\\#/g;
453 $self->{$macro} = $self->quote_dep($self->{$macro})
454 18516 ▶ if $ExtUtils::MakeMaker::macro_dep{$macro};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::macro_dep{$macro} 0 18516 18516
455 18516 push @m, "$macro = $self->{$macro}\n";
456 }
457  
458 218 push @m, qq{
459 MAKEMAKER = $self->{MAKEMAKER}
460 MM_VERSION = $self->{MM_VERSION}
461 MM_REVISION = $self->{MM_REVISION}
462 };
463  
464 218 push @m, q{
465 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
466 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
467 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
468 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
469 };
470  
471 218 for my $macro (qw/
472 MAKE
473 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
474 LDFROM LINKTYPE BOOTDEP
475 / )
476 {
477 2616 ▶ next unless defined $self->{$macro};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$macro} 428 2188 2616
478 2188 push @m, "$macro = $self->{$macro}\n";
479 }
480  
481 push @m, "
482 # Handy lists of source code files:
483 218 XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})."
484 218 C_FILES = ".$self->wraplist(sort @{$self->{C}})."
485 218 O_FILES = ".$self->wraplist(sort @{$self->{O_FILES}})."
486 218 H_FILES = ".$self->wraplist(sort @{$self->{H}})."
487 218 MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})."
488 218 MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."
489 ";
490  
491 push @m, q{
492 SDKROOT := $(shell xcrun --show-sdk-path)
493 PERL_SYSROOT = $(SDKROOT)
494 217 ▶} if $Is{ApplCor} && $self->{'PERL_INC'} =~ m!^/System/Library/Perl/!;
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"ApplCor"} and $self->{"PERL_INC"} =~ m[^/System/Library/Perl/] 0 217 217
Condition33%1/3
$Is{"ApplCor"} and $self->{"PERL_INC"} =~ m[^/System/Library/Perl/]
!ll&&!rl&&r
21700
MC/DC0%0/2
$Is{"ApplCor"} and $self->{"PERL_INC"} =~ m[^/System/Library/Perl/]
$Is{"ApplCor"} $self->{"PERL_INC"} =~ m[^/System/Library/Perl/]
Truth table33%1/3
A and B
A= $Is{"ApplCor"}B= $self->{"PERL_INC"} =~ m[^/System/Library/Perl/]
ABresult
0X0
100
111
495  
496 217 push @m, qq{
497 # Where to build things
498 INST_LIBDIR = $self->{INST_LIBDIR}
499 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
500  
501 INST_AUTODIR = $self->{INST_AUTODIR}
502 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
503  
504 INST_STATIC = $self->{INST_STATIC}
505 INST_DYNAMIC = $self->{INST_DYNAMIC}
506 INST_BOOT = $self->{INST_BOOT}
507 };
508  
509 217 push @m, qq{
510 # Extra linker info
511 EXPORT_LIST = $self->{EXPORT_LIST}
512 PERL_ARCHIVE = $self->{PERL_ARCHIVE}
513 PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER}
514 };
515  
516 push @m, "
517  
518 217 TO_INST_PM = ".$self->wraplist(map $self->quote_dep($_), sort keys %{$self->{PM}})."\n";
519  
520 217 join('', @m) . $self->dep_constants;
521 }
522  
523 =item dep_constants (o)
524  
525 my $make_frag = $mm->dep_constants;
526  
527 Prints out macros for dependency constants.
528  
529 =cut
530  
531 217 ▶sub dep_constants {
Subroutine dep_constants: called CC=7 SCAR=19.6
Pod documented
532 217 my ($self) = @_;
533 217 my @m = ();
534 217 for my $macro (qw(PERL_ARCHLIBDEP PERL_INCDEP)) {
535 434 ▶ next unless defined $self->{$macro};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$macro} 2 432 434
536 # pathnames can have sharp signs in them; escape them so
537 # make doesn't think it is a comment-start character.
538 432 $self->{$macro} =~ s/#/\\#/g;
539 $self->{$macro} = $self->quote_dep($self->{$macro})
540 432 ▶ if $ExtUtils::MakeMaker::macro_dep{$macro};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MakeMaker::macro_dep{$macro} 432 0 432
541 432 push @m, "$macro = $self->{$macro}\n";
542 }
543  
544 217 push @m, qq{
545 \n# Dependencies info
546 PERL_ARCHIVEDEP = $self->{PERL_ARCHIVEDEP}
547 };
548  
549 push @m, q{
550 # Where is the Config information that we are using/depend on
551 CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_SYSROOT)$(PERL_INCDEP)$(DFSEP)config.h
552 217 ▶} if $Is{ApplCor};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"ApplCor"} 0 217 217
553 push @m, q{
554 # Where is the Config information that we are using/depend on
555 CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h
556 217 ▶} if -e $self->catfile( $self->{PERL_INC}, 'config.h' ) && !$Is{ApplCor};
Branch: 1 branch
BranchTrueFalseTotal
if -e $self->catfile($self->{"PERL_INC"}, "config.h") and not $Is{"ApplCor"} 215 2 217
Condition66%2/3
-e $self->catfile($self->{"PERL_INC"}, "config.h") and not $Is{"ApplCor"}
!ll&&!rl&&r
20215
MC/DC50%1/2
-e $self->catfile($self->{"PERL_INC"}, "config.h") and not $Is{"ApplCor"}
-e $self->catfile($self->{"PERL_INC"}, "config.h") not $Is{"ApplCor"}
Truth table66%2/3
A and not(B)
A= -e $self->catfile($self->{"PERL_INC"}, "config.h")B= not $Is{"ApplCor"}
ABresult
0X0
100
111
557  
558 217 join '', @m;
559 }
560  
561 =item depend (o)
562  
563 Same as macro for the depend attribute.
564  
565 =cut
566  
567 217 ▶sub depend {
Subroutine depend: called CC=4 SCAR=21.7
Pod documented
568 217 my($self,%attribs) = @_;
569 217 my(@m,$key,$val);
570 217 for my $key (sort keys %attribs){
571 0 my $val = $attribs{$key};
572 0 ▶ next unless defined $key and defined $val;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key and defined $val 0 0 0
Condition0%0/3
defined $key and defined $val
!ll&&!rl&&r
000
MC/DC0%0/2
defined $key and defined $val
defined $key defined $val
Truth table0%0/3
A and B
A= defined $keyB= defined $val
ABresult
0X0
100
111
573 0 push @m, "$key : $val\n";
574 }
575 217 join "", @m;
576 }
577  
578  
579 =item init_DEST
580  
581 $mm->init_DEST
582  
583 Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
584  
585 =cut
586  
587 219 ▶sub init_DEST {
Subroutine init_DEST: called CC=4 SCAR=14.3
Pod documented
588 219 my $self = shift;
589  
590 # Initialize DESTDIR
591 219 ▶ $self->{DESTDIR} ||= '';
Condition50%1/2
$self->{"DESTDIR"} ||= ""
l!l
0219
MC/DC0%0/1
$self->{"DESTDIR"} ||= ""
$self->{"DESTDIR"}
Truth table50%1/2
A
A= $self->{"DESTDIR"}
Aresult
11
00
592  
593 # Make DEST variables.
594 219 foreach my $var ($self->installvars) {
595 3942 my $destvar = 'DESTINSTALL'.$var;
596 3942 ▶ $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')';
Condition50%1/2
$self->{$destvar} ||= '$(DESTDIR)$(INSTALL' . $var . ')'
l!l
03942
MC/DC0%0/1
$self->{$destvar} ||= '$(DESTDIR)$(INSTALL' . $var . ')'
$self->{$destvar}
Truth table50%1/2
A
A= $self->{$destvar}
Aresult
11
00
597 }
598 }
599  
600  
601 =item init_dist
602  
603 $mm->init_dist;
604  
605 Defines a lot of macros for distribution support.
606  
607 macro description default
608  
609 TAR tar command to use tar
610 TARFLAGS flags to pass to TAR cvf
611  
612 ZIP zip command to use zip
613 ZIPFLAGS flags to pass to ZIP -r
614  
615 COMPRESS compression command to gzip --best
616 use for tarfiles
617 SUFFIX suffix to put on .gz
618 compressed files
619  
620 SHAR shar command to use shar
621  
622 PREOP extra commands to run before
623 making the archive
624 POSTOP extra commands to run after
625 making the archive
626  
627 TO_UNIX a command to convert linefeeds
628 to Unix style in your archive
629  
630 CI command to checkin your ci -u
631 sources to version control
632 RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q
633 just after CI is run
634  
635 DIST_CP $how argument to manicopy() best
636 when the distdir is created
637  
638 DIST_DEFAULT default target to use to tardist
639 create a distribution
640  
641 DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION)
642 (minus suffixes)
643  
644 =cut
645  
646 219 ▶sub init_dist {
Subroutine init_dist: called CC=17 SCAR=33.0
Pod documented
647 219 my $self = shift;
648  
649 219 ▶ $self->{TAR} ||= 'tar';
Condition50%1/2
$self->{"TAR"} ||= "tar"
l!l
0219
MC/DC0%0/1
$self->{"TAR"} ||= "tar"
$self->{"TAR"}
Truth table50%1/2
A
A= $self->{"TAR"}
Aresult
11
00
650 219 ▶ $self->{TARFLAGS} ||= 'cvf';
Condition50%1/2
$self->{"TARFLAGS"} ||= "cvf"
l!l
0219
MC/DC0%0/1
$self->{"TARFLAGS"} ||= "cvf"
$self->{"TARFLAGS"}
Truth table50%1/2
A
A= $self->{"TARFLAGS"}
Aresult
11
00
651 219 ▶ $self->{ZIP} ||= 'zip';
Condition50%1/2
$self->{"ZIP"} ||= "zip"
l!l
0219
MC/DC0%0/1
$self->{"ZIP"} ||= "zip"
$self->{"ZIP"}
Truth table50%1/2
A
A= $self->{"ZIP"}
Aresult
11
00
652 219 ▶ $self->{ZIPFLAGS} ||= '-r';
Condition50%1/2
$self->{"ZIPFLAGS"} ||= "-r"
l!l
0219
MC/DC0%0/1
$self->{"ZIPFLAGS"} ||= "-r"
$self->{"ZIPFLAGS"}
Truth table50%1/2
A
A= $self->{"ZIPFLAGS"}
Aresult
11
00
653 219 ▶ $self->{COMPRESS} ||= 'gzip --best';
Condition50%1/2
$self->{"COMPRESS"} ||= "gzip --best"
l!l
0219
MC/DC0%0/1
$self->{"COMPRESS"} ||= "gzip --best"
$self->{"COMPRESS"}
Truth table50%1/2
A
A= $self->{"COMPRESS"}
Aresult
11
00
654 219 ▶ $self->{SUFFIX} ||= '.gz';
Condition50%1/2
$self->{"SUFFIX"} ||= ".gz"
l!l
0219
MC/DC0%0/1
$self->{"SUFFIX"} ||= ".gz"
$self->{"SUFFIX"}
Truth table50%1/2
A
A= $self->{"SUFFIX"}
Aresult
11
00
655 219 ▶ $self->{SHAR} ||= 'shar';
Condition50%1/2
$self->{"SHAR"} ||= "shar"
l!l
0219
MC/DC0%0/1
$self->{"SHAR"} ||= "shar"
$self->{"SHAR"}
Truth table50%1/2
A
A= $self->{"SHAR"}
Aresult
11
00
656 219 ▶ $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST
Condition50%1/2
$self->{"PREOP"} ||= "\$(NOECHO) \$(NOOP)"
l!l
0219
MC/DC0%0/1
$self->{"PREOP"} ||= "\$(NOECHO) \$(NOOP)"
$self->{"PREOP"}
Truth table50%1/2
A
A= $self->{"PREOP"}
Aresult
11
00
657 219 ▶ $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir
Condition50%1/2
$self->{"POSTOP"} ||= "\$(NOECHO) \$(NOOP)"
l!l
0219
MC/DC0%0/1
$self->{"POSTOP"} ||= "\$(NOECHO) \$(NOOP)"
$self->{"POSTOP"}
Truth table50%1/2
A
A= $self->{"POSTOP"}
Aresult
11
00
658 219 ▶ $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)';
Condition50%1/2
$self->{"TO_UNIX"} ||= "\$(NOECHO) \$(NOOP)"
l!l
0219
MC/DC0%0/1
$self->{"TO_UNIX"} ||= "\$(NOECHO) \$(NOOP)"
$self->{"TO_UNIX"}
Truth table50%1/2
A
A= $self->{"TO_UNIX"}
Aresult
11
00
659  
660 219 ▶ $self->{CI} ||= 'ci -u';
Condition50%1/2
$self->{"CI"} ||= "ci -u"
l!l
0219
MC/DC0%0/1
$self->{"CI"} ||= "ci -u"
$self->{"CI"}
Truth table50%1/2
A
A= $self->{"CI"}
Aresult
11
00
661 219 ▶ $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q';
Condition50%1/2
$self->{"RCS_LABEL"} ||= "rcs -Nv\$(VERSION_SYM): -q"
l!l
0219
MC/DC0%0/1
$self->{"RCS_LABEL"} ||= "rcs -Nv\$(VERSION_SYM): -q"
$self->{"RCS_LABEL"}
Truth table50%1/2
A
A= $self->{"RCS_LABEL"}
Aresult
11
00
662 219 ▶ $self->{DIST_CP} ||= 'best';
Condition33%1/3
$self->{"DIST_CP"} ||= "best"
l!l
02190
MC/DC0%0/1
$self->{"DIST_CP"} ||= "best"
$self->{"DIST_CP"}
Truth table50%1/2
A
A= $self->{"DIST_CP"}
Aresult
11
00
663 219 ▶ $self->{DIST_DEFAULT} ||= 'tardist';
Condition33%1/3
$self->{"DIST_DEFAULT"} ||= "tardist"
l!l
02190
MC/DC0%0/1
$self->{"DIST_DEFAULT"} ||= "tardist"
$self->{"DIST_DEFAULT"}
Truth table50%1/2
A
A= $self->{"DIST_DEFAULT"}
Aresult
11
00
664  
665 219 ▶ ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"DISTNAME"} 218 1 219
666 219 ▶ $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION};
Condition66%2/3
$self->{"DISTVNAME"} ||= $self->{"DISTNAME"} . '-' . $self->{"VERSION"}
l!l
12180
MC/DC100%1/1
$self->{"DISTVNAME"} ||= $self->{"DISTNAME"} . '-' . $self->{"VERSION"}
$self->{"DISTVNAME"}
Truth table100%2/2
A
A= $self->{"DISTVNAME"}
Aresult
11
00
667 }
668  
669 =item dist (o)
670  
671 my $dist_macros = $mm->dist(%overrides);
672  
673 Generates a make fragment defining all the macros initialized in
674 init_dist.
675  
676 %overrides can be used to override any of the above.
677  
678 =cut
679  
680 138 ▶sub dist {
Subroutine dist: called CC=5 SCAR=18.4
Pod documented
681 138 my($self, %attribs) = @_;
682  
683 138 my $make = '';
684 138 ▶ if ( $attribs{SUFFIX} && $attribs{SUFFIX} !~ m!^\.! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attribs{"SUFFIX"} and not $attribs{"SUFFIX"} =~ /^\./) 0 138 138
Condition33%1/3
$attribs{"SUFFIX"} and not $attribs{"SUFFIX"} =~ /^\./
!ll&&!rl&&r
13800
MC/DC0%0/2
$attribs{"SUFFIX"} and not $attribs{"SUFFIX"} =~ /^\./
$attribs{"SUFFIX"} not $attribs{"SUFFIX"} =~ /^\./
Truth table33%1/3
A and not(B)
A= $attribs{"SUFFIX"}B= not $attribs{"SUFFIX"} =~ /^\./
ABresult
0X0
100
111
685 0 $attribs{SUFFIX} = '.' . $attribs{SUFFIX};
686 }
687 138 foreach my $key (qw(
688 TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR
689 PREOP POSTOP TO_UNIX
690 CI RCS_LABEL DIST_CP DIST_DEFAULT
691 DISTNAME DISTVNAME
692 ))
693 {
694 2208 ▶ my $value = $attribs{$key} || $self->{$key};
Condition33%1/3
$attribs{$key} || $self->{$key}
l!l&&r!l&&!r
022080
MC/DC0%0/2
$attribs{$key} || $self->{$key}
$attribs{$key} $self->{$key}
Truth table33%1/3
A || B
A= $attribs{$key}B= $self->{$key}
ABresult
1X1
011
000
695 2208 $make .= "$key = $value\n";
696 }
697  
698 138 return $make;
699 }
700  
701 =item dist_basics (o)
702  
703 Defines the targets distclean, distcheck, skipcheck, manifest, veryclean.
704  
705 =cut
706  
707 139 ▶sub dist_basics {
Subroutine dist_basics: called CC=1 SCAR=0.0
Pod documented
708 139 my($self) = shift;
709  
710 139 return <<'MAKE_FRAG';
711 distclean :: realclean distcheck
712 $(NOECHO) $(NOOP)
713  
714 distcheck :
715 $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
716  
717 skipcheck :
718 $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
719  
720 manifest :
721 $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
722  
723 veryclean : realclean
724 $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old
725  
726 MAKE_FRAG
727  
728 }
729  
730 =item dist_ci (o)
731  
732 Defines a check in target for RCS.
733  
734 =cut
735  
736 138 ▶sub dist_ci {
Subroutine dist_ci: called CC=1 SCAR=0.0
Pod documented
737 138 my($self) = shift;
738 138 return sprintf "ci :\n\t%s\n", $self->oneliner(<<'EOF', [qw(-MExtUtils::Manifest=maniread)]);
739 @all = sort keys %{ maniread() };
740 print(qq{Executing $(CI) @all\n});
741 system(qq{$(CI) @all}) == 0 or die $!;
742 print(qq{Executing $(RCS_LABEL) ...\n});
743 system(qq{$(RCS_LABEL) @all}) == 0 or die $!;
744 EOF
745 }
746  
747 =item dist_core (o)
748  
749 my $dist_make_fragment = $MM->dist_core;
750  
751 Puts the targets necessary for 'make dist' together into one make
752 fragment.
753  
754 =cut
755  
756 138 ▶sub dist_core {
Subroutine dist_core: called CC=2 SCAR=6.9
Pod documented
757 138 my($self) = shift;
758  
759 138 my $make_frag = '';
760 138 foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile
761 shdist))
762 {
763 966 my $method = $target.'_target';
764 966 $make_frag .= "\n";
765 966 $make_frag .= $self->$method();
766 }
767  
768 138 return $make_frag;
769 }
770  
771  
772 =item B<dist_target>
773  
774 my $make_frag = $MM->dist_target;
775  
776 Returns the 'dist' target to make an archive for distribution. This
777 target simply checks to make sure the Makefile is up-to-date and
778 depends on $(DIST_DEFAULT).
779  
780 =cut
781  
782 138 ▶sub dist_target {
Subroutine dist_target: called CC=1 SCAR=0.0
Pod documented
783 138 my($self) = shift;
784  
785 138 my $date_check = $self->oneliner(<<'CODE', ['-l']);
786 print 'Warning: Makefile possibly out of date with $(VERSION_FROM)'
787 if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';
788 CODE
789  
790 138 return sprintf <<'MAKE_FRAG', $date_check;
791 dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
792 $(NOECHO) %s
793 MAKE_FRAG
794 }
795  
796 =item B<tardist_target>
797  
798 my $make_frag = $MM->tardist_target;
799  
800 Returns the 'tardist' target which is simply so 'make tardist' works.
801 The real work is done by the dynamically named tardistfile_target()
802 method, tardist should have that as a dependency.
803  
804 =cut
805  
806 138 ▶sub tardist_target {
Subroutine tardist_target: called CC=1 SCAR=0.0
Pod documented
807 138 my($self) = shift;
808  
809 138 return <<'MAKE_FRAG';
810 tardist : $(DISTVNAME).tar$(SUFFIX)
811 $(NOECHO) $(NOOP)
812 MAKE_FRAG
813 }
814  
815 =item B<zipdist_target>
816  
817 my $make_frag = $MM->zipdist_target;
818  
819 Returns the 'zipdist' target which is simply so 'make zipdist' works.
820 The real work is done by the dynamically named zipdistfile_target()
821 method, zipdist should have that as a dependency.
822  
823 =cut
824  
825 138 ▶sub zipdist_target {
Subroutine zipdist_target: called CC=1 SCAR=0.0
Pod documented
826 138 my($self) = shift;
827  
828 138 return <<'MAKE_FRAG';
829 zipdist : $(DISTVNAME).zip
830 $(NOECHO) $(NOOP)
831 MAKE_FRAG
832 }
833  
834 =item B<tarfile_target>
835  
836 my $make_frag = $MM->tarfile_target;
837  
838 The name of this target is the name of the tarball generated by
839 tardist. This target does the actual work of turning the distdir into
840 a tarball.
841  
842 =cut
843  
844 138 ▶sub tarfile_target {
Subroutine tarfile_target: called CC=1 SCAR=0.0
Pod documented
845 138 my($self) = shift;
846  
847 138 return <<'MAKE_FRAG';
848 $(DISTVNAME).tar$(SUFFIX) : distdir
849 $(PREOP)
850 $(TO_UNIX)
851 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
852 $(RM_RF) $(DISTVNAME)
853 $(COMPRESS) $(DISTVNAME).tar
854 $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)'
855 $(POSTOP)
856 MAKE_FRAG
857 }
858  
859 =item zipfile_target
860  
861 my $make_frag = $MM->zipfile_target;
862  
863 The name of this target is the name of the zip file generated by
864 zipdist. This target does the actual work of turning the distdir into
865 a zip file.
866  
867 =cut
868  
869 138 ▶sub zipfile_target {
Subroutine zipfile_target: called CC=1 SCAR=0.0
Pod documented
870 138 my($self) = shift;
871  
872 138 return <<'MAKE_FRAG';
873 $(DISTVNAME).zip : distdir
874 $(PREOP)
875 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
876 $(RM_RF) $(DISTVNAME)
877 $(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip'
878 $(POSTOP)
879 MAKE_FRAG
880 }
881  
882 =item uutardist_target
883  
884 my $make_frag = $MM->uutardist_target;
885  
886 Converts the tarfile into a uuencoded file
887  
888 =cut
889  
890 138 ▶sub uutardist_target {
Subroutine uutardist_target: called CC=1 SCAR=0.0
Pod documented
891 138 my($self) = shift;
892  
893 138 return <<'MAKE_FRAG';
894 uutardist : $(DISTVNAME).tar$(SUFFIX)
895 uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
896 $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu'
897 MAKE_FRAG
898 }
899  
900  
901 =item shdist_target
902  
903 my $make_frag = $MM->shdist_target;
904  
905 Converts the distdir into a shell archive.
906  
907 =cut
908  
909 138 ▶sub shdist_target {
Subroutine shdist_target: called CC=1 SCAR=0.0
Pod documented
910 138 my($self) = shift;
911  
912 138 return <<'MAKE_FRAG';
913 shdist : distdir
914 $(PREOP)
915 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
916 $(RM_RF) $(DISTVNAME)
917 $(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar'
918 $(POSTOP)
919 MAKE_FRAG
920 }
921  
922  
923 =item dlsyms (o)
924  
925 Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.
926  
927 Normally just returns an empty string.
928  
929 =cut
930  
931 217 ▶sub dlsyms {
Subroutine dlsyms: called CC=1 SCAR=0.0
Pod documented
932 217 return '';
933 }
934  
935  
936 =item dynamic_bs (o)
937  
938 Defines targets for bootstrap files.
939  
940 =cut
941  
942 217 ▶sub dynamic_bs {
Subroutine dynamic_bs: called CC=3 SCAR=11.0
Pod documented
943 217 my($self, %attribs) = @_;
944 217 ▶ return "\nBOOTSTRAP =\n" unless $self->has_link_code();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_link_code 196 21 217
945 21 my @exts;
946 21 ▶ if ($self->{XSMULTI}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'XSMULTI'}) { } 5 16 21
947 5 @exts = $self->_xs_list_basenames;
948 } else {
949 16 @exts = '$(BASEEXT)';
950 }
951 return join "\n",
952 21 "BOOTSTRAP = @{[map { qq{$_.bs} } @exts]}\n",
953 21 map { $self->_xs_make_bs($_) } @exts;
954 }
955  
956 26 ▶sub _xs_make_bs {
Subroutine _xs_make_bs: called CC=4 SCAR=13.9
957 26 my ($self, $basename) = @_;
958 26 my ($v, $d, $f) = File::Spec->splitpath($basename);
959 26 my @d = File::Spec->splitdir($d);
960 26 ▶ shift @d if $self->{XSMULTI} and $d[0] eq 'lib';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"XSMULTI"} and $d[0] eq "lib" 10 16 26
Condition66%2/3
$self->{"XSMULTI"} and $d[0] eq "lib"
!ll&&!rl&&r
16010
MC/DC50%1/2
$self->{"XSMULTI"} and $d[0] eq "lib"
$self->{"XSMULTI"} $d[0] eq "lib"
Truth table66%2/3
A and B
A= $self->{"XSMULTI"}B= $d[0] eq "lib"
ABresult
0X0
100
111
961 26 my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
962 26 ▶ $instdir = '$(INST_ARCHAUTODIR)' if $basename eq '$(BASEEXT)';
Branch: 1 branch
BranchTrueFalseTotal
if $basename eq "\$(BASEEXT)" 16 10 26
963 26 my $instfile = $self->catfile($instdir, "$f.bs");
964 26 my $exists = "$instdir\$(DFSEP).exists"; # match blibdirs_target
965 # 1 2 3
966 26 return _sprintf562 <<'MAKE_FRAG', $basename, $instfile, $exists;
967 # As Mkbootstrap might not write a file (if none is required)
968 # we use touch to prevent make continually trying to remake it.
969 # The DynaLoader only reads a non-empty file.
970 %1$s.bs : $(FIRST_MAKEFILE) $(BOOTDEP)
971 $(NOECHO) $(ECHO) "Running Mkbootstrap for %1$s ($(BSLOADLIBS))"
972 $(NOECHO) $(PERLRUN) \
973 "-MExtUtils::Mkbootstrap" \
974 -e "Mkbootstrap('%1$s','$(BSLOADLIBS)');"
975 $(NOECHO) $(TOUCH) "%1$s.bs"
976 $(CHMOD) $(PERM_RW) "%1$s.bs"
977  
978 %2$s : %1$s.bs %3$s
979 $(NOECHO) $(RM_RF) %2$s
980 - $(CP_NONEMPTY) %1$s.bs %2$s $(PERM_RW)
981 MAKE_FRAG
982 }
983  
984 =item dynamic_lib (o)
985  
986 Defines how to produce the *.so (or equivalent) files.
987  
988 =cut
989  
990 215 ▶sub dynamic_lib {
Subroutine dynamic_lib: called CC=12 SCAR=25.2
Pod documented
991 215 my($self, %attribs) = @_;
992 215 ▶ return '' unless $self->needs_linking(); #might be because of a subdir
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 195 20 215
993 20 ▶ return '' unless $self->has_link_code;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_link_code 0 20 20
994 20 my @m = $self->xs_dynamic_lib_macros(\%attribs);
995 20 my @libs;
996 20 my $dlsyms_ext = eval { $self->xs_dlsyms_ext };
997 20 ▶ if ($self->{XSMULTI}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'XSMULTI'}) { } 5 15 20
998 5 my @exts = $self->_xs_list_basenames;
999 5 for my $ext (@exts) {
1000 10 my ($v, $d, $f) = File::Spec->splitpath($ext);
1001 10 my @d = File::Spec->splitdir($d);
1002 10 ▶ shift @d if $d[0] eq 'lib';
Branch: 1 branch
BranchTrueFalseTotal
if $d[0] eq "lib" 10 0 10
1003 10 ▶ pop @d if $d[$#d] eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $d[$#d] eq "" 10 0 10
1004 10 my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
1005  
1006 # Dynamic library names may need special handling.
1007 10 eval { require DynaLoader };
1008 10 ▶ if (defined &DynaLoader::mod2fname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &DynaLoader::mod2fname) 0 10 10
1009 0 $f = &DynaLoader::mod2fname([@d, $f]);
1010 }
1011  
1012 10 my $instfile = $self->catfile($instdir, "$f.\$(DLEXT)");
1013 10 my $objfile = $self->_xsbuild_value('xs', $ext, 'OBJECT');
1014 10 ▶ $objfile = "$ext\$(OBJ_EXT)" unless defined $objfile;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $objfile 9 1 10
1015 10 my $ldfrom = $self->_xsbuild_value('xs', $ext, 'LDFROM');
1016 10 ▶ $ldfrom = $objfile unless defined $ldfrom;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ldfrom 10 0 10
1017 10 my $exportlist = "$ext.def";
1018 10 my @libchunk = ($objfile, $instfile, $instdir, $ldfrom, $exportlist);
1019 10 ▶ push @libchunk, $dlsyms_ext ? $ext.$dlsyms_ext : undef;
Branch: 1 branch
BranchTrueFalseTotal
$dlsyms_ext ? : 0 10 10
1020 10 push @libs, \@libchunk;
1021 }
1022 } else {
1023 15 my @libchunk = qw($(OBJECT) $(INST_DYNAMIC) $(INST_ARCHAUTODIR) $(LDFROM) $(EXPORT_LIST));
1024 15 ▶ push @libchunk, $dlsyms_ext ? '$(BASEEXT)'.$dlsyms_ext : undef;
Branch: 1 branch
BranchTrueFalseTotal
$dlsyms_ext ? : 0 15 15
1025 15 @libs = (\@libchunk);
1026 }
1027 20 push @m, map { $self->xs_make_dynamic_lib(\%attribs, @$_); } @libs;
1028  
1029 20 return join("\n",@m);
1030 }
1031  
1032 =item xs_dynamic_lib_macros
1033  
1034 Defines the macros for the C<dynamic_lib> section.
1035  
1036 =cut
1037  
1038 20 ▶sub xs_dynamic_lib_macros {
Subroutine xs_dynamic_lib_macros: called CC=5 SCAR=18.1
Pod documented
1039 20 my ($self, $attribs) = @_;
1040 20 ▶ my $otherldflags = $attribs->{OTHERLDFLAGS} || "";
Condition33%1/3
$attribs->{'OTHERLDFLAGS'} || ''
l!l
0200
MC/DC0%0/1
$attribs->{'OTHERLDFLAGS'} || ''
$attribs->{'OTHERLDFLAGS'}
Truth table50%1/2
A
A= $attribs->{'OTHERLDFLAGS'}
Aresult
11
00
1041 20 ▶ my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || "";
Condition33%1/3
$attribs->{'INST_DYNAMIC_DEP'} || ''
l!l
0200
MC/DC0%0/1
$attribs->{'INST_DYNAMIC_DEP'} || ''
$attribs->{'INST_DYNAMIC_DEP'}
Truth table50%1/2
A
A= $attribs->{'INST_DYNAMIC_DEP'}
Aresult
11
00
1042 20 my $armaybe = $self->_xs_armaybe($attribs);
1043 20 ▶ my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too?
Branch: 1 branch
BranchTrueFalseTotal
$Is{'OS2'} ? : 0 20 20
1044 20 ▶ my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : '';
Branch: 1 branch
BranchTrueFalseTotal
$Is{'OS2'} ? : 0 20 20
1045 20 sprintf <<'EOF', $armaybe, $ld_opt.$otherldflags, $inst_dynamic_dep, $ld_fix;
1046 # This section creates the dynamically loadable objects from relevant
1047 # objects and possibly $(MYEXTLIB).
1048 ARMAYBE = %s
1049 OTHERLDFLAGS = %s
1050 INST_DYNAMIC_DEP = %s
1051 INST_DYNAMIC_FIX = %s
1052 EOF
1053 }
1054  
1055 45 ▶sub _xs_armaybe {
Subroutine _xs_armaybe: called CC=5 SCAR=19.4
1056 45 my ($self, $attribs) = @_;
1057 45 ▶ my $armaybe = $attribs->{ARMAYBE} || $self->{ARMAYBE} || ":";
Condition40%2/5
$attribs->{'ARMAYBE'} || $self->{'ARMAYBE'} || ':'
l!l
045
$attribs->{"ARMAYBE"} or $self->{"ARMAYBE"}
l!l&&r!l&&!r
0045
MC/DC0%0/2
$attribs->{'ARMAYBE'} || $self->{'ARMAYBE'} || ':'
$attribs->{"ARMAYBE"} $self->{"ARMAYBE"}
Truth table33%1/3
A or B
A= $attribs->{"ARMAYBE"}B= $self->{"ARMAYBE"}
ABresult
1X1
011
000
1058 45 ▶ $armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':');
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"OSF"} and $armaybe eq ":" 0 45 45
Condition33%1/3
$Is{"OSF"} and $armaybe eq ":"
!ll&&!rl&&r
4500
MC/DC0%0/2
$Is{"OSF"} and $armaybe eq ":"
$Is{"OSF"} $armaybe eq ":"
Truth table33%1/3
A and B
A= $Is{"OSF"}B= $armaybe eq ":"
ABresult
0X0
100
111
1059 45 $armaybe;
1060 }
1061  
1062 =item xs_make_dynamic_lib
1063  
1064 Defines the recipes for the C<dynamic_lib> section.
1065  
1066 =cut
1067  
1068 25 ▶sub xs_make_dynamic_lib {
Subroutine xs_make_dynamic_lib: called CC=17 SCAR=43.1
Pod documented
1069 25 my ($self, $attribs, $object, $to, $todir, $ldfrom, $exportlist, $dlsyms) = @_;
1070 25 ▶ $exportlist = '' if $exportlist ne '$(EXPORT_LIST)';
Branch: 1 branch
BranchTrueFalseTotal
if $exportlist ne "\$(EXPORT_LIST)" 10 15 25
1071 25 my $armaybe = $self->_xs_armaybe($attribs);
1072 25 ▶ my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) %s'."\n", $to, $object, $todir, $exportlist, ($dlsyms || '');
Condition33%1/3
$dlsyms || ''
l!l
0250
MC/DC0%0/1
$dlsyms || ''
$dlsyms
Truth table50%1/2
A
A= $dlsyms
Aresult
11
00
1073 25 my $dlsyms_arg = $self->xs_dlsyms_arg($dlsyms);
1074 25 ▶ if ($armaybe ne ':'){
Branch: 1 branch
BranchTrueFalseTotal
if ($armaybe ne ":") 0 25 25
1075 0 $ldfrom = 'tmp$(LIB_EXT)';
1076 0 push(@m," \$(ARMAYBE) cr $ldfrom $object\n");
1077 0 push(@m," \$(RANLIB) $ldfrom\n");
1078 }
1079 25 ▶ $ldfrom = "-all $ldfrom -none" if $Is{OSF};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"OSF"} 0 25 25
1080  
1081 25 my $ldrun = '';
1082 # The IRIX linker doesn't use LD_RUN_PATH
1083 25 ▶ if ( $self->{LD_RUN_PATH} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"LD_RUN_PATH"}) 0 25 25
1084 0 ▶ if ( $Is{IRIX} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($Is{'IRIX'}) { } 0 0 0
elsif ($^O eq 'darwin' and $Is{'AppleRPath'}) { } 0 0 0
1085 0 $ldrun = qq{-rpath "$self->{LD_RUN_PATH}"};
1086 }
1087 ▶ elsif ( $^O eq 'darwin' && $Is{AppleRPath} ) {
Condition0%0/3
$^O eq "darwin" and $Is{"AppleRPath"}
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "darwin" and $Is{"AppleRPath"}
$^O eq "darwin" $Is{"AppleRPath"}
Truth table0%0/3
A and B
A= $^O eq "darwin"B= $Is{"AppleRPath"}
ABresult
0X0
100
111
1088 # both clang and gcc support -Wl,-rpath, but only clang supports
1089 # -rpath so by using -Wl,-rpath we avoid having to check for the
1090 # type of compiler
1091 0 my @dirs = split ':', $self->{LD_RUN_PATH};
1092 0 $ldrun = join " ", map(qq{-Wl,-rpath,"$_"}, @dirs);
1093 }
1094 }
1095  
1096 # For example in AIX the shared objects/libraries from previous builds
1097 # linger quite a while in the shared dynalinker cache even when nobody
1098 # is using them. This is painful if one for instance tries to restart
1099 # a failed build because the link command will fail unnecessarily 'cos
1100 # the shared object/library is 'busy'.
1101 25 push(@m," \$(RM_F) \$\@\n");
1102  
1103 25 my $libs = '$(LDLOADLIBS)';
1104 25 ▶ if (($Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"NetBSD"} || $Is{"Interix"} || $Is{"Android"} and $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true") 0 25 25
Condition33%3/9
$Is{"NetBSD"} || $Is{"Interix"} || $Is{"Android"} and $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true"
!ll&&!rl&&r
2500
$Is{"NetBSD"} or $Is{"Interix"} or $Is{"Android"}
l!l&&r!l&&!r
0025
$Is{"NetBSD"} or $Is{"Interix"}
l!l&&r!l&&!r
0025
MC/DC0%0/4
$Is{"NetBSD"} || $Is{"Interix"} || $Is{"Android"} and $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true"
$Is{"NetBSD"} $Is{"Interix"} $Is{"Android"} $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true"
Truth table14%1/7
A or B or C and D
A= $Is{"NetBSD"}B= $Is{"Interix"}C= $Is{"Android"}D= $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true"
ABCDresult
000X0
1XX00
01X00
00100
1XX11
01X11
00111
1105 # Use nothing on static perl platforms, and to the flags needed
1106 # to link against the shared libperl library on shared perl
1107 # platforms. We peek at lddlflags to see if we need -Wl,-R
1108 # or -R to add paths to the run-time library search path.
1109 0 ▶ if ($Config{'lddlflags'} =~ /-Wl,-R/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($ExtUtils::MM_Unix::Config{'lddlflags'} =~ /-Wl,-R/) { } 0 0 0
elsif ($ExtUtils::MM_Unix::Config{'lddlflags'} =~ /-R/) { } 0 0 0
elsif ($Is{'Android'}) { } 0 0 0
1110 0 $libs .= ' "-L$(PERL_INC)" "-Wl,-R$(INSTALLARCHLIB)/CORE" "-Wl,-R$(PERL_ARCHLIB)/CORE" -lperl';
1111 } elsif ($Config{'lddlflags'} =~ /-R/) {
1112 0 $libs .= ' "-L$(PERL_INC)" "-R$(INSTALLARCHLIB)/CORE" "-R$(PERL_ARCHLIB)/CORE" -lperl';
1113 } elsif ( $Is{Android} ) {
1114 # The Android linker will not recognize symbols from
1115 # libperl unless the module explicitly depends on it.
1116 0 $libs .= ' "-L$(PERL_INC)" -lperl';
1117 }
1118 }
1119  
1120 25 my $ld_run_path_shell = "";
1121 25 ▶ if ($self->{LD_RUN_PATH} ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"LD_RUN_PATH"} ne "") 0 25 25
1122 0 $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
1123 }
1124  
1125 25 push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $dlsyms_arg, $ldfrom, $self->xs_obj_opt('$@'), $libs, $exportlist;
1126 %s$(LD) %s $(LDDLFLAGS) %s %s $(OTHERLDFLAGS) %s $(MYEXTLIB) \
1127 $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) %s \
1128 $(INST_DYNAMIC_FIX)
1129 $(CHMOD) $(PERM_RWX) $@
1130 MAKE
1131 25 join '', @m;
1132 }
1133  
1134 =item exescan
1135  
1136 Deprecated method. Use libscan instead.
1137  
1138 =cut
1139  
1140 0 ▶sub exescan {
Subroutine exescan: not called CC=1 SCAR=6.9
Pod documented
1141 0 my($self,$path) = @_;
1142 0 $path;
1143 }
1144  
1145 =item extliblist
1146  
1147 Called by init_others, and calls ext ExtUtils::Liblist. See
1148 L<ExtUtils::Liblist> for details.
1149  
1150 =cut
1151  
1152 220 ▶sub extliblist {
Subroutine extliblist: called CC=1 SCAR=0.0
Pod documented
1153 220 my($self,$libs) = @_;
1154 220 require ExtUtils::Liblist;
1155 220 $self->ext($libs, $Verbose);
1156 }
1157  
1158 =item find_perl
1159  
1160 Finds the executables PERL and FULLPERL
1161  
1162 =cut
1163  
1164 126 ▶sub find_perl {
Subroutine find_perl: called CC=20 SCAR=38.1
Pod documented
1165 126 my($self, $ver, $names, $dirs, $trace) = @_;
1166 126 ▶ if ($trace >= 2){
Branch: 1 branch
BranchTrueFalseTotal
if ($trace >= 2) 0 126 126
1167 0 print "Looking for perl $ver by these names:
1168 @$names
1169 in these dirs:
1170 @$dirs
1171 ";
1172 }
1173  
1174 126 my $stderr_duped = 0;
1175 126 local *STDERR_COPY;
1176  
1177 126 ▶ unless ($Is{BSD}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Is{"BSD"}) 126 0 126
1178 # >& and lexical filehandles together give 5.6.2 indigestion
1179 126 ▶ if( open(STDERR_COPY, '>&STDERR') ) { ## no critic
Branch: 1 branch
BranchTrueFalseTotal
if (open STDERR_COPY, '>&STDERR') { } 126 0 126
1180 126 $stderr_duped = 1;
1181 }
1182 else {
1183 0 warn <<WARNING;
1184 find_perl() can't dup STDERR: $!
1185 You might see some garbage while we search for Perl
1186 WARNING
1187 }
1188 }
1189  
1190 126 foreach my $name (@$names){
1191 126 my ($abs, $use_dir);
1192 126 ▶ if ($self->file_name_is_absolute($name)) { # /foo/bar
Branch: 2 branches
BranchTrueFalseTotal
if ($self->file_name_is_absolute($name)) { } 126 0 126
elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { } 0 0 0
1193 126 $abs = $name;
1194 } elsif ($self->canonpath($name) eq
1195 $self->canonpath(basename($name))) { # foo
1196 0 $use_dir = 1;
1197 } else { # foo/bar
1198 0 $abs = $self->catfile($Curdir, $name);
1199 }
1200 126 ▶ foreach my $dir ($use_dir ? @$dirs : 1){
Branch: 1 branch
BranchTrueFalseTotal
$use_dir ? : 0 126 126
1201 126 ▶ next unless defined $dir; # $self->{PERL_SRC} may be undefined
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dir 0 126 126
1202  
1203 126 ▶ $abs = $self->catfile($dir, $name)
Branch: 1 branch
BranchTrueFalseTotal
if $use_dir 0 126 126
1204 if $use_dir;
1205  
1206 126 ▶ print "Checking $abs\n" if ($trace >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $trace >= 2 0 126 126
1207 126 ▶ next unless $self->maybe_command($abs);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->maybe_command($abs) 0 126 126
1208 126 ▶ print "Executing $abs\n" if ($trace >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $trace >= 2 0 126 126
1209  
1210 126 my $val;
1211 126 my $version_check = qq{"$abs" -le "require $ver; print qq{VER_OK}"};
1212  
1213 # To avoid using the unportable 2>&1 to suppress STDERR,
1214 # we close it before running the command.
1215 # However, thanks to a thread library bug in many BSDs
1216 # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
1217 # we cannot use the fancier more portable way in here
1218 # but instead need to use the traditional 2>&1 construct.
1219 126 ▶ if ($Is{BSD}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{'BSD'}) { } 0 126 126
1220 0 $val = `$version_check 2>&1`;
1221 } else {
1222 126 ▶ close STDERR if $stderr_duped;
Branch: 1 branch
BranchTrueFalseTotal
if $stderr_duped 126 0 126
1223 126 $val = `$version_check`;
1224  
1225 # 5.6.2's 3-arg open doesn't work with >&
1226 126 ▶ open STDERR, ">&STDERR_COPY" ## no critic
Branch: 1 branch
BranchTrueFalseTotal
if $stderr_duped 126 0 126
1227 if $stderr_duped;
1228 }
1229  
1230 126 ▶ if ($val =~ /^VER_OK/m) {
Branch: 2 branches
BranchTrueFalseTotal
if ($val =~ /^VER_OK/m) { } 126 0 126
elsif ($trace >= 2) { } 0 0 0
1231 126 ▶ print "Using PERL=$abs\n" if $trace;
Branch: 1 branch
BranchTrueFalseTotal
if $trace 0 126 126
1232 126 return $abs;
1233 } elsif ($trace >= 2) {
1234 0 print "Result: '$val' ".($? >> 8)."\n";
1235 }
1236 }
1237 }
1238 0 print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1239 0 0; # false and not empty
1240 }
1241  
1242  
1243 =item fixin
1244  
1245 $mm->fixin(@files);
1246  
1247 Inserts the sharpbang or equivalent magic number to a set of @files.
1248  
1249 =cut
1250  
1251 7 ▶sub fixin { # stolen from the pink Camel book, more or less
Subroutine fixin: called CC=10 SCAR=26.9
Pod documented
1252 7 my ( $self, @files ) = @_;
1253  
1254 7 for my $file (@files) {
1255 7 my $file_new = "$file.new";
1256 7 my $file_bak = "$file.bak";
1257  
1258 7 ▶ open( my $fixin, '<', $file ) or croak "Can't process '$file': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fixin, "<", $file or croak("Can't process '${file}': $!") 7 0 7
1259 7 local $/ = "\n";
1260 7 chomp( my $line = <$fixin> );
1261 7 ▶ next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file.
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ s/^\s*\#!\s*// 0 7 7
1262  
1263 7 my $shb = $self->_fixin_replace_shebang( $file, $line );
1264 7 ▶ next unless defined $shb;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $shb 1 6 7
1265  
1266 6 ▶ open( my $fixout, ">", "$file_new" ) or do {
Branch: 1 branch
BranchTrueFalseTotal
open my $fixout, ">", "$file_new" or do { warn "Can't create new ${file}: $!\n"; next } 6 0 6
1267 0 warn "Can't create new $file: $!\n";
1268 0 next;
1269 };
1270  
1271 # Print out the new #! line (or equivalent).
1272 6 local $\;
1273 6 local $/;
1274 6 print $fixout $shb, <$fixin>;
1275 6 close $fixin;
1276 6 close $fixout;
1277  
1278 6 chmod 0666, $file_bak;
1279 6 unlink $file_bak;
1280 6 ▶ unless ( _rename( $file, $file_bak ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_rename($file, $file_bak)) 0 6 6
1281 0 warn "Can't rename $file to $file_bak: $!";
1282 0 next;
1283 }
1284 6 ▶ unless ( _rename( $file_new, $file ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_rename($file_new, $file)) 0 6 6
1285 0 warn "Can't rename $file_new to $file: $!";
1286 0 ▶ unless ( _rename( $file_bak, $file ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_rename($file_bak, $file)) 0 0 0
1287 0 warn "Can't rename $file_bak back to $file either: $!";
1288 0 warn "Leaving $file renamed as $file_bak\n";
1289 }
1290 0 next;
1291 }
1292 6 unlink $file_bak;
1293 }
1294 continue {
1295 7 ▶ system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Config{"eunicefix"} ne ":" 0 7 7
1296 }
1297 }
1298  
1299  
1300 12 ▶sub _rename {
Subroutine _rename: called CC=4 SCAR=16.1
1301 12 my($old, $new) = @_;
1302  
1303 12 foreach my $file ($old, $new) {
1304 24 ▶ if( $Is{VMS} and basename($file) !~ /\./ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"} and not basename($file) =~ /\./) 0 24 24
Condition33%1/3
$Is{"VMS"} and not basename($file) =~ /\./
!ll&&!rl&&r
2400
MC/DC0%0/2
$Is{"VMS"} and not basename($file) =~ /\./
$Is{"VMS"} not basename($file) =~ /\./
Truth table33%1/3
A and not(B)
A= $Is{"VMS"}B= not basename($file) =~ /\./
ABresult
0X0
100
111
1305 # rename() in 5.8.0 on VMS will not rename a file if it
1306 # does not contain a dot yet it returns success.
1307 0 $file = "$file.";
1308 }
1309 }
1310  
1311 12 return rename($old, $new);
1312 }
1313  
1314 7 ▶sub _fixin_replace_shebang {
Subroutine _fixin_replace_shebang: called CC=21 SCAR=32.2
1315 7 my ( $self, $file, $line ) = @_;
1316  
1317 # Now figure out the interpreter name.
1318 7 my ( $origcmd, $arg ) = split ' ', $line, 2;
1319 7 (my $cmd = $origcmd) =~ s!^.*/!!;
1320  
1321 # Now look (in reverse) for interpreter in absolute PATH (unless perl).
1322 7 my $interpreter;
1323 7 ▶ if ( defined $ENV{PERL_MM_SHEBANG} && $ENV{PERL_MM_SHEBANG} eq "relocatable" ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $ENV{'PERL_MM_SHEBANG'} and $ENV{'PERL_MM_SHEBANG'} eq 'relocatable') { } 1 6 7
elsif ($cmd =~ /^perl(?:\z|[^a-z])/) { } 3 3 6
Condition66%2/3
defined $ENV{"PERL_MM_SHEBANG"} and $ENV{"PERL_MM_SHEBANG"} eq "relocatable"
!ll&&!rl&&r
601
MC/DC50%1/2
defined $ENV{"PERL_MM_SHEBANG"} and $ENV{"PERL_MM_SHEBANG"} eq "relocatable"
defined $ENV{"PERL_MM_SHEBANG"} $ENV{"PERL_MM_SHEBANG"} eq "relocatable"
Truth table66%2/3
A and B
A= defined $ENV{"PERL_MM_SHEBANG"}B= $ENV{"PERL_MM_SHEBANG"} eq "relocatable"
ABresult
0X0
100
111
1324 1 $interpreter = "/usr/bin/env perl";
1325 1 $arg = '';
1326 }
1327 elsif ( $cmd =~ m{^perl(?:\z|[^a-z])} ) {
1328 3 ▶ if ( $Config{startperl} =~ m,^\#!.*/perl, ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ExtUtils::MM_Unix::Config{'startperl'} =~ m[^\#!.*/perl]) { } 3 0 3
1329 3 $interpreter = $Config{startperl};
1330 3 $interpreter =~ s,^\#!,,;
1331 }
1332 else {
1333 0 $interpreter = $Config{perlpath};
1334 }
1335 }
1336 else {
1337 my (@absdirs)
1338 3 = reverse grep { $self->file_name_is_absolute($_) } $self->path;
1339 3 $interpreter = '';
1340  
1341 3 foreach my $dir (@absdirs) {
1342 14 my $maybefile = $self->catfile($dir,$cmd);
1343 14 ▶ if ( $self->maybe_command($maybefile) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->maybe_command($maybefile)) 3 11 14
1344 3 ▶ warn "Ignoring $interpreter in $file\n"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose and $interpreter 0 3 3
Condition33%1/3
$ExtUtils::MM_Unix::Verbose and $interpreter
!ll&&!rl&&r
300
MC/DC0%0/2
$ExtUtils::MM_Unix::Verbose and $interpreter
$ExtUtils::MM_Unix::Verbose $interpreter
Truth table33%1/3
A and B
A= $ExtUtils::MM_Unix::VerboseB= $interpreter
ABresult
0X0
100
111
1345 if $Verbose && $interpreter;
1346 3 $interpreter = $maybefile;
1347 }
1348 }
1349  
1350 # If the shebang is absolute and exists in PATH, but was not
1351 # the first one found, leave it alone if it's actually the
1352 # same file as first one. This avoids packages built on
1353 # merged-/usr systems with /usr/bin before /bin in the path
1354 # breaking when installed on systems without merged /usr
1355 3 ▶ if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) 3 0 3
Condition33%1/3
$origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)
!ll&&!rl&&r
003
MC/DC0%0/2
$origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)
$origcmd ne $interpreter $self->file_name_is_absolute($origcmd)
Truth table33%1/3
A and B
A= $origcmd ne $interpreterB= $self->file_name_is_absolute($origcmd)
ABresult
0X0
100
111
1356 3 my $origdir = dirname($origcmd);
1357 3 ▶ if ($self->maybe_command($origcmd) && grep { $_ eq $origdir } @absdirs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->maybe_command($origcmd) and grep {$_ eq $origdir;} @absdirs) 1 2 3
Condition66%2/3
$self->maybe_command($origcmd) and grep {$_ eq $origdir;} @absdirs
!ll&&!rl&&r
201
MC/DC50%1/2
$self->maybe_command($origcmd) and grep {$_ eq $origdir;} @absdirs
$self->maybe_command($origcmd) grep {$_ eq $origdir;} @absdirs
Truth table66%2/3
A and B
A= $self->maybe_command($origcmd)B= grep {$_ eq $origdir;} @absdirs
ABresult
0X0
100
111
1358 1 my ($odev, $oino) = stat $origcmd;
1359 1 my ($idev, $iino) = stat $interpreter;
1360 1 ▶ if ($odev == $idev && $oino eq $iino) {
Branch: 1 branch
BranchTrueFalseTotal
if ($odev == $idev and $oino eq $iino) 1 0 1
Condition33%1/3
$odev == $idev and $oino eq $iino
!ll&&!rl&&r
001
MC/DC0%0/2
$odev == $idev and $oino eq $iino
$odev == $idev $oino eq $iino
Truth table33%1/3
A and B
A= $odev == $idevB= $oino eq $iino
ABresult
0X0
100
111
1361 1 ▶ warn "$origcmd is the same as $interpreter, leaving alone"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 1 1
1362 if $Verbose;
1363 1 $interpreter = $origcmd;
1364 }
1365 }
1366 }
1367 }
1368  
1369 # Figure out how to invoke interpreter on this machine.
1370  
1371 7 my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/;
1372 7 my ($shb) = "";
1373 7 ▶ if ($interpreter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($interpreter) { } 6 1 7
1374 6 ▶ print "Changing sharpbang in $file to $interpreter"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 6 6
1375 if $Verbose;
1376 # this is probably value-free on DOSISH platforms
1377 6 ▶ if ($does_shbang) {
Branch: 1 branch
BranchTrueFalseTotal
if ($does_shbang) 6 0 6
1378 6 $shb .= "$Config{'sharpbang'}$interpreter";
1379 6 ▶ $shb .= ' ' . $arg if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 4 2 6
1380 6 $shb .= "\n";
1381 }
1382 }
1383 else {
1384 1 ▶ warn "Can't find $cmd in PATH, $file unchanged"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 1 1
1385 if $Verbose;
1386 1 return;
1387 }
1388 6 return $shb
1389 }
1390  
1391 =item force (o)
1392  
1393 Writes an empty FORCE: target.
1394  
1395 =cut
1396  
1397 217 ▶sub force {
Subroutine force: called CC=1 SCAR=0.0
Pod documented
1398 217 my($self) = shift;
1399 217 '# Phony target to force checking subdirectories.
1400 FORCE :
1401 $(NOECHO) $(NOOP)
1402 ';
1403 }
1404  
1405 =item guess_name
1406  
1407 Guess the name of this package by examining the working directory's
1408 name. MakeMaker calls this only if the developer has not supplied a
1409 NAME attribute.
1410  
1411 =cut
1412  
1413 # ';
1414  
1415 0 ▶sub guess_name {
Subroutine guess_name: not called CC=1 SCAR=2.2
Pod documented
1416 0 my($self) = @_;
1417 96 ▶ use Cwd 'cwd';
Subroutine BEGIN: called CC=1 SCAR=0.0
1418 0 my $name = basename(cwd());
1419 0 $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we
1420 # strip minus or underline
1421 # followed by a float or some such
1422 0 print "Warning: Guessing NAME [$name] from current directory name.\n";
1423 0 $name;
1424 }
1425  
1426 =item has_link_code
1427  
1428 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1429 object that need a compiler. Does not descend into subdirectories as
1430 needs_linking() does.
1431  
1432 =cut
1433  
1434 1111 ▶sub has_link_code {
Subroutine has_link_code: called CC=6 SCAR=17.9
Pod documented
1435 1111 my($self) = shift;
1436 1111 ▶ return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"HAS_LINK_CODE"} 888 223 1111
1437 223 ▶ if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"OBJECT"} or @{$self->{"C"} or [];} or $self->{"MYEXTLIB"}) 24 199 223
Condition88%8/9
$self->{"OBJECT"} or @{$self->{"C"} or [];} or $self->{"MYEXTLIB"}
l!l&&r!l&&!r
231199
$self->{"OBJECT"} or @{$self->{"C"} or [];}
l!l&&r!l&&!r
221200
$self->{'C'} || []
l!l
21920
MC/DC100%3/3
$self->{"OBJECT"} or @{$self->{"C"} or [];} or $self->{"MYEXTLIB"}
$self->{"OBJECT"} @{$self->{"C"} or [];} $self->{"MYEXTLIB"}
MC/DC100%1/1
$self->{'C'} || []
$self->{'C'}
Truth table100%4/4
A or B or C
A= $self->{"OBJECT"}B= @{$self->{"C"} or [];}C= $self->{"MYEXTLIB"}
ABCresult
1XX1
01X1
0011
0000
Truth table100%2/2
A
A= $self->{'C'}
Aresult
11
00
1438 24 $self->{HAS_LINK_CODE} = 1;
1439 24 return 1;
1440 }
1441 199 return $self->{HAS_LINK_CODE} = 0;
1442 }
1443  
1444  
1445 =item init_dirscan
1446  
1447 Scans the directory structure and initializes DIR, XS, XS_FILES,
1448 C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
1449  
1450 Called by init_main.
1451  
1452 =cut
1453  
1454 219 ▶sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
Subroutine init_dirscan: called CC=36 SCAR=44.7
Pod documented
1455 219 my($self) = @_;
1456 219 my(%dir, %xs, %c, %o, %h, %pl_files, %pm);
1457  
1458 219 my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t);
1459  
1460 # ignore the distdir
1461 $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1
1462 219 ▶ : $ignore{$self->{DISTVNAME}} = 1;
Branch: 1 branch
BranchTrueFalseTotal
$Is{'VMS'} ? : 0 219 219
1463  
1464 219 ▶ my $distprefix = $Is{VMS} ? qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+\.dir$/i
Branch: 1 branch
BranchTrueFalseTotal
$Is{'VMS'} ? : 0 219 219
1465 : qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+$/;
1466  
1467 219 ▶ @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 219 219
1468  
1469 219 ▶ if ( defined $self->{XS} and !defined $self->{C} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"XS"} and not defined $self->{"C"}) 0 219 219
Condition33%1/3
defined $self->{"XS"} and not defined $self->{"C"}
!ll&&!rl&&r
21900
MC/DC0%0/2
defined $self->{"XS"} and not defined $self->{"C"}
defined $self->{"XS"} not defined $self->{"C"}
Truth table33%1/3
A and not(B)
A= defined $self->{"XS"}B= not defined $self->{"C"}
ABresult
0X0
100
111
1470 0 my @c_files = grep { m/\.c(pp|xx)?\z/i } values %{$self->{XS}};
1471 0 my @o_files = grep { m/(?:.(?:o(?:bj)?)|\$\(OBJ_EXT\))\z/i } values %{$self->{XS}};
1472 0 %c = map { $_ => 1 } @c_files;
1473 0 %o = map { $_ => 1 } @o_files;
1474 }
1475  
1476 219 foreach my $name ($self->lsdir($Curdir)){
1477 1742 ▶ next if $name =~ /\#/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /\#/ 0 1742 1742
1478 1742 ▶ next if $name =~ $distprefix && -d $name;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /$distprefix/ and -d $name 4 1738 1742
Condition66%2/3
$name =~ /$distprefix/ and -d $name
!ll&&!rl&&r
173804
MC/DC50%1/2
$name =~ /$distprefix/ and -d $name
$name =~ /$distprefix/ -d $name
Truth table66%2/3
A and B
A= $name =~ /$distprefix/B= -d $name
ABresult
0X0
100
111
1479 1738 ▶ if ($Is{VMS}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"}) 0 1738 1738
1480 0 $name = lc($name);
1481 0 ▶ $name = $Curdir if $name eq '.'; # don't confuse '.;1' with magic directory '.'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "." 0 0 0
1482 }
1483 1738 ▶ next if $name eq $Curdir or $name eq $Updir or $ignore{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $name eq $Curdir or $name eq $Updir or $ignore{$name} 860 878 1738
Condition100%6/6
$name eq $Curdir or $name eq $Updir or $ignore{$name}
l!l&&r!l&&!r
438422878
$name eq $Curdir or $name eq $Updir
l!l&&r!l&&!r
2192191300
MC/DC100%3/3
$name eq $Curdir or $name eq $Updir or $ignore{$name}
$name eq $Curdir $name eq $Updir $ignore{$name}
Truth table100%4/4
A or B or C
A= $name eq $CurdirB= $name eq $UpdirC= $ignore{$name}
ABCresult
1XX1
01X1
0011
0000
1484 878 ▶ next unless $self->libscan($name);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->libscan($name) 4 874 878
1485 874 ▶ if (-d $name){
Branch: 7 branches
BranchTrueFalseTotal
if (-d $name) { } 404 470 874
elsif ($name =~ /\.xs\z/) { } 13 457 470
elsif ($name =~ /\.c(pp|xx|c)?\z/i) { } 2 455 457
elsif ($name =~ /\.h\z/i) { } 0 455 455
elsif ($name =~ /\.PL\z/) { } 7 448 455
elsif ($Is{'VMS'} || $Is{'Dos'} and $name =~ /[._]pl$/i) { } 0 448 448
elsif ($name =~ /\.(p[ml]|pod)\z/) { } 14 434 448
1486 404 ▶ next if -l $name; # We do not support symlinks at all
Branch: 1 branch
BranchTrueFalseTotal
if -l $name 0 404 404
1487 404 ▶ next if $self->{NORECURS};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"NORECURS"} 1 403 404
1488 403 ▶ $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
Branch: 1 branch
BranchTrueFalseTotal
if -f $self->catfile($name, "Makefile.PL") 80 323 403
1489 } elsif ($name =~ /\.xs\z/){
1490 13 my($c); ($c = $name) =~ s/\.xs\z/.c/;
1491 13 $xs{$name} = $c;
1492 13 $c{$c} = 1;
1493 } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc
1494 2 ▶ $c{$name} = 1
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /perlmain\.c/ 2 0 2
1495 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1496 } elsif ($name =~ /\.h\z/i){
1497 0 $h{$name} = 1;
1498 } elsif ($name =~ /\.PL\z/) {
1499 7 ($pl_files{$name} = $name) =~ s/\.PL\z// ;
1500 ▶ } elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) {
Condition33%2/6
$Is{"VMS"} || $Is{"Dos"} and $name =~ /[._]pl$/i
!ll&&!rl&&r
44800
$Is{"VMS"} or $Is{"Dos"}
l!l&&r!l&&!r
00448
MC/DC0%0/3
$Is{"VMS"} || $Is{"Dos"} and $name =~ /[._]pl$/i
$Is{"VMS"} $Is{"Dos"} $name =~ /[._]pl$/i
Truth table20%1/5
A or B and C
A= $Is{"VMS"}B= $Is{"Dos"}C= $name =~ /[._]pl$/i
ABCresult
00X0
1X00
0100
1X11
0111
1501 # case-insensitive filesystem, one dot per name, so foo.h.PL
1502 # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos
1503 0 local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl;
1504 0 ▶ if ($txt =~ /Extracting \S+ \(with variable substitutions/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($txt =~ /Extracting \S+ \(with variable substitutions/) { } 0 0 0
1505 0 ($pl_files{$name} = $name) =~ s/[._]pl\z//i ;
1506 }
1507 else {
1508 0 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1509 }
1510 } elsif ($name =~ /\.(p[ml]|pod)\z/){
1511 14 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1512 }
1513 }
1514  
1515 219 ▶ $self->{PL_FILES} ||= \%pl_files;
Condition100%2/2
$self->{"PL_FILES"} ||= \%pl_files
l!l
1218
MC/DC100%1/1
$self->{"PL_FILES"} ||= \%pl_files
$self->{"PL_FILES"}
Truth table100%2/2
A
A= $self->{"PL_FILES"}
Aresult
11
00
1516 219 ▶ $self->{DIR} ||= [sort keys %dir];
Condition100%2/2
$self->{"DIR"} ||= [sort(keys %dir)]
l!l
1218
MC/DC100%1/1
$self->{"DIR"} ||= [sort(keys %dir)]
$self->{"DIR"}
Truth table100%2/2
A
A= $self->{"DIR"}
Aresult
11
00
1517 219 ▶ $self->{XS} ||= \%xs;
Condition50%1/2
$self->{"XS"} ||= \%xs
l!l
0219
MC/DC0%0/1
$self->{"XS"} ||= \%xs
$self->{"XS"}
Truth table50%1/2
A
A= $self->{"XS"}
Aresult
11
00
1518 219 ▶ $self->{C} ||= [sort keys %c];
Condition66%2/3
$self->{"C"} ||= [sort(keys %c)]
l!l
12180
MC/DC100%1/1
$self->{"C"} ||= [sort(keys %c)]
$self->{"C"}
Truth table100%2/2
A
A= $self->{"C"}
Aresult
11
00
1519 219 ▶ $self->{H} ||= [sort keys %h];
Condition50%1/2
$self->{"H"} ||= [sort(keys %h)]
l!l
0219
MC/DC0%0/1
$self->{"H"} ||= [sort(keys %h)]
$self->{"H"}
Truth table50%1/2
A
A= $self->{"H"}
Aresult
11
00
1520 219 ▶ $self->{PM} ||= \%pm;
Condition66%2/3
$self->{"PM"} ||= \%pm
l!l
12180
MC/DC100%1/1
$self->{"PM"} ||= \%pm
$self->{"PM"}
Truth table100%2/2
A
A= $self->{"PM"}
Aresult
11
00
1521  
1522 219 my @o_files = @{$self->{C}};
1523 219 %o = (%o, map { $_ => 1 } grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files);
1524 219 $self->{O_FILES} = [sort keys %o];
1525 }
1526  
1527  
1528 =item init_MANPODS
1529  
1530 Determines if man pages should be generated and initializes MAN1PODS
1531 and MAN3PODS as appropriate.
1532  
1533 =cut
1534  
1535 219 ▶sub init_MANPODS {
Subroutine init_MANPODS: called CC=9 SCAR=22.0
Pod documented
1536 219 my $self = shift;
1537  
1538 # Set up names of manual pages to generate from pods
1539 219 foreach my $man (qw(MAN1 MAN3)) {
1540 438 ▶ if ( $self->{"${man}PODS"}
Branch: 1 branch
BranchTrueFalseTotal
if ($$self{"${man}PODS"} or $$self{"INSTALL${man}DIR"} =~ /^(none|\s*)$/) { } 357 81 438
Condition100%3/3
$$self{"${man}PODS"} or $$self{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
l!l&&r!l&&!r
435381
MC/DC100%2/2
$$self{"${man}PODS"} or $$self{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
$$self{"${man}PODS"} $$self{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
Truth table100%3/3
A or B
A= $$self{"${man}PODS"}B= $$self{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
ABresult
1X1
011
000
1541 or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
1542 ) {
1543 357 ▶ $self->{"${man}PODS"} ||= {};
Condition66%2/3
$$self{"${man}PODS"} ||= {}
l!l
43530
MC/DC100%1/1
$$self{"${man}PODS"} ||= {}
$$self{"${man}PODS"}
Truth table100%2/2
A
A= $$self{"${man}PODS"}
Aresult
11
00
1544 }
1545 else {
1546 81 my $init_method = "init_${man}PODS";
1547 81 $self->$init_method();
1548 }
1549 }
1550  
1551 # logic similar to picking man${num}ext in perl's Configure script
1552 219 foreach my $num (1,3) {
1553 438 my $installdirs = uc $self->{INSTALLDIRS};
1554 438 ▶ $installdirs = '' if $installdirs eq 'PERL';
Branch: 1 branch
BranchTrueFalseTotal
if $installdirs eq "PERL" 2 436 438
1555 my @mandirs = File::Spec->splitdir( $self->_expand_macros(
1556 438 $self->{ "INSTALL${installdirs}MAN${num}DIR" } ) );
1557 438 my $mandir = pop @mandirs;
1558 438 my $section = $num;
1559  
1560 438 foreach ($num, "${num}p", "${num}pm", qw< l n o C L >, "L$num") {
1561 3757 ▶ if ( $mandir =~ /^(?:man|cat)$_$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mandir =~ /^(?:man|cat)$_$/) 48 3709 3757
1562 48 $section = $_;
1563 48 last;
1564 }
1565 }
1566  
1567 438 $self->{"MAN${num}SECTION"} = $section;
1568 }
1569 }
1570  
1571  
1572 42 ▶sub _has_pod {
Subroutine _has_pod: called CC=4 SCAR=13.9
1573 42 my($self, $file) = @_;
1574  
1575 42 my($ispod)=0;
1576 42 ▶ if (open( my $fh, '<', $file )) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, '<', $file) { } 42 0 42
1577 42 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 211 20 231
1578 211 ▶ if (/^=(?:head\d+|item|pod)\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^=(?:head\d+|item|pod)\b/) 22 189 211
1579 22 $ispod=1;
1580 22 last;
1581 }
1582 }
1583 42 close $fh;
1584 } else {
1585 # If it doesn't exist yet, we assume, it has pods in it
1586 0 $ispod = 1;
1587 }
1588  
1589 42 return $ispod;
1590 }
1591  
1592  
1593 =item init_MAN1PODS
1594  
1595 Initializes MAN1PODS from the list of EXE_FILES.
1596  
1597 =cut
1598  
1599 40 ▶sub init_MAN1PODS {
Subroutine init_MAN1PODS: called CC=4 SCAR=13.9
Pod documented
1600 40 my($self) = @_;
1601  
1602 40 ▶ if ( exists $self->{EXE_FILES} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"EXE_FILES"}) 1 39 40
1603 1 foreach my $name (@{$self->{EXE_FILES}}) {
1604 1 ▶ next unless $self->_has_pod($name);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_has_pod($name) 0 1 1
1605  
1606 1 $self->{MAN1PODS}->{$name} =
1607 $self->catfile("\$(INST_MAN1DIR)",
1608 basename($name).".\$(MAN1EXT)");
1609 }
1610 }
1611 }
1612  
1613  
1614 =item init_MAN3PODS
1615  
1616 Initializes MAN3PODS from the list of PM files.
1617  
1618 =cut
1619  
1620 41 ▶sub init_MAN3PODS {
Subroutine init_MAN3PODS: called CC=10 SCAR=26.2
Pod documented
1621 41 my $self = shift;
1622  
1623 41 my %manifypods = (); # we collect the keys first, i.e. the files
1624 # we have to convert to pod
1625  
1626 41 foreach my $name (keys %{$self->{PM}}) {
1627 41 ▶ if ($name =~ /\.pod\z/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /\.pod\z/) { } 0 41 41
elsif ($name =~ /\.p[ml]\z/) { } 41 0 41
1628 0 $manifypods{$name} = $self->{PM}{$name};
1629 } elsif ($name =~ /\.p[ml]\z/ ) {
1630 41 ▶ if( $self->_has_pod($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_has_pod($name)) 21 20 41
1631 21 $manifypods{$name} = $self->{PM}{$name};
1632 }
1633 }
1634 }
1635  
1636 41 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1637  
1638 # Remove "Configure.pm" and similar, if it's not the only pod listed
1639 # To force inclusion, just name it "Configure.pod", or override
1640 # MAN3PODS
1641 41 foreach my $name (keys %manifypods) {
1642 21 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PERL_CORE"} and $name =~ /(config|setup).*\.pm/is or $name =~ /^README\.pod$/i) 0 21 21
Condition33%2/6
$self->{"PERL_CORE"} and $name =~ /(config|setup).*\.pm/is or $name =~ /^README\.pod$/i
l!l&&r!l&&!r
0021
$self->{"PERL_CORE"} and $name =~ /(config|setup).*\.pm/is
!ll&&!rl&&r
2100
MC/DC0%0/3
$self->{"PERL_CORE"} and $name =~ /(config|setup).*\.pm/is or $name =~ /^README\.pod$/i
$self->{"PERL_CORE"} $name =~ /(config|setup).*\.pm/is $name =~ /^README\.pod$/i
Truth table20%1/5
A and B or C
A= $self->{"PERL_CORE"}B= $name =~ /(config|setup).*\.pm/isC= $name =~ /^README\.pod$/i
ABCresult
11X1
0X11
1011
0X00
1000
1643 ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) or
1644 ( $name =~ m/^README\.pod$/i ) # don't manify top-level README.pod
1645 ) {
1646 0 delete $manifypods{$name};
1647 0 next;
1648 }
1649 21 my($manpagename) = $name;
1650 21 $manpagename =~ s/\.p(od|m|l)\z//;
1651 # everything below lib is ok
1652 21 ▶ unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($manpagename =~ s/^\W*($parentlibs_re)\W+//s) 0 21 21
1653 $manpagename = $self->catfile(
1654 0 split(/::/,$self->{PARENT_NAME}),$manpagename
1655 );
1656 }
1657 21 $manpagename = $self->replace_manpage_separator($manpagename);
1658 21 $self->{MAN3PODS}->{$name} =
1659 $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)");
1660 }
1661 }
1662  
1663  
1664 =item init_PM
1665  
1666 Initializes PMLIBDIRS and PM from PMLIBDIRS.
1667  
1668 =cut
1669  
1670 219 ▶sub init_PM {
Subroutine init_PM: called CC=11 SCAR=24.6
Pod documented
1671 219 my $self = shift;
1672  
1673 # Some larger extensions often wish to install a number of *.pm/pl
1674 # files into the library in various locations.
1675  
1676 # The attribute PMLIBDIRS holds an array reference which lists
1677 # subdirectories which we should search for library files to
1678 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1679 # recursively search through the named directories (skipping any
1680 # which don't exist or contain Makefile.PL files).
1681  
1682 # For each *.pm or *.pl file found $self->libscan() is called with
1683 # the default installation path in $_[1]. The return value of
1684 # libscan defines the actual installation location. The default
1685 # libscan function simply returns the path. The file is skipped
1686 # if libscan returns false.
1687  
1688 # The default installation location passed to libscan in $_[1] is:
1689 #
1690 # ./*.pm => $(INST_LIBDIR)/*.pm
1691 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1692 # ./lib/... => $(INST_LIB)/...
1693 #
1694 # In this way the 'lib' directory is seen as the root of the actual
1695 # perl library whereas the others are relative to INST_LIBDIR
1696 # (which includes PARENT_NAME). This is a subtle distinction but one
1697 # that's important for nested modules.
1698  
1699 219 ▶ unless( $self->{PMLIBDIRS} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"PMLIBDIRS"}) 219 0 219
1700 219 ▶ if( $Is{VMS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{'VMS'}) { } 0 219 219
1701 # Avoid logical name vs directory collisions
1702 0 $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"];
1703 }
1704 else {
1705 219 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}];
1706 }
1707 }
1708  
1709 #only existing directories that aren't in $dir are allowed
1710  
1711 # Avoid $_ wherever possible:
1712 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1713 219 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1714 219 @{$self->{PMLIBDIRS}} = ();
1715 219 my %dir = map { ($_ => $_) } @{$self->{DIR}};
1716 219 foreach my $pmlibdir (@pmlibdirs) {
1717 438 ▶ -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
Branch: 1 branch
BranchTrueFalseTotal
-d $pmlibdir and not $dir{$pmlibdir} and push @{$$self{"PMLIBDIRS"};}, $pmlibdir 165 273 438
Condition66%2/3
-d $pmlibdir and not $dir{$pmlibdir}
!ll&&!rl&&r
2730165
MC/DC50%1/2
-d $pmlibdir and not $dir{$pmlibdir}
-d $pmlibdir not $dir{$pmlibdir}
Truth table66%2/3
A and not(B)
A= -d $pmlibdirB= not $dir{$pmlibdir}
ABresult
0X0
100
111
1718 }
1719  
1720 219 ▶ unless( $self->{PMLIBPARENTDIRS} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"PMLIBPARENTDIRS"}) 219 0 219
1721 219 @{$self->{PMLIBPARENTDIRS}} = ('lib');
1722 }
1723  
1724 219 ▶ return if $self->{PM} and $self->{ARGS}{PM};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PM"} and $self->{"ARGS"}{"PM"} 1 218 219
Condition66%2/3
$self->{"PM"} and $self->{"ARGS"}{"PM"}
!ll&&!rl&&r
02181
MC/DC50%1/2
$self->{"PM"} and $self->{"ARGS"}{"PM"}
$self->{"PM"} $self->{"ARGS"}{"PM"}
Truth table66%2/3
A and B
A= $self->{"PM"}B= $self->{"ARGS"}{"PM"}
ABresult
0X0
100
111
1725  
1726 218 ▶ if (@{$self->{PMLIBDIRS}}){
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{"PMLIBDIRS"};}) 164 54 218
1727 0 ▶ print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 164 164
1728 if ($Verbose >= 2);
1729 164 require File::Find;
1730 518 ▶ File::Find::find(sub {
Subroutine __ANON__: called CC=12 SCAR=25.5
1731 518 ▶ if (-d $_){
Branch: 1 branch
BranchTrueFalseTotal
if (-d $_) 327 191 518
1732 327 ▶ unless ($self->libscan($_)){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->libscan($_)) 0 327 327
1733 0 $File::Find::prune = 1;
1734 }
1735 327 return;
1736 }
1737 191 ▶ return if /\#/;
Branch: 1 branch
BranchTrueFalseTotal
if /\#/ 0 191 191
1738 191 ▶ return if /~$/; # emacs temp files
Branch: 1 branch
BranchTrueFalseTotal
if /~$/ 0 191 191
1739 191 ▶ return if /,v$/; # RCS files
Branch: 1 branch
BranchTrueFalseTotal
if /,v$/ 0 191 191
1740 191 ▶ return if m{\.swp$}; # vim swap files
Branch: 1 branch
BranchTrueFalseTotal
if /\.swp$/ 0 191 191
1741  
1742 191 my $path = $File::Find::name;
1743 191 my $prefix = $self->{INST_LIBDIR};
1744 191 my $striplibpath;
1745  
1746 191 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1747 $prefix = $self->{INST_LIB}
1748 191 ▶ if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W}
Branch: 1 branch
BranchTrueFalseTotal
if ($striplibpath = $path) =~ s/^(\W*)($parentlibs_re)\W/$1/i 191 0 191
1749 {$1}i;
1750  
1751 191 my($inst) = $self->catfile($prefix,$striplibpath);
1752 191 local($_) = $inst; # for backwards compatibility
1753 191 $inst = $self->libscan($inst);
1754 191 ▶ print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 191 191
1755 191 ▶ return unless $inst;
Branch: 1 branch
BranchTrueFalseTotal
unless $inst 0 191 191
1756 191 ▶ if ($self->{XSMULTI} and $inst =~ /\.xs\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'XSMULTI'} and $inst =~ /\.xs\z/) { } 10 181 191
Condition100%3/3
$self->{"XSMULTI"} and $inst =~ /\.xs\z/
!ll&&!rl&&r
1592210
MC/DC100%2/2
$self->{"XSMULTI"} and $inst =~ /\.xs\z/
$self->{"XSMULTI"} $inst =~ /\.xs\z/
Truth table100%3/3
A and B
A= $self->{"XSMULTI"}B= $inst =~ /\.xs\z/
ABresult
0X0
100
111
1757 10 my($base); ($base = $path) =~ s/\.xs\z//;
1758 10 $self->{XS}{$path} = "$base.c";
1759 10 push @{$self->{C}}, "$base.c";
1760 10 push @{$self->{O_FILES}}, "$base$self->{OBJ_EXT}";
1761 } else {
1762 181 $self->{PM}{$path} = $inst;
1763 }
1764 164 }, @{$self->{PMLIBDIRS}});
1765 }
1766 }
1767  
1768  
1769 =item init_DIRFILESEP
1770  
1771 Using / for Unix. Called by init_main.
1772  
1773 =cut
1774  
1775 219 ▶sub init_DIRFILESEP {
Subroutine init_DIRFILESEP: called CC=1 SCAR=0.0
Pod documented
1776 219 my($self) = shift;
1777  
1778 219 $self->{DIRFILESEP} = '/';
1779 }
1780  
1781  
1782 =item init_main
1783  
1784 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
1785 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
1786 INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
1787 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
1788 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
1789 VERSION_SYM, XS_VERSION.
1790  
1791 =cut
1792  
1793 219 ▶sub init_main {
Subroutine init_main: called CC=48 SCAR=51.5
Pod documented
1794 219 my($self) = @_;
1795  
1796 # --- Initialize Module Name and Paths
1797  
1798 # NAME = Foo::Bar::Oracle
1799 # FULLEXT = Foo/Bar/Oracle
1800 # BASEEXT = Oracle
1801 # PARENT_NAME = Foo::Bar
1802 ### Only UNIX:
1803 ### ($self->{FULLEXT} =
1804 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1805 219 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1806  
1807  
1808 # Copied from DynaLoader:
1809  
1810 219 my(@modparts) = split(/::/,$self->{NAME});
1811 219 my($modfname) = $modparts[-1];
1812  
1813 # Some systems have restrictions on files names for DLL's etc.
1814 # mod2fname returns appropriate file base name (typically truncated)
1815 # It may also edit @modparts if required.
1816 # We require DynaLoader to make sure that mod2fname is loaded
1817 219 eval { require DynaLoader };
1818 219 ▶ if (defined &DynaLoader::mod2fname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &DynaLoader::mod2fname) 0 219 219
1819 0 $modfname = &DynaLoader::mod2fname(\@modparts);
1820 }
1821  
1822 219 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ;
1823 219 ▶ $self->{PARENT_NAME} ||= '';
Condition66%2/3
$self->{"PARENT_NAME"} ||= ""
l!l
21180
MC/DC100%1/1
$self->{"PARENT_NAME"} ||= ""
$self->{"PARENT_NAME"}
Truth table100%2/2
A
A= $self->{"PARENT_NAME"}
Aresult
11
00
1824  
1825 219 ▶ if (defined &DynaLoader::mod2fname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &DynaLoader::mod2fname) { } 0 219 219
1826 # As of 5.001m, dl_os2 appends '_'
1827 0 $self->{DLBASE} = $modfname;
1828 } else {
1829 219 $self->{DLBASE} = '$(BASEEXT)';
1830 }
1831  
1832  
1833 # --- Initialize PERL_LIB, PERL_SRC
1834  
1835 # *Real* information: where did we get these two from? ...
1836 219 my $inc_config_dir = dirname($INC{'Config.pm'});
1837 219 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1838  
1839 219 ▶ unless ($self->{PERL_SRC}){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"PERL_SRC"}) 219 0 219
1840 219 foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
1841 1752 my $dir = $self->catdir(($Updir) x $dir_count);
1842  
1843 1752 ▶ if (-f $self->catfile($dir,"config_h.SH") &&
Branch: 1 branch
BranchTrueFalseTotal
if (-f $self->catfile($dir, "config_h.SH") and -f $self->catfile($dir, "perl.h") and -f $self->catfile($dir, "lib", "strict.pm")) 0 1752 1752
Condition33%2/6
-f $self->catfile($dir, "config_h.SH") and -f $self->catfile($dir, "perl.h") and -f $self->catfile($dir, "lib", "strict.pm")
!ll&&!rl&&r
175200
-f $self->catfile($dir, "config_h.SH") and -f $self->catfile($dir, "perl.h")
!ll&&!rl&&r
175200
MC/DC0%0/3
-f $self->catfile($dir, "config_h.SH") and -f $self->catfile($dir, "perl.h") and -f $self->catfile($dir, "lib", "strict.pm")
-f $self->catfile($dir, "config_h.SH") -f $self->catfile($dir, "perl.h") -f $self->catfile($dir, "lib", "strict.pm")
Truth table25%1/4
A and B and C
A= -f $self->catfile($dir, "config_h.SH")B= -f $self->catfile($dir, "perl.h")C= -f $self->catfile($dir, "lib", "strict.pm")
ABCresult
0XX0
10X0
1100
1111
1844 -f $self->catfile($dir,"perl.h") &&
1845 -f $self->catfile($dir,"lib","strict.pm")
1846 ) {
1847 0 $self->{PERL_SRC}=$dir ;
1848 0 last;
1849 }
1850 }
1851 }
1852  
1853 warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if
1854 219 ▶ $self->{PERL_CORE} and !$self->{PERL_SRC};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PERL_CORE"} and not $self->{"PERL_SRC"} 0 219 219
Condition33%1/3
$self->{"PERL_CORE"} and not $self->{"PERL_SRC"}
!ll&&!rl&&r
21900
MC/DC0%0/2
$self->{"PERL_CORE"} and not $self->{"PERL_SRC"}
$self->{"PERL_CORE"} not $self->{"PERL_SRC"}
Truth table33%1/3
A and not(B)
A= $self->{"PERL_CORE"}B= not $self->{"PERL_SRC"}
ABresult
0X0
100
111
1855  
1856 219 ▶ if ($self->{PERL_SRC}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'PERL_SRC'}) { } 0 219 219
1857 0 ▶ $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
Condition0%0/3
$self->{"PERL_LIB"} ||= $self->catdir(qq[$self->{"PERL_SRC"}], "lib")
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"PERL_LIB"} ||= $self->catdir(qq[$self->{"PERL_SRC"}], "lib")
$self->{"PERL_LIB"} $self->catdir(qq[$self->{"PERL_SRC"}], "lib")
Truth table0%0/3
A ||= B
A= $self->{"PERL_LIB"}B= $self->catdir(qq[$self->{"PERL_SRC"}], "lib")
ABresult
1X1
011
000
1858  
1859 0 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1860 $self->{PERL_INC} = ($Is{Win32}) ?
1861 0 ▶ $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC};
Branch: 1 branch
BranchTrueFalseTotal
$Is{'Win32'} ? : 0 0 0
1862  
1863 # catch a situation that has occurred a few times in the past:
1864 0 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless (-s $self->catfile($self->{"PERL_SRC"}, "cflags") or $Is{"VMS"} and -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h") or $Is{"Win32"}) 0 0 0
Condition0%0/9
-s $self->catfile($self->{"PERL_SRC"}, "cflags") or $Is{"VMS"} and -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h") or $Is{"Win32"}
l!l&&r!l&&!r
000
-s $self->catfile($self->{"PERL_SRC"}, "cflags") or $Is{"VMS"} and -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h")
l!l&&r!l&&!r
000
$Is{"VMS"} and -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h")
!ll&&!rl&&r
000
MC/DC0%0/4
-s $self->catfile($self->{"PERL_SRC"}, "cflags") or $Is{"VMS"} and -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h") or $Is{"Win32"}
-s $self->catfile($self->{"PERL_SRC"}, "cflags") $Is{"VMS"} -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h") $Is{"Win32"}
Truth table0%0/6
A or B and C or D
A= -s $self->catfile($self->{"PERL_SRC"}, "cflags")B= $Is{"VMS"}C= -s $self->catfile($self->{"PERL_SRC"}, "vmsish.h")D= $Is{"Win32"}
ABCDresult
1XXX1
011X1
00X11
01011
00X00
01000
1865 -s $self->catfile($self->{PERL_SRC},'cflags')
1866 or
1867 $Is{VMS}
1868 &&
1869 -s $self->catfile($self->{PERL_SRC},'vmsish.h')
1870 or
1871 $Is{Win32}
1872 ){
1873 0 warn qq{
1874 You cannot build extensions below the perl source tree after executing
1875 a 'make clean' in the perl source tree.
1876  
1877 To rebuild extensions distributed with the perl source you should
1878 simply Configure (to include those extensions) and then build perl as
1879 normal. After installing perl the source tree can be deleted. It is
1880 not needed for building extensions by running 'perl Makefile.PL'
1881 usually without extra arguments.
1882  
1883 It is recommended that you unpack and build additional extensions away
1884 from the perl source tree.
1885 };
1886 }
1887 } else {
1888 # we should also consider $ENV{PERL5LIB} here
1889 219 ▶ my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC};
Condition66%4/6
$self->{'PERL_LIB'} || $self->{'PERL_ARCHLIB'} || $self->{'PERL_INC'}
l!l&&r!l&&!r
790140
$self->{"PERL_LIB"} or $self->{"PERL_ARCHLIB"}
l!l&&r!l&&!r
079140
MC/DC33%1/3
$self->{'PERL_LIB'} || $self->{'PERL_ARCHLIB'} || $self->{'PERL_INC'}
$self->{"PERL_LIB"} $self->{"PERL_ARCHLIB"} $self->{'PERL_INC'}
Truth table50%2/4
A or B || C
A= $self->{"PERL_LIB"}B= $self->{"PERL_ARCHLIB"}C= $self->{'PERL_INC'}
ABCresult
1XX1
01X1
0011
0000
1890 219 ▶ $self->{PERL_LIB} ||= $Config{privlibexp};
Condition66%2/3
$self->{"PERL_LIB"} ||= $ExtUtils::MM_Unix::Config{"privlibexp"}
l!l&&r!l&&!r
02172
MC/DC50%1/2
$self->{"PERL_LIB"} ||= $ExtUtils::MM_Unix::Config{"privlibexp"}
$self->{"PERL_LIB"} $ExtUtils::MM_Unix::Config{"privlibexp"}
Truth table66%2/3
A ||= B
A= $self->{"PERL_LIB"}B= $ExtUtils::MM_Unix::Config{"privlibexp"}
ABresult
1X1
011
000
1891 219 ▶ $self->{PERL_ARCHLIB} ||= $Config{archlibexp};
Condition100%3/3
$self->{"PERL_ARCHLIB"} ||= $ExtUtils::MM_Unix::Config{"archlibexp"}
l!l&&r!l&&!r
791382
MC/DC100%2/2
$self->{"PERL_ARCHLIB"} ||= $ExtUtils::MM_Unix::Config{"archlibexp"}
$self->{"PERL_ARCHLIB"} $ExtUtils::MM_Unix::Config{"archlibexp"}
Truth table100%3/3
A ||= B
A= $self->{"PERL_ARCHLIB"}B= $ExtUtils::MM_Unix::Config{"archlibexp"}
ABresult
1X1
011
000
1892 219 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1893 219 my $perl_h;
1894  
1895 219 ▶ if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))
Branch: 1 branch
BranchTrueFalseTotal
unless (-f ($perl_h = $self->catfile($self->{"PERL_INC"}, "perl.h")) or $old) 2 217 219
Condition66%2/3
-f ($perl_h = $self->catfile($self->{"PERL_INC"}, "perl.h")) or $old
l!l&&r!l&&!r
21702
MC/DC50%1/2
-f ($perl_h = $self->catfile($self->{"PERL_INC"}, "perl.h")) or $old
-f ($perl_h = $self->catfile($self->{"PERL_INC"}, "perl.h")) $old
Truth table66%2/3
A or B
A= -f ($perl_h = $self->catfile($self->{"PERL_INC"}, "perl.h"))B= $old
ABresult
1X1
011
000
1896 and not $old){
1897 # Maybe somebody tries to build an extension with an
1898 # uninstalled Perl outside of Perl build tree
1899 2 my $lib;
1900 2 for my $dir (@INC) {
1901 16 ▶ $lib = $dir, last if -e $self->catfile($dir, "Config.pm");
Branch: 1 branch
BranchTrueFalseTotal
if -e $self->catfile($dir, "Config.pm") 2 14 16
1902 }
1903 2 ▶ if ($lib) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lib) 2 0 2
1904 # Win32 puts its header files in /perl/src/lib/CORE.
1905 # Unix leaves them in /perl/src.
1906 2 ▶ my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" )
Branch: 1 branch
BranchTrueFalseTotal
$Is{'Win32'} ? : 0 2 2
1907 : dirname $lib;
1908 2 ▶ if (-e $self->catfile($inc, "perl.h")) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $self->catfile($inc, "perl.h")) 0 2 2
1909 0 $self->{PERL_LIB} = $lib;
1910 0 $self->{PERL_ARCHLIB} = $lib;
1911 0 $self->{PERL_INC} = $inc;
1912 0 $self->{UNINSTALLED_PERL} = 1;
1913 0 print <<EOP;
1914 ... Detected uninstalled Perl. Trying to continue.
1915 EOP
1916 }
1917 }
1918 }
1919 }
1920  
1921 219 ▶ if ($Is{Android}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"Android"}) 0 219 219
1922 # Android fun times!
1923 # ../../perl -I../../lib -MFile::Glob -e1 works
1924 # ../../../perl -I../../../lib -MFile::Glob -e1 fails to find
1925 # the .so for File::Glob.
1926 # This always affects core perl, but may also affect an installed
1927 # perl built with -Duserelocatableinc.
1928 0 $self->{PERL_LIB} = File::Spec->rel2abs($self->{PERL_LIB});
1929 0 $self->{PERL_ARCHLIB} = File::Spec->rel2abs($self->{PERL_ARCHLIB});
1930 }
1931 219 $self->{PERL_INCDEP} = $self->{PERL_INC};
1932 219 $self->{PERL_ARCHLIBDEP} = $self->{PERL_ARCHLIB};
1933  
1934 # We get SITELIBEXP and SITEARCHEXP directly via
1935 # Get_from_Config. When we are running standard modules, these
1936 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1937 # set it to "site". I prefer that INSTALLDIRS be set from outside
1938 # MakeMaker.
1939 219 ▶ $self->{INSTALLDIRS} ||= "site";
Condition66%2/3
$self->{"INSTALLDIRS"} ||= "site"
l!l
172020
MC/DC100%1/1
$self->{"INSTALLDIRS"} ||= "site"
$self->{"INSTALLDIRS"}
Truth table100%2/2
A
A= $self->{"INSTALLDIRS"}
Aresult
11
00
1940  
1941 219 ▶ $self->{MAN1EXT} ||= $Config{man1ext};
Condition66%2/3
$self->{"MAN1EXT"} ||= $ExtUtils::MM_Unix::Config{"man1ext"}
l!l&&r!l&&!r
10218
MC/DC50%1/2
$self->{"MAN1EXT"} ||= $ExtUtils::MM_Unix::Config{"man1ext"}
$self->{"MAN1EXT"} $ExtUtils::MM_Unix::Config{"man1ext"}
Truth table66%2/3
A ||= B
A= $self->{"MAN1EXT"}B= $ExtUtils::MM_Unix::Config{"man1ext"}
ABresult
1X1
011
000
1942 219 ▶ $self->{MAN3EXT} ||= $Config{man3ext};
Condition33%1/3
$self->{"MAN3EXT"} ||= $ExtUtils::MM_Unix::Config{"man3ext"}
l!l&&r!l&&!r
00219
MC/DC0%0/2
$self->{"MAN3EXT"} ||= $ExtUtils::MM_Unix::Config{"man3ext"}
$self->{"MAN3EXT"} $ExtUtils::MM_Unix::Config{"man3ext"}
Truth table33%1/3
A ||= B
A= $self->{"MAN3EXT"}B= $ExtUtils::MM_Unix::Config{"man3ext"}
ABresult
1X1
011
000
1943  
1944 # Get some stuff out of %Config if we haven't yet done so
1945 print "CONFIG must be an array ref\n"
1946 219 ▶ if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONFIG"} and ref $self->{"CONFIG"} ne "ARRAY" 0 219 219
Condition33%1/3
$self->{"CONFIG"} and ref $self->{"CONFIG"} ne "ARRAY"
!ll&&!rl&&r
21900
MC/DC0%0/2
$self->{"CONFIG"} and ref $self->{"CONFIG"} ne "ARRAY"
$self->{"CONFIG"} ref $self->{"CONFIG"} ne "ARRAY"
Truth table33%1/3
A and B
A= $self->{"CONFIG"}B= ref $self->{"CONFIG"} ne "ARRAY"
ABresult
0X0
100
111
1947 219 ▶ $self->{CONFIG} = [] unless (ref $self->{CONFIG});
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{"CONFIG"} 219 0 219
1948 219 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1949 0 ▶ push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags};
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Config{"shellflags"} 0 219 219
1950 219 my(%once_only);
1951 219 foreach my $m (@{$self->{CONFIG}}){
1952 5037 ▶ next if $once_only{$m};
Branch: 1 branch
BranchTrueFalseTotal
if $once_only{$m} 0 5037 5037
1953 print "CONFIG key '$m' does not exist in Config.pm\n"
1954 5037 ▶ unless exists $Config{$m};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ExtUtils::MM_Unix::Config{$m} 40 4997 5037
1955 5037 ▶ $self->{uc $m} ||= $Config{$m};
Condition100%3/3
$$self{uc $m} ||= $ExtUtils::MM_Unix::Config{$m}
l!l&&r!l&&!r
4743872691
MC/DC100%2/2
$$self{uc $m} ||= $ExtUtils::MM_Unix::Config{$m}
$$self{uc $m} $ExtUtils::MM_Unix::Config{$m}
Truth table100%3/3
A ||= B
A= $$self{uc $m}B= $ExtUtils::MM_Unix::Config{$m}
ABresult
1X1
011
000
1956 5037 $once_only{$m} = 1;
1957 }
1958  
1959 219 ▶ $self->{AR_STATIC_ARGS} ||= "cr";
Condition50%1/2
$self->{"AR_STATIC_ARGS"} ||= "cr"
l!l
0219
MC/DC0%0/1
$self->{"AR_STATIC_ARGS"} ||= "cr"
$self->{"AR_STATIC_ARGS"}
Truth table50%1/2
A
A= $self->{"AR_STATIC_ARGS"}
Aresult
11
00
1960  
1961 # These should never be needed
1962 219 ▶ $self->{OBJ_EXT} ||= '.o';
Condition100%2/2
$self->{"OBJ_EXT"} ||= ".o"
l!l
2172
MC/DC100%1/1
$self->{"OBJ_EXT"} ||= ".o"
$self->{"OBJ_EXT"}
Truth table100%2/2
A
A= $self->{"OBJ_EXT"}
Aresult
11
00
1963 219 ▶ $self->{LIB_EXT} ||= '.a';
Condition66%2/3
$self->{"LIB_EXT"} ||= ".a"
l!l
21720
MC/DC100%1/1
$self->{"LIB_EXT"} ||= ".a"
$self->{"LIB_EXT"}
Truth table100%2/2
A
A= $self->{"LIB_EXT"}
Aresult
11
00
1964  
1965 219 ▶ $self->{MAP_TARGET} ||= "perl";
Condition100%2/2
$self->{"MAP_TARGET"} ||= "perl"
l!l
79140
MC/DC100%1/1
$self->{"MAP_TARGET"} ||= "perl"
$self->{"MAP_TARGET"}
Truth table100%2/2
A
A= $self->{"MAP_TARGET"}
Aresult
11
00
1966  
1967 219 ▶ $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
Condition50%1/2
$self->{"LIBPERL_A"} ||= qq[libperl$self->{"LIB_EXT"}]
l!l
0219
MC/DC0%0/1
$self->{"LIBPERL_A"} ||= qq[libperl$self->{"LIB_EXT"}]
$self->{"LIBPERL_A"}
Truth table50%1/2
A
A= $self->{"LIBPERL_A"}
Aresult
11
00
1968  
1969 # make a simple check if we find strict
1970 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1971 (strict.pm not found)"
1972 unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") ||
1973 219 ▶ $self->{NAME} eq "ExtUtils::MakeMaker";
Branch: 1 branch
BranchTrueFalseTotal
unless -f $self->catfile(qq[$self->{"PERL_LIB"}], "strict.pm") or $self->{"NAME"} eq "ExtUtils::MakeMaker" 2 217 219
Condition66%2/3
-f $self->catfile(qq[$self->{"PERL_LIB"}], "strict.pm") or $self->{"NAME"} eq "ExtUtils::MakeMaker"
l!l&&r!l&&!r
21702
MC/DC50%1/2
-f $self->catfile(qq[$self->{"PERL_LIB"}], "strict.pm") or $self->{"NAME"} eq "ExtUtils::MakeMaker"
-f $self->catfile(qq[$self->{"PERL_LIB"}], "strict.pm") $self->{"NAME"} eq "ExtUtils::MakeMaker"
Truth table66%2/3
A or B
A= -f $self->catfile(qq[$self->{"PERL_LIB"}], "strict.pm")B= $self->{"NAME"} eq "ExtUtils::MakeMaker"
ABresult
1X1
011
000
1974 }
1975  
1976 =item init_tools
1977  
1978 Initializes tools to use their common (and faster) Unix commands.
1979  
1980 =cut
1981  
1982 220 ▶sub init_tools {
Subroutine init_tools: called CC=15 SCAR=32.2
Pod documented
1983 220 my $self = shift;
1984  
1985 220 ▶ $self->{ECHO} ||= 'echo';
Condition50%1/2
$self->{"ECHO"} ||= "echo"
l!l
0220
MC/DC0%0/1
$self->{"ECHO"} ||= "echo"
$self->{"ECHO"}
Truth table50%1/2
A
A= $self->{"ECHO"}
Aresult
11
00
1986 220 ▶ $self->{ECHO_N} ||= 'echo -n';
Condition50%1/2
$self->{"ECHO_N"} ||= "echo -n"
l!l
0220
MC/DC0%0/1
$self->{"ECHO_N"} ||= "echo -n"
$self->{"ECHO_N"}
Truth table50%1/2
A
A= $self->{"ECHO_N"}
Aresult
11
00
1987 220 ▶ $self->{RM_F} ||= "rm -f";
Condition50%1/2
$self->{"RM_F"} ||= "rm -f"
l!l
0220
MC/DC0%0/1
$self->{"RM_F"} ||= "rm -f"
$self->{"RM_F"}
Truth table50%1/2
A
A= $self->{"RM_F"}
Aresult
11
00
1988 220 ▶ $self->{RM_RF} ||= "rm -rf";
Condition50%1/2
$self->{"RM_RF"} ||= "rm -rf"
l!l
0220
MC/DC0%0/1
$self->{"RM_RF"} ||= "rm -rf"
$self->{"RM_RF"}
Truth table50%1/2
A
A= $self->{"RM_RF"}
Aresult
11
00
1989 220 ▶ $self->{TOUCH} ||= "touch";
Condition50%1/2
$self->{"TOUCH"} ||= "touch"
l!l
0220
MC/DC0%0/1
$self->{"TOUCH"} ||= "touch"
$self->{"TOUCH"}
Truth table50%1/2
A
A= $self->{"TOUCH"}
Aresult
11
00
1990 220 ▶ $self->{TEST_F} ||= "test -f";
Condition50%1/2
$self->{"TEST_F"} ||= "test -f"
l!l
0220
MC/DC0%0/1
$self->{"TEST_F"} ||= "test -f"
$self->{"TEST_F"}
Truth table50%1/2
A
A= $self->{"TEST_F"}
Aresult
11
00
1991 220 ▶ $self->{TEST_S} ||= "test -s";
Condition50%1/2
$self->{"TEST_S"} ||= "test -s"
l!l
0220
MC/DC0%0/1
$self->{"TEST_S"} ||= "test -s"
$self->{"TEST_S"}
Truth table50%1/2
A
A= $self->{"TEST_S"}
Aresult
11
00
1992 220 ▶ $self->{CP} ||= "cp";
Condition50%1/2
$self->{"CP"} ||= "cp"
l!l
0220
MC/DC0%0/1
$self->{"CP"} ||= "cp"
$self->{"CP"}
Truth table50%1/2
A
A= $self->{"CP"}
Aresult
11
00
1993 220 ▶ $self->{MV} ||= "mv";
Condition50%1/2
$self->{"MV"} ||= "mv"
l!l
0220
MC/DC0%0/1
$self->{"MV"} ||= "mv"
$self->{"MV"}
Truth table50%1/2
A
A= $self->{"MV"}
Aresult
11
00
1994 220 ▶ $self->{CHMOD} ||= "chmod";
Condition50%1/2
$self->{"CHMOD"} ||= "chmod"
l!l
0220
MC/DC0%0/1
$self->{"CHMOD"} ||= "chmod"
$self->{"CHMOD"}
Truth table50%1/2
A
A= $self->{"CHMOD"}
Aresult
11
00
1995 220 ▶ $self->{FALSE} ||= 'false';
Condition50%1/2
$self->{"FALSE"} ||= "false"
l!l
0220
MC/DC0%0/1
$self->{"FALSE"} ||= "false"
$self->{"FALSE"}
Truth table50%1/2
A
A= $self->{"FALSE"}
Aresult
11
00
1996 220 ▶ $self->{TRUE} ||= 'true';
Condition50%1/2
$self->{"TRUE"} ||= "true"
l!l
0220
MC/DC0%0/1
$self->{"TRUE"} ||= "true"
$self->{"TRUE"}
Truth table50%1/2
A
A= $self->{"TRUE"}
Aresult
11
00
1997  
1998 220 ▶ $self->{LD} ||= 'ld';
Condition100%2/2
$self->{"LD"} ||= "ld"
l!l
2173
MC/DC100%1/1
$self->{"LD"} ||= "ld"
$self->{"LD"}
Truth table100%2/2
A
A= $self->{"LD"}
Aresult
11
00
1999  
2000 220 return $self->SUPER::init_tools(@_);
2001  
2002 # After SUPER::init_tools so $Config{shell} has a
2003 # chance to get set.
2004 0 ▶ $self->{SHELL} ||= '/bin/sh';
Condition0%0/2
$self->{"SHELL"} ||= "/bin/sh"
l!l
00
MC/DC0%0/1
$self->{"SHELL"} ||= "/bin/sh"
$self->{"SHELL"}
Truth table0%0/2
A
A= $self->{"SHELL"}
Aresult
11
00
2005  
2006 0 return;
2007 }
2008  
2009  
2010 =item init_linker
2011  
2012 Unix has no need of special linker flags.
2013  
2014 =cut
2015  
2016 220 ▶sub init_linker {
Subroutine init_linker: called CC=5 SCAR=19.6
Pod documented
2017 220 my($self) = shift;
2018 220 ▶ $self->{PERL_ARCHIVE} ||= '';
Condition50%1/2
$self->{"PERL_ARCHIVE"} ||= ""
l!l
0220
MC/DC0%0/1
$self->{"PERL_ARCHIVE"} ||= ""
$self->{"PERL_ARCHIVE"}
Truth table50%1/2
A
A= $self->{"PERL_ARCHIVE"}
Aresult
11
00
2019 220 ▶ $self->{PERL_ARCHIVEDEP} ||= '';
Condition33%1/3
$self->{"PERL_ARCHIVEDEP"} ||= ""
l!l
02200
MC/DC0%0/1
$self->{"PERL_ARCHIVEDEP"} ||= ""
$self->{"PERL_ARCHIVEDEP"}
Truth table50%1/2
A
A= $self->{"PERL_ARCHIVEDEP"}
Aresult
11
00
2020 220 ▶ $self->{PERL_ARCHIVE_AFTER} ||= '';
Condition33%1/3
$self->{"PERL_ARCHIVE_AFTER"} ||= ""
l!l
02200
MC/DC0%0/1
$self->{"PERL_ARCHIVE_AFTER"} ||= ""
$self->{"PERL_ARCHIVE_AFTER"}
Truth table50%1/2
A
A= $self->{"PERL_ARCHIVE_AFTER"}
Aresult
11
00
2021 220 ▶ $self->{EXPORT_LIST} ||= '';
Condition33%1/3
$self->{"EXPORT_LIST"} ||= ""
l!l
02200
MC/DC0%0/1
$self->{"EXPORT_LIST"} ||= ""
$self->{"EXPORT_LIST"}
Truth table50%1/2
A
A= $self->{"EXPORT_LIST"}
Aresult
11
00
2022 }
2023  
2024  
2025 =begin _protected
2026  
2027 =item init_lib2arch
2028  
2029 $mm->init_lib2arch
2030  
2031 =end _protected
2032  
2033 =cut
2034  
2035 215 ▶sub init_lib2arch {
Subroutine init_lib2arch: called CC=7 SCAR=30.2
Pod documented
2036 215 my($self) = shift;
2037  
2038 # The user who requests an installation directory explicitly
2039 # should not have to tell us an architecture installation directory
2040 # as well. We look if a directory exists that is named after the
2041 # architecture. If not we take it as a sign that it should be the
2042 # same as the requested installation directory. Otherwise we take
2043 # the found one.
2044 215 for my $libpair ({l=>"privlib", a=>"archlib"},
2045 {l=>"sitelib", a=>"sitearch"},
2046 {l=>"vendorlib", a=>"vendorarch"},
2047 )
2048 {
2049 645 my $lib = "install$libpair->{l}";
2050 645 my $Lib = uc $lib;
2051 645 my $Arch = uc "install$libpair->{a}";
2052 645 ▶ if( $self->{$Lib} && ! $self->{$Arch} ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{$Lib} and not $self->{$Arch}) 0 645 645
Condition33%1/3
$self->{$Lib} and not $self->{$Arch}
!ll&&!rl&&r
64500
MC/DC0%0/2
$self->{$Lib} and not $self->{$Arch}
$self->{$Lib} not $self->{$Arch}
Truth table33%1/3
A and not(B)
A= $self->{$Lib}B= not $self->{$Arch}
ABresult
0X0
100
111
2053 0 my($ilib) = $Config{$lib};
2054  
2055 0 $self->prefixify($Arch,$ilib,$self->{$Lib});
2056  
2057 0 ▶ unless (-d $self->{$Arch}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $self->{$Arch}) 0 0 0
2058 0 ▶ print "Directory $self->{$Arch} not found\n"
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 0 0
2059 if $Verbose;
2060 0 $self->{$Arch} = $self->{$Lib};
2061 }
2062 0 ▶ print "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose 0 0 0
2063 }
2064 }
2065 }
2066  
2067  
2068 =item init_PERL
2069  
2070 $mm->init_PERL;
2071  
2072 Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the
2073 *PERLRUN* permutations.
2074  
2075 PERL is allowed to be miniperl
2076 FULLPERL must be a complete perl
2077  
2078 ABSPERL is PERL converted to an absolute path
2079  
2080 *PERLRUN contains everything necessary to run perl, find it's
2081 libraries, etc...
2082  
2083 *PERLRUNINST is *PERLRUN + everything necessary to find the
2084 modules being built.
2085  
2086 =cut
2087  
2088 220 ▶sub init_PERL {
Subroutine init_PERL: called CC=32 SCAR=42.5
Pod documented
2089 220 my($self) = shift;
2090  
2091 220 my @defpath = ();
2092 220 foreach my $component ($self->{PERL_SRC}, $self->path(),
2093 $Config{binexp})
2094 {
2095 2640 ▶ push @defpath, $component if defined $component;
Branch: 1 branch
BranchTrueFalseTotal
if defined $component 2419 221 2640
2096 }
2097  
2098 # Build up a set of file names (not command names).
2099 220 my $thisperl = $self->canonpath($^X);
2100 $thisperl .= $Config{exe_ext} unless
2101 # VMS might have a file version # at the end
2102 220 ▶ $Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
Branch: 2 branches
BranchTrueFalseTotal
unless $Is{"VMS"} ? $thisperl =~ /$ExtUtils::MM_Unix::Config{"exe_ext"}(;\d+)?$/i : $thisperl =~ /$ExtUtils::MM_Unix::Config{"exe_ext"}$/i 0 220 220
$Is{'VMS'} ? : 0 220 220
2103 : $thisperl =~ m/$Config{exe_ext}$/i;
2104  
2105 # We need a relative path to perl when in the core.
2106 220 ▶ $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PERL_CORE"} 0 220 220
2107  
2108 220 my @perls = ($thisperl);
2109 220 push @perls, map { "$_$Config{exe_ext}" }
2110 ("perl$Config{version}", 'perl5', 'perl');
2111  
2112 # miniperl has priority over all but the canonical perl when in the
2113 # core. Otherwise its a last resort.
2114 220 my $miniperl = "miniperl$Config{exe_ext}";
2115 220 ▶ if( $self->{PERL_CORE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'PERL_CORE'}) { } 0 220 220
2116 0 splice @perls, 1, 0, $miniperl;
2117 }
2118 else {
2119 220 push @perls, $miniperl;
2120 }
2121  
2122 $self->{PERL} ||=
2123 220 ▶ $self->find_perl(5.0, \@perls, \@defpath, $Verbose );
Condition66%2/3
$self->{"PERL"} ||= $self->find_perl(5, \@perls, \@defpath, $ExtUtils::MM_Unix::Verbose)
l!l&&r!l&&!r
941260
MC/DC0%0/2
$self->{"PERL"} ||= $self->find_perl(5, \@perls, \@defpath, $ExtUtils::MM_Unix::Verbose)
$self->{"PERL"} $self->find_perl(5, \@perls, \@defpath, $ExtUtils::MM_Unix::Verbose)
Truth table66%2/3
A ||= B
A= $self->{"PERL"}B= $self->find_perl(5, \@perls, \@defpath, $ExtUtils::MM_Unix::Verbose)
ABresult
1X1
011
000
2124  
2125 220 my $perl = $self->{PERL};
2126 220 $perl =~ s/^"//;
2127 220 my $has_mcr = $perl =~ s/^MCR\s*//;
2128 220 my $perlflags = '';
2129 220 my $stripped_perl;
2130 220 ▶ while ($perl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perl) 241 0 241
2131 241 ($stripped_perl = $perl) =~ s/"$//;
2132 241 ▶ last if -x $stripped_perl;
Branch: 1 branch
BranchTrueFalseTotal
if -x $stripped_perl 220 21 241
2133 21 ▶ last unless $perl =~ s/(\s+\S+)$//;
Branch: 1 branch
BranchTrueFalseTotal
unless $perl =~ s/(\s+\S+)$// 0 21 21
2134 21 $perlflags = $1.$perlflags;
2135 }
2136 220 $self->{PERL} = $stripped_perl;
2137 220 ▶ $self->{PERL} = 'MCR '.$self->{PERL} if $has_mcr || $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $has_mcr or $Is{"VMS"} 0 220 220
Condition33%1/3
$has_mcr or $Is{"VMS"}
l!l&&r!l&&!r
00220
MC/DC0%0/2
$has_mcr or $Is{"VMS"}
$has_mcr $Is{"VMS"}
Truth table33%1/3
A or B
A= $has_mcrB= $Is{"VMS"}
ABresult
1X1
011
000
2138  
2139 # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe.
2140 220 my $perl_name = 'perl';
2141 $perl_name = 'ndbgperl' if $Is{VMS} &&
2142 220 ▶ defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define';
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} and defined $ExtUtils::MM_Unix::Config{"usevmsdebug"} and $ExtUtils::MM_Unix::Config{"usevmsdebug"} eq "define" 0 220 220
Condition33%2/6
$Is{"VMS"} and defined $ExtUtils::MM_Unix::Config{"usevmsdebug"} and $ExtUtils::MM_Unix::Config{"usevmsdebug"} eq "define"
!ll&&!rl&&r
22000
$Is{"VMS"} and defined $ExtUtils::MM_Unix::Config{"usevmsdebug"}
!ll&&!rl&&r
22000
MC/DC0%0/3
$Is{"VMS"} and defined $ExtUtils::MM_Unix::Config{"usevmsdebug"} and $ExtUtils::MM_Unix::Config{"usevmsdebug"} eq "define"
$Is{"VMS"} defined $ExtUtils::MM_Unix::Config{"usevmsdebug"} $ExtUtils::MM_Unix::Config{"usevmsdebug"} eq "define"
Truth table25%1/4
A and B and C
A= $Is{"VMS"}B= defined $ExtUtils::MM_Unix::Config{"usevmsdebug"}C= $ExtUtils::MM_Unix::Config{"usevmsdebug"} eq "define"
ABCresult
0XX0
10X0
1100
1111
2143  
2144 # XXX This logic is flawed. If "miniperl" is anywhere in the path
2145 # it will get confused. It should be fixed to work only on the filename.
2146 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
2147 220 ▶ unless ($self->{FULLPERL}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"FULLPERL"}) 141 79 220
2148 141 ($self->{FULLPERL} = $self->{PERL}) =~ s/\Q$miniperl\E$/$perl_name$Config{exe_ext}/i;
2149 141 $self->{FULLPERL} = qq{"$self->{FULLPERL}"}.$perlflags;
2150 }
2151 # Can't have an image name with quotes, and findperl will have
2152 # already escaped spaces.
2153 220 ▶ $self->{FULLPERL} =~ tr/"//d if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 220 220
2154  
2155 # Little hack to get around VMS's find_perl putting "MCR" in front
2156 # sometimes.
2157 220 $self->{ABSPERL} = $self->{PERL};
2158 220 $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//;
2159 220 ▶ if( $self->file_name_is_absolute($self->{ABSPERL}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->file_name_is_absolute($self->{'ABSPERL'})) { } 220 0 220
2160 220 $self->{ABSPERL} = '$(PERL)';
2161 }
2162 else {
2163 0 $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL});
2164  
2165 # Quote the perl command if it contains whitespace
2166 $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL})
2167 0 ▶ if $self->{ABSPERL} =~ /\s/;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"ABSPERL"} =~ /\s/ 0 0 0
2168  
2169 0 ▶ $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr;
Branch: 1 branch
BranchTrueFalseTotal
if $has_mcr 0 0 0
2170 }
2171 220 $self->{PERL} = qq{"$self->{PERL}"}.$perlflags;
2172  
2173 # Can't have an image name with quotes, and findperl will have
2174 # already escaped spaces.
2175 220 ▶ $self->{PERL} =~ tr/"//d if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 220 220
2176  
2177 # Are we building the core?
2178 220 ▶ $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"PERL_CORE"} 133 87 220
2179 220 ▶ $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"PERL_CORE"} 141 79 220
2180  
2181 # Make sure perl can find itself before it's installed.
2182 my $lib_paths = $self->{UNINSTALLED_PERL} || $self->{PERL_CORE}
2183 220 ▶ ? ( $self->{PERL_ARCHLIB} && $self->{PERL_LIB} && $self->{PERL_ARCHLIB} ne $self->{PERL_LIB} ) ?
Branch: 2 branches
BranchTrueFalseTotal
$self->{'UNINSTALLED_PERL'} || $self->{'PERL_CORE'} ? : 0 220 220
$self->{'PERL_ARCHLIB'} && $self->{'PERL_LIB'} && $self->{'PERL_ARCHLIB'} ne $self->{'PERL_LIB'} ? : 0 0 0
Condition11%1/9
$self->{"UNINSTALLED_PERL"} or $self->{"PERL_CORE"}
l!l&&r!l&&!r
00220
$self->{"PERL_ARCHLIB"} and $self->{"PERL_LIB"} and $self->{"PERL_ARCHLIB"} ne $self->{"PERL_LIB"}
!ll&&!rl&&r
000
$self->{"PERL_ARCHLIB"} and $self->{"PERL_LIB"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"UNINSTALLED_PERL"} or $self->{"PERL_CORE"}
$self->{"UNINSTALLED_PERL"} $self->{"PERL_CORE"}
MC/DC0%0/3
$self->{"PERL_ARCHLIB"} and $self->{"PERL_LIB"} and $self->{"PERL_ARCHLIB"} ne $self->{"PERL_LIB"}
$self->{"PERL_ARCHLIB"} $self->{"PERL_LIB"} $self->{"PERL_ARCHLIB"} ne $self->{"PERL_LIB"}
Truth table33%1/3
A or B
A= $self->{"UNINSTALLED_PERL"}B= $self->{"PERL_CORE"}
ABresult
1X1
011
000
Truth table0%0/4
A and B and C
A= $self->{"PERL_ARCHLIB"}B= $self->{"PERL_LIB"}C= $self->{"PERL_ARCHLIB"} ne $self->{"PERL_LIB"}
ABCresult
0XX0
10X0
1100
1111
2184 q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} : q{ "-I$(PERL_LIB)"}
2185 : undef;
2186 my $inst_lib_paths = $self->{INST_ARCHLIB} ne $self->{INST_LIB}
2187 220 ▶ ? 'RUN)'.$perlflags.' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"'
Branch: 1 branch
BranchTrueFalseTotal
$self->{'INST_ARCHLIB'} ne $self->{'INST_LIB'} ? : 220 0 220
2188 : 'RUN)'.$perlflags.' "-I$(INST_LIB)"';
2189 # How do we run perl?
2190 220 foreach my $perl (qw(PERL FULLPERL ABSPERL)) {
2191 660 my $run = $perl.'RUN';
2192  
2193 660 $self->{$run} = qq{\$($perl)};
2194 660 ▶ $self->{$run} .= $lib_paths if $lib_paths;
Branch: 1 branch
BranchTrueFalseTotal
if $lib_paths 0 660 660
2195  
2196 660 $self->{$perl.'RUNINST'} = '$('.$perl.$inst_lib_paths;
2197 }
2198  
2199 220 return 1;
2200 }
2201  
2202  
2203 =item init_platform
2204  
2205 =item platform_constants
2206  
2207 Add MM_Unix_VERSION.
2208  
2209 =cut
2210  
2211 218 ▶sub init_platform {
Subroutine init_platform: called CC=1 SCAR=0.0
Pod documented
2212 218 my($self) = shift;
2213  
2214 218 $self->{MM_Unix_VERSION} = our $VERSION;
2215 218 $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '.
2216 '-Dfree=Perl_mfree -Drealloc=Perl_realloc '.
2217 '-Dcalloc=Perl_calloc';
2218  
2219 }
2220  
2221 217 ▶sub platform_constants {
Subroutine platform_constants: called CC=3 SCAR=11.0
Pod documented
2222 217 my($self) = shift;
2223 217 my $make_frag = '';
2224  
2225 217 foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF))
2226 {
2227 434 ▶ next unless defined $self->{$macro};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$macro} 0 434 434
2228 434 $make_frag .= "$macro = $self->{$macro}\n";
2229 }
2230  
2231 217 return $make_frag;
2232 }
2233  
2234  
2235 =item init_PERM
2236  
2237 $mm->init_PERM
2238  
2239 Called by init_main. Initializes PERL_*
2240  
2241 =cut
2242  
2243 219 ▶sub init_PERM {
Subroutine init_PERM: called CC=4 SCAR=14.6
Pod documented
2244 219 my($self) = shift;
2245  
2246 219 ▶ $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"PERM_DIR"} 219 0 219
2247 219 ▶ $self->{PERM_RW} = 644 unless defined $self->{PERM_RW};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"PERM_RW"} 219 0 219
2248 219 ▶ $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"PERM_RWX"} 219 0 219
2249  
2250 219 return 1;
2251 }
2252  
2253  
2254 =item init_xs
2255  
2256 $mm->init_xs
2257  
2258 Sets up macros having to do with XS code. Currently just INST_STATIC,
2259 INST_DYNAMIC and INST_BOOT.
2260  
2261 =cut
2262  
2263 219 ▶sub init_xs {
Subroutine init_xs: called CC=8 SCAR=21.0
Pod documented
2264 219 my $self = shift;
2265  
2266 219 ▶ if ($self->has_link_code()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_link_code) { } 21 198 219
2267 $self->{INST_STATIC} =
2268 21 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)');
2269 $self->{INST_DYNAMIC} =
2270 21 $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)');
2271 $self->{INST_BOOT} =
2272 21 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs');
2273 21 ▶ if ($self->{XSMULTI}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"XSMULTI"}) 5 16 21
2274 5 my @exts = $self->_xs_list_basenames;
2275 5 my (@statics, @dynamics, @boots);
2276 5 for my $ext (@exts) {
2277 10 my ($v, $d, $f) = File::Spec->splitpath($ext);
2278 10 my @d = File::Spec->splitdir($d);
2279 10 ▶ shift @d if defined $d[0] and $d[0] eq 'lib';
Branch: 1 branch
BranchTrueFalseTotal
if defined $d[0] and $d[0] eq "lib" 10 0 10
Condition33%1/3
defined $d[0] and $d[0] eq "lib"
!ll&&!rl&&r
0010
MC/DC0%0/2
defined $d[0] and $d[0] eq "lib"
defined $d[0] $d[0] eq "lib"
Truth table33%1/3
A and B
A= defined $d[0]B= $d[0] eq "lib"
ABresult
0X0
100
111
2280 10 ▶ pop @d if $d[$#d] eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $d[$#d] eq "" 10 0 10
2281 10 my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
2282 10 my $instfile = $self->catfile($instdir, $f);
2283 10 push @statics, "$instfile\$(LIB_EXT)";
2284  
2285 # Dynamic library names may need special handling.
2286 10 my $dynfile = $instfile;
2287 10 eval { require DynaLoader };
2288 10 ▶ if (defined &DynaLoader::mod2fname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &DynaLoader::mod2fname) 0 10 10
2289 0 $dynfile = $self->catfile($instdir, &DynaLoader::mod2fname([@d, $f]));
2290 }
2291  
2292 10 push @dynamics, "$dynfile.\$(DLEXT)";
2293 10 push @boots, "$instfile.bs";
2294 }
2295 5 $self->{INST_STATIC} = join ' ', @statics;
2296 5 $self->{INST_DYNAMIC} = join ' ', @dynamics;
2297 5 $self->{INST_BOOT} = join ' ', @boots;
2298 }
2299 } else {
2300 198 $self->{INST_STATIC} = '';
2301 198 $self->{INST_DYNAMIC} = '';
2302 198 $self->{INST_BOOT} = '';
2303 }
2304 }
2305  
2306 =item install (o)
2307  
2308 Defines the install target.
2309  
2310 =cut
2311  
2312 138 ▶sub install {
Subroutine install: called CC=6 SCAR=18.5
Pod documented
2313 138 my($self, %attribs) = @_;
2314 138 my(@m);
2315  
2316 138 push @m, q{
2317 install :: pure_install doc_install
2318 $(NOECHO) $(NOOP)
2319  
2320 install_perl :: pure_perl_install doc_perl_install
2321 $(NOECHO) $(NOOP)
2322  
2323 install_site :: pure_site_install doc_site_install
2324 $(NOECHO) $(NOOP)
2325  
2326 install_vendor :: pure_vendor_install doc_vendor_install
2327 $(NOECHO) $(NOOP)
2328  
2329 pure_install :: pure_$(INSTALLDIRS)_install
2330 $(NOECHO) $(NOOP)
2331  
2332 doc_install :: doc_$(INSTALLDIRS)_install
2333 $(NOECHO) $(NOOP)
2334  
2335 pure__install : pure_site_install
2336 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2337  
2338 doc__install : doc_site_install
2339 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2340  
2341 pure_perl_install :: all
2342 $(NOECHO) $(MOD_INSTALL) \
2343 };
2344  
2345 push @m,
2346 q{ read "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
2347 write "}.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
2348 138 ▶} unless $self->{NO_PACKLIST};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"NO_PACKLIST"} 138 0 138
2349  
2350 138 push @m,
2351 q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
2352 "$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \
2353 "$(INST_BIN)" "$(DESTINSTALLBIN)" \
2354 "$(INST_SCRIPT)" "$(DESTINSTALLSCRIPT)" \
2355 "$(INST_MAN1DIR)" "$(DESTINSTALLMAN1DIR)" \
2356 "$(INST_MAN3DIR)" "$(DESTINSTALLMAN3DIR)"
2357 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2358 "}.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{"
2359  
2360  
2361 pure_site_install :: all
2362 $(NOECHO) $(MOD_INSTALL) \
2363 };
2364 push @m,
2365 q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
2366 write "}.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{" \
2367 138 ▶} unless $self->{NO_PACKLIST};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"NO_PACKLIST"} 138 0 138
2368  
2369 138 push @m,
2370 q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
2371 "$(INST_ARCHLIB)" "$(DESTINSTALLSITEARCH)" \
2372 "$(INST_BIN)" "$(DESTINSTALLSITEBIN)" \
2373 "$(INST_SCRIPT)" "$(DESTINSTALLSITESCRIPT)" \
2374 "$(INST_MAN1DIR)" "$(DESTINSTALLSITEMAN1DIR)" \
2375 "$(INST_MAN3DIR)" "$(DESTINSTALLSITEMAN3DIR)"
2376 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2377 "}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{"
2378  
2379 pure_vendor_install :: all
2380 $(NOECHO) $(MOD_INSTALL) \
2381 };
2382 push @m,
2383 q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
2384 write "}.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{" \
2385 138 ▶} unless $self->{NO_PACKLIST};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"NO_PACKLIST"} 138 0 138
2386  
2387 138 push @m,
2388 q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \
2389 "$(INST_ARCHLIB)" "$(DESTINSTALLVENDORARCH)" \
2390 "$(INST_BIN)" "$(DESTINSTALLVENDORBIN)" \
2391 "$(INST_SCRIPT)" "$(DESTINSTALLVENDORSCRIPT)" \
2392 "$(INST_MAN1DIR)" "$(DESTINSTALLVENDORMAN1DIR)" \
2393 "$(INST_MAN3DIR)" "$(DESTINSTALLVENDORMAN3DIR)"
2394  
2395 };
2396  
2397 push @m, q{
2398 doc_perl_install :: all
2399 $(NOECHO) $(NOOP)
2400  
2401 doc_site_install :: all
2402 $(NOECHO) $(NOOP)
2403  
2404 doc_vendor_install :: all
2405 $(NOECHO) $(NOOP)
2406  
2407 138 ▶} if $self->{NO_PERLLOCAL};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"NO_PERLLOCAL"} 0 138 138
2408  
2409 push @m, q{
2410 doc_perl_install :: all
2411 $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
2412 -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
2413 -$(NOECHO) $(DOC_INSTALL) \
2414 "Module" "$(NAME)" \
2415 "installed into" "$(INSTALLPRIVLIB)" \
2416 LINKTYPE "$(LINKTYPE)" \
2417 VERSION "$(VERSION)" \
2418 EXE_FILES "$(EXE_FILES)" \
2419 >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
2420  
2421 doc_site_install :: all
2422 $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
2423 -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
2424 -$(NOECHO) $(DOC_INSTALL) \
2425 "Module" "$(NAME)" \
2426 "installed into" "$(INSTALLSITELIB)" \
2427 LINKTYPE "$(LINKTYPE)" \
2428 VERSION "$(VERSION)" \
2429 EXE_FILES "$(EXE_FILES)" \
2430 >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
2431  
2432 doc_vendor_install :: all
2433 $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
2434 -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
2435 -$(NOECHO) $(DOC_INSTALL) \
2436 "Module" "$(NAME)" \
2437 "installed into" "$(INSTALLVENDORLIB)" \
2438 LINKTYPE "$(LINKTYPE)" \
2439 VERSION "$(VERSION)" \
2440 EXE_FILES "$(EXE_FILES)" \
2441 >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
2442  
2443 138 ▶} unless $self->{NO_PERLLOCAL};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"NO_PERLLOCAL"} 138 0 138
2444  
2445 138 push @m, q{
2446 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
2447 $(NOECHO) $(NOOP)
2448  
2449 uninstall_from_perldirs ::
2450 $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{"
2451  
2452 uninstall_from_sitedirs ::
2453 $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
2454  
2455 uninstall_from_vendordirs ::
2456 $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
2457 };
2458  
2459 138 join("",@m);
2460 }
2461  
2462 =item installbin (o)
2463  
2464 Defines targets to make and to install EXE_FILES.
2465  
2466 =cut
2467  
2468 217 ▶sub installbin {
Subroutine installbin: called CC=9 SCAR=22.2
Pod documented
2469 217 my($self) = shift;
2470  
2471 217 ▶ return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"EXE_FILES"} and ref $self->{"EXE_FILES"} eq "ARRAY" 199 18 217
Condition66%2/3
$self->{"EXE_FILES"} and ref $self->{"EXE_FILES"} eq "ARRAY"
!ll&&!rl&&r
199018
MC/DC50%1/2
$self->{"EXE_FILES"} and ref $self->{"EXE_FILES"} eq "ARRAY"
$self->{"EXE_FILES"} ref $self->{"EXE_FILES"} eq "ARRAY"
Truth table66%2/3
A and B
A= $self->{"EXE_FILES"}B= ref $self->{"EXE_FILES"} eq "ARRAY"
ABresult
0X0
100
111
2472 18 my @exefiles = sort @{$self->{EXE_FILES}};
2473 18 ▶ return "" unless @exefiles;
Branch: 1 branch
BranchTrueFalseTotal
unless @exefiles 0 18 18
2474  
2475 18 ▶ @exefiles = map vmsify($_), @exefiles if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 18 18
2476  
2477 18 my %fromto;
2478 18 for my $from (@exefiles) {
2479 18 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
2480  
2481 18 local($_) = $path; # for backwards compatibility
2482 18 my $to = $self->libscan($path);
2483 18 ▶ print "libscan($from) => '$to'\n" if ($Verbose >=2);
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 18 18
2484  
2485 18 ▶ $to = vmsify($to) if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 18 18
2486 18 $fromto{$from} = $to;
2487 }
2488 18 my @to = sort values %fromto;
2489  
2490 18 my @m;
2491 18 push(@m, qq{
2492 EXE_FILES = @exefiles
2493  
2494 pure_all :: @to
2495 \$(NOECHO) \$(NOOP)
2496  
2497 realclean ::
2498 });
2499  
2500 # realclean can get rather large.
2501 18 push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to);
2502 18 push @m, "\n";
2503  
2504 # A target for each exe file.
2505 18 my @froms = sort keys %fromto;
2506 18 for my $from (@froms) {
2507 # 1 2
2508 18 push @m, _sprintf562 <<'MAKE', $from, $fromto{$from};
2509 %2$s : %1$s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists
2510 $(NOECHO) $(RM_F) %2$s
2511 $(CP) %1$s %2$s
2512 $(FIXIN) %2$s
2513 -$(NOECHO) $(CHMOD) $(PERM_RWX) %2$s
2514  
2515 MAKE
2516  
2517 }
2518  
2519 18 join "", @m;
2520 }
2521  
2522 =item linkext (o)
2523  
2524 Defines the linkext target which in turn defines the LINKTYPE.
2525  
2526 =cut
2527  
2528 # LINKTYPE => static or dynamic or ''
2529 217 ▶sub linkext {
Subroutine linkext: called CC=5 SCAR=16.2
Pod documented
2530 217 my($self, %attribs) = @_;
2531 217 my $linktype = $attribs{LINKTYPE};
2532 217 ▶ $linktype = $self->{LINKTYPE} unless defined $linktype;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $linktype 215 2 217
2533 217 ▶ if (defined $linktype and $linktype eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $linktype and $linktype eq "") 2 215 217
Condition66%2/3
defined $linktype and $linktype eq ""
!ll&&!rl&&r
02152
MC/DC50%1/2
defined $linktype and $linktype eq ""
defined $linktype $linktype eq ""
Truth table66%2/3
A and B
A= defined $linktypeB= $linktype eq ""
ABresult
0X0
100
111
2534 2 warn "Warning: LINKTYPE set to '', no longer necessary\n";
2535 }
2536 217 ▶ $linktype = '$(LINKTYPE)' unless defined $linktype;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $linktype 0 217 217
2537 217 "
2538 linkext :: $linktype
2539 \$(NOECHO) \$(NOOP)
2540 ";
2541 }
2542  
2543 =item lsdir
2544  
2545 Takes as arguments a directory name and a regular expression. Returns
2546 all entries in the directory that match the regular expression.
2547  
2548 =cut
2549  
2550 325 ▶sub lsdir {
Subroutine lsdir: called CC=4 SCAR=14.0
Pod documented
2551 # $self
2552 325 my(undef, $dir, $regex) = @_;
2553 325 ▶ opendir(my $dh, defined($dir) ? $dir : ".")
Branch: 2 branches
BranchTrueFalseTotal
opendir my $dh, defined $dir ? $dir : "." or return 325 0 325
defined $dir ? : 325 0 325
2554 or return;
2555 325 my @ls = readdir $dh;
2556 325 closedir $dh;
2557 325 ▶ @ls = grep(/$regex/, @ls) if defined $regex;
Branch: 1 branch
BranchTrueFalseTotal
if defined $regex 106 219 325
2558 325 @ls;
2559 }
2560  
2561 =item macro (o)
2562  
2563 Simple subroutine to insert the macros defined by the macro attribute
2564 into the Makefile.
2565  
2566 =cut
2567  
2568 217 ▶sub macro {
Subroutine macro: called CC=2 SCAR=7.6
Pod documented
2569 217 my($self,%attribs) = @_;
2570 217 my @m;
2571 217 foreach my $key (sort keys %attribs) {
2572 0 my $val = $attribs{$key};
2573 0 push @m, "$key = $val\n";
2574 }
2575 217 join "", @m;
2576 }
2577  
2578 =item makeaperl (o)
2579  
2580 Called by staticmake. Defines how to write the Makefile to produce a
2581 static new perl.
2582  
2583 By default the Makefile produced includes all the static extensions in
2584 the perl library. (Purified versions of library files, e.g.,
2585 DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.)
2586  
2587 =cut
2588  
2589 218 ▶sub makeaperl {
Subroutine makeaperl: called CC=37 SCAR=66.3
Pod documented
2590 218 my($self, %attribs) = @_;
2591 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2592 218 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2593 218 ▶ s/^(.*)/"-I$1"/ for @{$perlinc || []};
Condition100%2/2
$perlinc || []
l!l
2171
MC/DC100%1/1
$perlinc || []
$perlinc
Truth table100%2/2
A
A= $perlinc
Aresult
11
00
2594 218 my(@m);
2595 218 push @m, "
2596 # --- MakeMaker makeaperl section ---
2597 MAP_TARGET = $target
2598 FULLPERL = $self->{FULLPERL}
2599 218 ▶MAP_PERLINC = @{$perlinc || []}
Condition100%2/2
$perlinc || []
l!l
2171
MC/DC100%1/1
$perlinc || []
$perlinc
Truth table100%2/2
A
A= $perlinc
Aresult
11
00
2600 ";
2601 218 ▶ return join '', @m if $self->{PARENT};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PARENT"} 79 139 218
2602  
2603 139 my($dir) = join ":", @{$self->{DIR}};
2604  
2605 139 ▶ unless ($self->{MAKEAPERL}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"MAKEAPERL"}) 139 0 139
2606 139 push @m, q{
2607 $(MAP_TARGET) :: $(MAKE_APERL_FILE)
2608 $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
2609  
2610 $(MAKE_APERL_FILE) : static $(FIRST_MAKEFILE) pm_to_blib
2611 $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
2612 $(NOECHO) $(PERLRUNINST) \
2613 Makefile.PL DIR="}, $dir, q{" \
2614 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2615 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
2616  
2617 139 foreach (@ARGV){
2618 14 my $arg = $_; # avoid lvalue aliasing
2619 14 ▶ if ( $arg =~ /(^.*?=)(.*['\s].*)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /(^.*?=)(.*['\s].*)/) 3 11 14
2620 3 $arg = $1 . $self->quote_literal($2);
2621 }
2622 14 push @m, " \\\n\t\t$arg";
2623 }
2624 139 push @m, "\n";
2625  
2626 139 return join '', @m;
2627 }
2628  
2629 0 my $cccmd = $self->const_cccmd($libperl);
2630 0 $cccmd =~ s/^CCCMD\s*=\s*//;
2631 0 $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /;
2632 $cccmd .= " $Config{cccdlflags}"
2633 0 ▶ if ($Config{useshrplib} eq 'true');
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Config{"useshrplib"} eq "true" 0 0 0
2634 0 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
2635  
2636 # The front matter of the linkcommand...
2637 my $linkcmd = join ' ', "\$(CC)",
2638 0 grep($_, @Config{qw(ldflags ccdlflags)});
2639 0 $linkcmd =~ s/\s+/ /g;
2640 0 $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
2641  
2642 # Which *.a files could we make use of...
2643 0 my $staticlib21 = $self->_find_static_libs($searchdirs);
2644 # We trust that what has been handed in as argument, will be buildable
2645 0 ▶ $static = [] unless $static;
Branch: 1 branch
BranchTrueFalseTotal
unless $static 0 0 0
2646 0 @$staticlib21{@{$static}} = (1) x @{$static};
2647  
2648 0 ▶ $extra = [] unless $extra && ref $extra eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless $extra and ref $extra eq "ARRAY" 0 0 0
Condition0%0/3
$extra and ref $extra eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
$extra and ref $extra eq "ARRAY"
$extra ref $extra eq "ARRAY"
Truth table0%0/3
A and B
A= $extraB= ref $extra eq "ARRAY"
ABresult
0X0
100
111
2649 0 for (sort keys %$staticlib21) {
2650 0 ▶ next unless /\Q$self->{LIB_EXT}\E\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless /\Q$self->{"LIB_EXT"}\E\z/ 0 0 0
2651 0 $_ = dirname($_) . "/extralibs.ld";
2652 0 push @$extra, $_;
2653 }
2654  
2655 0 ▶ s/^(.*)/"-I$1"/ for @{$perlinc || []};
Condition0%0/3
$perlinc || []
l!l
000
MC/DC0%0/1
$perlinc || []
$perlinc
Truth table0%0/2
A
A= $perlinc
Aresult
11
00
2656  
2657 0 ▶ $target ||= "perl";
Condition0%0/2
$target ||= "perl"
l!l
00
MC/DC0%0/1
$target ||= "perl"
$target
Truth table0%0/2
A
A= $target
Aresult
11
00
2658 0 ▶ $tmp ||= ".";
Condition0%0/2
$tmp ||= "."
l!l
00
MC/DC0%0/1
$tmp ||= "."
$tmp
Truth table0%0/2
A
A= $tmp
Aresult
11
00
2659  
2660 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2661 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2662 # extralibs.all are computed correctly
2663 0 my @map_static = reverse sort keys %$staticlib21;
2664 push @m, "
2665 MAP_LINKCMD = $linkcmd
2666 0 MAP_STATIC = ", join(" \\\n\t", map { qq{"$_"} } @map_static), "
2667 0 MAP_STATICDEP = ", join(' ', map { $self->quote_dep($_) } @map_static), "
2668  
2669 MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
2670 ";
2671  
2672 0 my $lperl;
2673 0 ▶ if (defined $libperl) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $libperl) 0 0 0
2674 0 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2675 }
2676 0 ▶ unless ($libperl && -f $lperl) { # Ilya's code...
Branch: 1 branch
BranchTrueFalseTotal
unless ($libperl and -f $lperl) 0 0 0
Condition0%0/3
$libperl and -f $lperl
!ll&&!rl&&r
000
MC/DC0%0/2
$libperl and -f $lperl
$libperl -f $lperl
Truth table0%0/3
A and B
A= $libperlB= -f $lperl
ABresult
0X0
100
111
2677 0 ▶ my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
Condition0%0/3
$self->{'PERL_SRC'} || "$self->{'PERL_ARCHLIB'}/CORE"
l!l
000
MC/DC0%0/1
$self->{'PERL_SRC'} || "$self->{'PERL_ARCHLIB'}/CORE"
$self->{'PERL_SRC'}
Truth table0%0/2
A
A= $self->{'PERL_SRC'}
Aresult
11
00
2678 0 ▶ $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"UNINSTALLED_PERL"} 0 0 0
2679 0 ▶ $libperl ||= "libperl$self->{LIB_EXT}";
Condition0%0/3
$libperl ||= qq[libperl$self->{"LIB_EXT"}]
l!l
000
MC/DC0%0/1
$libperl ||= qq[libperl$self->{"LIB_EXT"}]
$libperl
Truth table0%0/2
A
A= $libperl
Aresult
11
00
2680 0 $libperl = "$dir/$libperl";
2681 0 ▶ $lperl ||= "libperl$self->{LIB_EXT}";
Condition0%0/3
$lperl ||= qq[libperl$self->{"LIB_EXT"}]
l!l
000
MC/DC0%0/1
$lperl ||= qq[libperl$self->{"LIB_EXT"}]
$lperl
Truth table0%0/2
A
A= $lperl
Aresult
11
00
2682 0 $lperl = "$dir/$lperl";
2683  
2684 0 ▶ if (! -f $libperl and ! -f $lperl) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $libperl or -f $lperl) 0 0 0
Condition0%0/3
-f $libperl or -f $lperl
l!l&&r!l&&!r
000
MC/DC0%0/2
-f $libperl or -f $lperl
-f $libperl -f $lperl
Truth table0%0/3
A or B
A= -f $libperlB= -f $lperl
ABresult
1X1
011
000
2685 # We did not find a static libperl. Maybe there is a shared one?
2686 0 ▶ if ($Is{SunOS}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"SunOS"}) 0 0 0
2687 0 $lperl = $libperl = "$dir/$Config{libperl}";
2688 # SUNOS ld does not take the full path to a shared library
2689 0 ▶ $libperl = '' if $Is{SunOS4};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"SunOS4"} 0 0 0
2690 }
2691 }
2692  
2693 0 ▶ print <<EOF unless -f $lperl || defined($self->{PERL_SRC});
Branch: 1 branch
BranchTrueFalseTotal
unless -f $lperl or defined $self->{"PERL_SRC"} 0 0 0
Condition0%0/3
-f $lperl or defined $self->{"PERL_SRC"}
l!l&&r!l&&!r
000
MC/DC0%0/2
-f $lperl or defined $self->{"PERL_SRC"}
-f $lperl defined $self->{"PERL_SRC"}
Truth table0%0/3
A or B
A= -f $lperlB= defined $self->{"PERL_SRC"}
ABresult
1X1
011
000
2694 Warning: $libperl not found
2695 If you're going to build a static perl binary, make sure perl is installed
2696 otherwise ignore this warning
2697 EOF
2698 }
2699  
2700 # SUNOS ld does not take the full path to a shared library
2701 0 ▶ my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl';
Branch: 1 branch
BranchTrueFalseTotal
$libperl ? : 0 0 0
2702 0 my $libperl_dep = $self->quote_dep($libperl);
2703  
2704 0 push @m, "
2705 MAP_LIBPERL = $libperl
2706 MAP_LIBPERLDEP = $libperl_dep
2707 LLIBPERL = $llibperl
2708 ";
2709  
2710 0 push @m, '
2711 $(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
2712 $(NOECHO) $(RM_F) $@
2713 $(NOECHO) $(TOUCH) $@
2714 ';
2715  
2716 0 foreach my $catfile (@$extra){
2717 0 push @m, "\tcat $catfile >> \$\@\n";
2718 }
2719  
2720 0 ▶ my $ldfrom = $self->{XSMULTI} ? '' : '$(LDFROM)';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'XSMULTI'} ? : 0 0 0
2721 # 1 2 3 4
2722 0 push @m, _sprintf562 <<'EOF', $tmp, $ldfrom, $self->xs_obj_opt('$@'), $makefilename;
2723 $(MAP_TARGET) :: %1$s/perlmain$(OBJ_EXT) $(MAP_LIBPERLDEP) $(MAP_STATICDEP) $(INST_ARCHAUTODIR)/extralibs.all
2724 $(MAP_LINKCMD) %2$s $(OPTIMIZE) %1$s/perlmain$(OBJ_EXT) %3$s $(MAP_STATIC) "$(LLIBPERL)" `cat $(INST_ARCHAUTODIR)/extralibs.all` $(MAP_PRELIBS)
2725 $(NOECHO) $(ECHO) "To install the new '$(MAP_TARGET)' binary, call"
2726 $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s inst_perl MAP_TARGET=$(MAP_TARGET)"
2727 $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s map_clean"
2728  
2729 %1$s/perlmain\$(OBJ_EXT): %1$s/perlmain.c
2730 EOF
2731 0 push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n";
2732  
2733 0 ▶ my $maybe_DynaLoader = $Config{usedl} ? 'q(DynaLoader)' : '';
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::MM_Unix::Config{'usedl'} ? : 0 0 0
2734 0 push @m, _sprintf562 <<'EOF', $tmp, $makefilename, $maybe_DynaLoader;
2735  
2736 %1$s/perlmain.c: %2$s
2737 $(NOECHO) $(ECHO) Writing $@
2738 $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \
2739 -e "writemain(grep(s#.*/auto/##s, @ARGV), %3$s)" $(MAP_STATIC) > $@t
2740 $(MV) $@t $@
2741  
2742 EOF
2743 0 ▶ push @m, "\t", q{$(NOECHO) $(PERL) "$(INSTALLSCRIPT)/fixpmain"
Branch: 1 branch
BranchTrueFalseTotal
if defined &Dos::UseLFN and Dos::UseLFN() == 0 0 0 0
Condition0%0/3
defined &Dos::UseLFN and Dos::UseLFN() == 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined &Dos::UseLFN and Dos::UseLFN() == 0
defined &Dos::UseLFN Dos::UseLFN() == 0
Truth table0%0/3
A and B
A= defined &Dos::UseLFNB= Dos::UseLFN() == 0
ABresult
0X0
100
111
2744 } if (defined (&Dos::UseLFN) && Dos::UseLFN()==0);
2745  
2746  
2747 0 push @m, q{
2748 doc_inst_perl :
2749 $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
2750 -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
2751 -$(NOECHO) $(DOC_INSTALL) \
2752 "Perl binary" "$(MAP_TARGET)" \
2753 MAP_STATIC "$(MAP_STATIC)" \
2754 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2755 MAP_LIBPERL "$(MAP_LIBPERL)" \
2756 >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
2757  
2758 };
2759  
2760 push @m, q{
2761 inst_perl : pure_inst_perl doc_inst_perl
2762  
2763 pure_inst_perl : $(MAP_TARGET)
2764 }.$self->{CP}.q{ $(MAP_TARGET) "}.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{"
2765  
2766 clean :: map_clean
2767  
2768 map_clean :
2769 0 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2770 };
2771  
2772 0 join '', @m;
2773 }
2774  
2775 # utility method
2776 0 ▶sub _find_static_libs {
Subroutine _find_static_libs: not called CC=2 SCAR=17.1
2777 0 my ($self, $searchdirs) = @_;
2778 # don't use File::Spec here because on Win32 F::F still uses "/"
2779 my $installed_version = join('/',
2780 0 'auto', $self->{FULLEXT}, "$self->{BASEEXT}$self->{LIB_EXT}"
2781 );
2782 0 my %staticlib21;
2783 0 require File::Find;
2784 0 ▶ File::Find::find(sub {
Subroutine __ANON__: not called CC=17 SCAR=55.8
2785 0 ▶ if ($File::Find::name =~ m{/auto/share\z}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($File::Find::name =~ m[/auto/share\z]) 0 0 0
2786 # in a subdir of auto/share, prune because e.g.
2787 # Alien::pkgconfig uses File::ShareDir to put .a files
2788 # there. do not want
2789 0 $File::Find::prune = 1;
2790 0 return;
2791 }
2792  
2793 0 ▶ return unless m/\Q$self->{LIB_EXT}\E$/;
Branch: 1 branch
BranchTrueFalseTotal
unless /\Q$self->{"LIB_EXT"}\E$/ 0 0 0
2794  
2795 0 ▶ return unless -f 'extralibs.ld'; # this checks is a "proper" XS installation
Branch: 1 branch
BranchTrueFalseTotal
unless -f "extralibs.ld" 0 0 0
2796  
2797 # Skip perl's libraries.
2798 0 ▶ return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^libperl/ or /^perl\Q$self->{"LIB_EXT"}\E$/ 0 0 0
Condition0%0/3
/^libperl/ or /^perl\Q$self->{"LIB_EXT"}\E$/
l!l&&r!l&&!r
000
MC/DC0%0/2
/^libperl/ or /^perl\Q$self->{"LIB_EXT"}\E$/
/^libperl/ /^perl\Q$self->{"LIB_EXT"}\E$/
Truth table0%0/3
A or B
A= /^libperl/B= /^perl\Q$self->{"LIB_EXT"}\E$/
ABresult
1X1
011
000
2799  
2800 # Skip purified versions of libraries
2801 # (e.g., DynaLoader_pure_p1_c0_032.a)
2802 0 ▶ return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
Branch: 1 branch
BranchTrueFalseTotal
if /_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure" 0 0 0
Condition0%0/3
/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"
!ll&&!rl&&r
000
MC/DC0%0/2
/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"
/_pure_\w+_\w+_\w+\.\w+$/ -f "$File::Find::dir/.pure"
Truth table0%0/3
A and B
A= /_pure_\w+_\w+_\w+\.\w+$/B= -f "$File::Find::dir/.pure"
ABresult
0X0
100
111
2803  
2804 0 ▶ if( exists $self->{INCLUDE_EXT} ){
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'INCLUDE_EXT'}) { } 0 0 0
elsif (exists $self->{'EXCLUDE_EXT'}) { } 0 0 0
2805 0 my $found = 0;
2806  
2807 0 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2808 0 $xx =~ s,/?$_,,;
2809 0 $xx =~ s,/,::,g;
2810  
2811 # Throw away anything not explicitly marked for inclusion.
2812 # DynaLoader is implied.
2813 0 foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2814 0 ▶ if( $xx eq $incl ){
Branch: 1 branch
BranchTrueFalseTotal
if ($xx eq $incl) 0 0 0
2815 0 $found++;
2816 0 last;
2817 }
2818 }
2819 0 ▶ return unless $found;
Branch: 1 branch
BranchTrueFalseTotal
unless $found 0 0 0
2820 }
2821 elsif( exists $self->{EXCLUDE_EXT} ){
2822 0 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2823 0 $xx =~ s,/?$_,,;
2824 0 $xx =~ s,/,::,g;
2825  
2826 # Throw away anything explicitly marked for exclusion
2827 0 foreach my $excl (@{$self->{EXCLUDE_EXT}}){
2828 0 ▶ return if( $xx eq $excl );
Branch: 1 branch
BranchTrueFalseTotal
if $xx eq $excl 0 0 0
2829 }
2830 }
2831  
2832 # don't include the installed version of this extension. I
2833 # leave this line here, although it is not necessary anymore:
2834 # I patched minimod.PL instead, so that Miniperl.pm won't
2835 # include duplicates
2836  
2837 # Once the patch to minimod.PL is in the distribution, I can
2838 # drop it
2839 0 ▶ return if $File::Find::name =~ m:\Q$installed_version\E\z:;
Branch: 1 branch
BranchTrueFalseTotal
if $File::Find::name =~ /\Q$installed_version\E\z/ 0 0 0
2840 0 ▶ return if !$self->xs_static_lib_is_xs($_);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->xs_static_lib_is_xs($_) 0 0 0
2841 96 ▶ use Cwd 'cwd';
Subroutine BEGIN: called CC=1 SCAR=0.0
2842 0 $staticlib21{cwd() . "/" . $_}++;
2843 0 ▶ }, grep( -d $_, map { $self->catdir($_, 'auto') } @{$searchdirs || []}) );
Condition0%0/3
$searchdirs || []
l!l
000
MC/DC0%0/1
$searchdirs || []
$searchdirs
Truth table0%0/2
A
A= $searchdirs
Aresult
11
00
2844 0 return \%staticlib21;
2845 }
2846  
2847 =item xs_static_lib_is_xs (o)
2848  
2849 Called by a utility method of makeaperl. Checks whether a given file
2850 is an XS library by seeing whether it defines any symbols starting
2851 with C<boot_> (with an optional leading underscore - needed on MacOS).
2852  
2853 =cut
2854  
2855 0 ▶sub xs_static_lib_is_xs {
Subroutine xs_static_lib_is_xs: not called CC=1 SCAR=6.9
Pod documented
2856 0 my ($self, $libfile) = @_;
2857 0 my $devnull = File::Spec->devnull;
2858 0 return `nm $libfile 2>$devnull` =~ /\b_?boot_/;
2859 }
2860  
2861 =item makefile (o)
2862  
2863 Defines how to rewrite the Makefile.
2864  
2865 =cut
2866  
2867 217 ▶sub makefile {
Subroutine makefile: called CC=4 SCAR=14.1
Pod documented
2868 217 my($self) = shift;
2869 217 my $m;
2870 # We do not know what target was originally specified so we
2871 # must force a manual rerun to be sure. But as it should only
2872 # happen very rarely it is not a significant problem.
2873 $m = '
2874 $(OBJECT) : $(FIRST_MAKEFILE)
2875  
2876 217 ▶' if $self->{OBJECT};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"OBJECT"} 21 196 217
2877  
2878 217 ▶ my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?';
Branch: 1 branch
BranchTrueFalseTotal
$Is{'VMS'} ? : 0 217 217
2879 217 my $mpl_args = join " ", map qq["$_"], @ARGV;
2880 217 my $cross = '';
2881 217 ▶ if (defined $::Cross::platform) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $::Cross::platform) 0 217 217
2882 # Inherited from win32/buildext.pl
2883 0 $cross = "-MCross=$::Cross::platform ";
2884 }
2885 217 $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $cross, $mpl_args;
2886 # We take a very conservative approach here, but it's worth it.
2887 # We move Makefile to Makefile.old here to avoid gnu make looping.
2888 $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
2889 $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s"
2890 $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
2891 -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
2892 -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
2893 - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
2894 $(PERLRUN) %sMakefile.PL %s
2895 $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
2896 $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
2897 $(FALSE)
2898  
2899 MAKE_FRAG
2900  
2901 217 return $m;
2902 }
2903  
2904  
2905 =item maybe_command
2906  
2907 Returns true, if the argument is likely to be a command.
2908  
2909 =cut
2910  
2911 266 ▶sub maybe_command {
Subroutine maybe_command: called CC=5 SCAR=16.1
Pod documented
2912 266 my($self,$file) = @_;
2913 # $file = '' if (!defined $file or !length $file);
2914 266 ▶ return unless defined $file and length $file;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $file and length $file 2 264 266
Condition100%3/3
defined $file and length $file
!ll&&!rl&&r
11264
MC/DC100%2/2
defined $file and length $file
defined $file length $file
Truth table100%3/3
A and B
A= defined $fileB= length $file
ABresult
0X0
100
111
2915 264 ▶ return $file if -x $file && ! -d $file;
Branch: 1 branch
BranchTrueFalseTotal
if -x $file and not -d $file 135 129 264
Condition66%2/3
-x $file and not -d $file
!ll&&!rl&&r
1290135
MC/DC50%1/2
-x $file and not -d $file
-x $file not -d $file
Truth table66%2/3
A and not(B)
A= -x $fileB= not -d $file
ABresult
0X0
100
111
2916 129 return;
2917 }
2918  
2919  
2920 =item needs_linking (o)
2921  
2922 Does this module need linking? Looks into subdirectory objects (see
2923 also has_link_code())
2924  
2925 =cut
2926  
2927 2344 ▶sub needs_linking {
Subroutine needs_linking: called CC=7 SCAR=20.1
Pod documented
2928 2344 my($self) = shift;
2929  
2930 2344 my $caller = (caller(0))[3];
2931 2344 ▶ confess("needs_linking called too early") if
Branch: 1 branch
BranchTrueFalseTotal
if $caller =~ /^ExtUtils::MakeMaker::/ 0 2344 2344
2932 $caller =~ /^ExtUtils::MakeMaker::/;
2933 2344 ▶ return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"NEEDS_LINKING"} 2127 217 2344
2934 217 ▶ if ($self->has_link_code or $self->{MAKEAPERL}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_link_code or $self->{"MAKEAPERL"}) 21 196 217
Condition66%2/3
$self->has_link_code or $self->{"MAKEAPERL"}
l!l&&r!l&&!r
210196
MC/DC50%1/2
$self->has_link_code or $self->{"MAKEAPERL"}
$self->has_link_code $self->{"MAKEAPERL"}
Truth table66%2/3
A or B
A= $self->has_link_codeB= $self->{"MAKEAPERL"}
ABresult
1X1
011
000
2935 21 $self->{NEEDS_LINKING} = 1;
2936 21 return 1;
2937 }
2938 196 foreach my $child (keys %{$self->{CHILDREN}}) {
2939 72 ▶ if ($self->{CHILDREN}->{$child}->needs_linking) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CHILDREN"}{$child}->needs_linking) 0 72 72
2940 0 $self->{NEEDS_LINKING} = 1;
2941 0 return 1;
2942 }
2943 }
2944 196 return $self->{NEEDS_LINKING} = 0;
2945 }
2946  
2947  
2948 =item parse_abstract
2949  
2950 parse a file and return what you think is the ABSTRACT
2951  
2952 =cut
2953  
2954 30 ▶sub parse_abstract {
Subroutine parse_abstract: called CC=15 SCAR=27.2
Pod documented
2955 30 my($self,$parsefile) = @_;
2956 30 my $result;
2957  
2958 30 local $/ = "\n";
2959 30 ▶ open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $parsefile or die "Could not open '${parsefile}': $!" 30 0 30
2960 30 binmode $fh;
2961 30 my $inpod = 0;
2962 30 my $pod_encoding;
2963 30 my $package = $self->{DISTNAME};
2964 30 $package =~ s/-/::/g;
2965 30 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 206 10 216
2966 206 ▶ $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
Branch: 2 branches
BranchTrueFalseTotal
/^=(?!cut)/ ? : 34 172 206
/^=cut/ ? : 2 170 172
2967 206 ▶ next if !$inpod;
Branch: 1 branch
BranchTrueFalseTotal
unless $inpod 86 120 206
2968 120 s#\r*\n\z##; # handle CRLF input
2969  
2970 120 ▶ if ( /^=encoding\s*(.*)$/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^=encoding\s*(.*)$/i) 1 119 120
2971 1 $pod_encoding = $1;
2972 }
2973  
2974 120 ▶ if ( /^($package(?:\.pm)? \s+ -+ \s+)(.*)/x ) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^($package(?:\.pm)? \s+ -+ \s+)(.*)/x) 30 90 120
2975 30 $result = $2;
2976 30 next;
2977 }
2978 90 ▶ next unless $result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 68 22 90
2979  
2980 22 ▶ if ( $result && ( /^\s*$/ || /^\=/ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result and /^\s*$/ || /^\=/) 20 2 22
Condition66%4/6
$result and /^\s*$/ || /^\=/
!ll&&!rl&&r
0220
/^\s*$/ or /^\=/
l!l&&r!l&&!r
2002
MC/DC33%1/3
$result and /^\s*$/ || /^\=/
$result /^\s*$/ /^\=/
Truth table50%2/4
A and B or C
A= $resultB= /^\s*$/C= /^\=/
ABCresult
0XX0
1000
11X1
1011
2981 20 last;
2982 }
2983 2 $result = join ' ', $result, $_;
2984 }
2985 30 close $fh;
2986  
2987 30 ▶ if ( $pod_encoding and !( "$]" < 5.008 or !$Config{useperlio} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pod_encoding and not "$]" < "5.008" || !$ExtUtils::MM_Unix::Config{"useperlio"}) 1 29 30
Condition50%3/6
$pod_encoding and not "$]" < "5.008" || !$ExtUtils::MM_Unix::Config{"useperlio"}
!ll&&!rl&&r
2901
"$]" < 5.008 || !$ExtUtils::MM_Unix::Config{'useperlio'}
l!l&&r!l&&!r
001
MC/DC33%1/3
$pod_encoding and not "$]" < "5.008" || !$ExtUtils::MM_Unix::Config{"useperlio"}
$pod_encoding "$]" < 5.008 !$ExtUtils::MM_Unix::Config{'useperlio'}
Truth table50%2/4
A and not(B || not(C))
A= $pod_encodingB= "$]" < 5.008C= !$ExtUtils::MM_Unix::Config{'useperlio'}
ABCresult
0XX0
11X0
1010
1001
2988 # Have to wrap in an eval{} for when running under PERL_CORE
2989 # Encode isn't available during build phase and parsing
2990 # ABSTRACT isn't important there
2991 1 eval {
2992 1 require Encode;
2993 1 $result = Encode::decode($pod_encoding, $result);
2994 }
2995 }
2996  
2997 30 return $result;
2998 }
2999  
3000 =item parse_version
3001  
3002 my $version = MM->parse_version($file);
3003  
3004 Parse a $file and return what $VERSION is set to by the first assignment.
3005 It will return the string "undef" if it can't figure out what $VERSION
3006 is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION
3007 are okay, but C<my $VERSION> is not.
3008  
3009 C<package Foo VERSION> is also checked for. The first version
3010 declaration found is used, but this may change as it differs from how
3011 Perl does it.
3012  
3013 parse_version() will try to C<use version> before checking for
3014 C<$VERSION> so the following will work.
3015  
3016 $VERSION = qv(1.2.3);
3017  
3018 =cut
3019  
3020 282 ▶sub parse_version {
Subroutine parse_version: called CC=18 SCAR=29.0
Pod documented
3021 282 my($self,$parsefile) = @_;
3022 282 my $result;
3023  
3024 282 local $/ = "\n";
3025 282 local $_;
3026 282 ▶ open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $parsefile or die "Could not open '${parsefile}': $!" 282 0 282
3027 282 my $inpod = 0;
3028 282 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 857 13 870
3029 857 ▶ $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
Branch: 2 branches
BranchTrueFalseTotal
/^=(?!cut)/ ? : 0 857 857
/^=cut/ ? : 0 857 857
3030 857 ▶ next if $inpod || /^\s*#/;
Branch: 1 branch
BranchTrueFalseTotal
if $inpod or /^\s*#/ 68 789 857
Condition66%2/3
$inpod or /^\s*#/
l!l&&r!l&&!r
068789
MC/DC50%1/2
$inpod or /^\s*#/
$inpod /^\s*#/
Truth table66%2/3
A or B
A= $inpodB= /^\s*#/
ABresult
1X1
011
000
3031 789 chop;
3032 789 ▶ next if /^\s*(if|unless|elsif)/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*(if|unless|elsif)/ 2 787 789
3033 787 ▶ if ( m{^ \s* (?:package|class) \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* (:|;|\{) }x ) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^ \s* (?:package|class) \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* (:|;|\{) /x) { } 44 743 787
elsif (/(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* (?<![<>=!])\=[^=]/x) { } 229 514 743
3034 96 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3035 44 $result = $1;
3036 }
3037 elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* (?<![<>=!])\=[^=]}x ) {
3038 229 $result = $self->get_version($parsefile, $1, $2);
3039 }
3040 else {
3041 514 next;
3042 }
3043 273 ▶ last if defined $result;
Branch: 1 branch
BranchTrueFalseTotal
if defined $result 269 4 273
3044 }
3045 282 close $fh;
3046  
3047 282 ▶ if ( defined $result && $result !~ /^v?[\d_\.]+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $result and not $result =~ /^v?[\d_\.]+$/) 3 279 282
Condition100%3/3
defined $result and not $result =~ /^v?[\d_\.]+$/
!ll&&!rl&&r
132663
MC/DC100%2/2
defined $result and not $result =~ /^v?[\d_\.]+$/
defined $result not $result =~ /^v?[\d_\.]+$/
Truth table100%3/3
A and not(B)
A= defined $resultB= not $result =~ /^v?[\d_\.]+$/
ABresult
0X0
100
111
3048 3 require version;
3049 3 my $normal = eval { version->new( $result ) };
3050 3 ▶ $result = $normal if defined $normal;
Branch: 1 branch
BranchTrueFalseTotal
if defined $normal 1 2 3
3051 }
3052 282 ▶ if ( defined $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $result) 269 13 282
3053 $result = "undef" unless $result =~ m!^v?[\d_\.]+$!
3054 269 ▶ or eval { version->parse( $result ) };
Branch: 1 branch
BranchTrueFalseTotal
unless $result =~ /^v?[\d_\.]+$/ or eval { do { "version"->parse($result) } } 2 267 269
Condition66%2/3
$result =~ /^v?[\d_\.]+$/ or eval { do { "version"->parse($result) } }
l!l&&r!l&&!r
26702
MC/DC50%1/2
$result =~ /^v?[\d_\.]+$/ or eval { do { "version"->parse($result) } }
$result =~ /^v?[\d_\.]+$/ eval { do { "version"->parse($result) } }
Truth table66%2/3
A or B
A= $result =~ /^v?[\d_\.]+$/B= eval { do { "version"->parse($result) } }
ABresult
1X1
011
000
3055 }
3056 282 ▶ $result = "undef" unless defined $result;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $result 13 269 282
3057 282 return $result;
3058 }
3059  
3060 229 ▶sub get_version {
Subroutine get_version: called CC=2 SCAR=6.9
Pod undocumented
3061 229 my ($self, $parsefile, $sigil, $name) = @_;
3062 229 my $line = $_; # from the while() loop in parse_version
3063 {
3064 229 package ExtUtils::MakeMaker::_version;
3065 229 undef *version; # in case of unexpected version() sub
3066 229 eval {
3067 229 require version;
3068 229 version::->import;
3069 };
3070 96 ▶ no strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3071 96 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3072 229 local *{$name};
3073 229 ▶ $line = $1 if $line =~ m{^(.+)}s;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^(.+)/s 229 0 229
3074 229 ▶ eval($line); ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3075 229 return ${$name};
3076 }
3077 }
3078  
3079 =item pasthru (o)
3080  
3081 Defines the string that is passed to recursive make calls in
3082 subdirectories. The variables like C<PASTHRU_DEFINE> are used in each
3083 level, and passed downwards on the command-line with e.g. the value of
3084 that level's DEFINE. Example:
3085  
3086 # Level 0 has DEFINE = -Dfunky
3087 # This code will define level 0's PASTHRU=PASTHRU_DEFINE="$(DEFINE)
3088 # $(PASTHRU_DEFINE)"
3089 # Level 0's $(CCCMD) will include macros $(DEFINE) and $(PASTHRU_DEFINE)
3090 # So will level 1's, so when level 1 compiles, it will get right values
3091 # And so ad infinitum
3092  
3093 =cut
3094  
3095 217 ▶sub pasthru {
Subroutine pasthru: called CC=6 SCAR=17.9
Pod documented
3096 217 my($self) = shift;
3097 217 my(@m);
3098  
3099 my(@pasthru);
3100 217 ▶ my($sep) = $Is{VMS} ? ',' : '';
Branch: 1 branch
BranchTrueFalseTotal
$Is{'VMS'} ? : 0 217 217
3101 217 $sep .= "\\\n\t";
3102  
3103 217 foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
3104 PREFIX INSTALL_BASE)
3105 )
3106 {
3107 1302 ▶ next unless defined $self->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$key} 626 676 1302
3108 676 push @pasthru, "$key=\"\$($key)\"";
3109 }
3110  
3111 217 foreach my $key (qw(DEFINE INC)) {
3112 # default to the make var
3113 434 my $val = qq{\$($key)};
3114 # expand within perl if given since need to use quote_literal
3115 # since INC might include space-protecting ""!
3116 434 ▶ chomp($val = $self->{$key}) if defined $self->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{$key} 8 426 434
3117 434 $val .= " \$(PASTHRU_$key)";
3118 434 my $quoted = $self->quote_literal($val);
3119 434 push @pasthru, qq{PASTHRU_$key=$quoted};
3120 }
3121  
3122 217 push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n";
3123 217 join "", @m;
3124 }
3125  
3126 =item perl_script
3127  
3128 Takes one argument, a file name, and returns the file name, if the
3129 argument is likely to be a perl script. On MM_Unix this is true for
3130 any ordinary, readable file.
3131  
3132 =cut
3133  
3134 1 ▶sub perl_script {
Subroutine perl_script: called CC=3 SCAR=14.2
Pod documented
3135 1 my($self,$file) = @_;
3136 1 ▶ return $file if -r $file && -f _;
Branch: 1 branch
BranchTrueFalseTotal
if -r $file and -f _ 1 0 1
Condition33%1/3
-r $file and -f _
!ll&&!rl&&r
001
MC/DC0%0/2
-r $file and -f _
-r $file -f _
Truth table33%1/3
A and B
A= -r $fileB= -f _
ABresult
0X0
100
111
3137 0 return;
3138 }
3139  
3140 =item perldepend (o)
3141  
3142 Defines the dependency from all *.h files that come with the perl
3143 distribution.
3144  
3145 =cut
3146  
3147 217 ▶sub perldepend {
Subroutine perldepend: called CC=5 SCAR=16.2
Pod documented
3148 217 my($self) = shift;
3149 217 my(@m);
3150  
3151 217 my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
3152  
3153 217 ▶ push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PERL_SRC"} 0 217 217
3154 # Check for unpropagated config.sh changes. Should never happen.
3155 # We do NOT just update config.h because that is not sufficient.
3156 # An out of date config.h is not fatal but complains loudly!
3157 $(PERL_INCDEP)/config.h: $(PERL_SRC)/config.sh
3158 -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE)
3159  
3160 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
3161 $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
3162 %s
3163 MAKE_FRAG
3164  
3165 217 ▶ return join "", @m unless $self->needs_linking;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
3166  
3167 21 ▶ if ($self->{OBJECT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"OBJECT"}) 21 0 21
3168 # Need to add an object file dependency on the perl headers.
3169 # this is very important for XS modules in perl.git development.
3170 21 push @m, $self->_perl_header_files_fragment("/"); # Directory separator between $(PERL_INC)/header.h
3171 }
3172  
3173 21 ▶ push @m, join(" ", sort values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->{"XS"};} 18 3 21
3174  
3175 21 return join "\n", @m;
3176 }
3177  
3178  
3179 =item pm_to_blib
3180  
3181 Defines target that copies all files in the hash PM to their
3182 destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
3183  
3184 =cut
3185  
3186 217 ▶sub pm_to_blib {
Subroutine pm_to_blib: called CC=1 SCAR=0.0
Pod documented
3187 217 my $self = shift;
3188 217 my($autodir) = $self->catdir('$(INST_LIB)','auto');
3189 217 my $r = q{
3190 pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
3191 };
3192  
3193 # VMS will swallow '' and PM_FILTER is often empty. So use q[]
3194 217 my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
3195 \$i=0; \$n=\$#ARGV; \$i++ until \$i > \$n or \$ARGV[\$i] eq q{--};
3196 die q{Failed to find -- in }.join(q{|},\@ARGV) if \$i > \$n;
3197 \@parts=splice \@ARGV,0,\$i+1;
3198 pop \@parts; \$filter=join q{ }, map qq{"\$_"}, \@parts;
3199 pm_to_blib({\@ARGV}, '$autodir', \$filter, '\$(PERM_DIR)')
3200 CODE
3201 217 $pm_to_blib .= q[ $(PM_FILTER) --];
3202  
3203 my @cmds = $self->split_command($pm_to_blib,
3204 map +($self->quote_literal($_) => $self->quote_literal($self->{PM}{$_})),
3205 217 sort keys %{$self->{PM}});
3206  
3207 217 $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
3208 217 $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};
3209  
3210 217 return $r;
3211 }
3212  
3213 # transform dot-separated version string into comma-separated quadruple
3214 # examples: '1.2.3.4.5' => '1,2,3,4'
3215 # '1.2.3' => '1,2,3,0'
3216 7 ▶sub _ppd_version {
Subroutine _ppd_version: called CC=1 SCAR=0.0
3217 7 my ($self, $string) = @_;
3218 7 return join ',', ((split /\./, $string), (0) x 4)[0..3];
3219 }
3220  
3221 =item ppd
3222  
3223 Defines target that creates a PPD (Perl Package Description) file
3224 for a binary distribution.
3225  
3226 =cut
3227  
3228 217 ▶sub ppd {
Subroutine ppd: called CC=14 SCAR=27.9
Pod documented
3229 217 my($self) = @_;
3230  
3231 217 ▶ my $abstract = $self->{ABSTRACT} || '';
Condition100%2/2
$self->{'ABSTRACT'} || ''
l!l
18199
MC/DC100%1/1
$self->{'ABSTRACT'} || ''
$self->{'ABSTRACT'}
Truth table100%2/2
A
A= $self->{'ABSTRACT'}
Aresult
11
00
3232 217 $abstract =~ s/\n/\\n/sg;
3233 217 $abstract =~ s/</&lt;/g;
3234 217 $abstract =~ s/>/&gt;/g;
3235  
3236 217 ▶ my $author = join(', ',@{ ref $self->{AUTHOR} eq 'ARRAY' ? $self->{AUTHOR} : [ $self->{AUTHOR} || '']});
Branch: 1 branch
BranchTrueFalseTotal
ref $self->{'AUTHOR'} eq 'ARRAY' ? : 24 193 217
Condition66%2/3
$self->{'AUTHOR'} || ''
l!l
11920
MC/DC100%1/1
$self->{'AUTHOR'} || ''
$self->{'AUTHOR'}
Truth table100%2/2
A
A= $self->{'AUTHOR'}
Aresult
11
00
3237 217 $author =~ s/</&lt;/g;
3238 217 $author =~ s/>/&gt;/g;
3239  
3240 217 my $ppd_file = "$self->{DISTNAME}.ppd";
3241  
3242 217 my @ppd_chunks = qq(<SOFTPKG NAME="$self->{DISTNAME}" VERSION="$self->{VERSION}">\n);
3243  
3244 217 push @ppd_chunks, sprintf <<'PPD_HTML', $abstract, $author;
3245 <ABSTRACT>%s</ABSTRACT>
3246 <AUTHOR>%s</AUTHOR>
3247 PPD_HTML
3248  
3249 217 push @ppd_chunks, " <IMPLEMENTATION>\n";
3250 217 ▶ if ( $self->{MIN_PERL_VERSION} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"MIN_PERL_VERSION"}) 7 210 217
3251 7 my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION});
3252 7 push @ppd_chunks, sprintf <<'PPD_PERLVERS', $min_perl_version;
3253 <PERLCORE VERSION="%s" />
3254 PPD_PERLVERS
3255  
3256 }
3257  
3258 # Don't add "perl" to requires. perl dependencies are
3259 # handles by ARCHITECTURE.
3260 217 my %prereqs = %{$self->{PREREQ_PM}};
3261 217 delete $prereqs{perl};
3262  
3263 # Build up REQUIRE
3264 217 foreach my $prereq (sort keys %prereqs) {
3265 54 my $name = $prereq;
3266 54 ▶ $name .= '::' unless $name =~ /::/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /::/ 23 31 54
3267 54 my $version = $prereqs{$prereq};
3268  
3269 54 my %attrs = ( NAME => $name );
3270 54 ▶ $attrs{VERSION} = $version if $version;
Branch: 1 branch
BranchTrueFalseTotal
if $version 18 36 54
3271 54 my $attrs = join " ", map { qq[$_="$attrs{$_}"] } sort keys %attrs;
3272 54 push @ppd_chunks, qq( <REQUIRE $attrs />\n);
3273 }
3274  
3275 217 my $archname = $Config{archname};
3276  
3277 # archname did not change from 5.6 to 5.8, but those versions may
3278 # not be not binary compatible so now we append the part of the
3279 # version that changes when binary compatibility may change
3280 217 ▶ if ("$]" >= 5.008) {
Branch: 1 branch
BranchTrueFalseTotal
if ("$]" >= "5.008") 217 0 217
3281 217 $archname .= "-$Config{api_revision}.$Config{api_version}";
3282 }
3283 217 push @ppd_chunks, sprintf <<'PPD_OUT', $archname;
3284 <ARCHITECTURE NAME="%s" />
3285 PPD_OUT
3286  
3287 217 ▶ if ($self->{PPM_INSTALL_SCRIPT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PPM_INSTALL_SCRIPT"}) 0 217 217
3288 0 ▶ if ($self->{PPM_INSTALL_EXEC}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'PPM_INSTALL_EXEC'}) { } 0 0 0
3289 push @ppd_chunks, sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n},
3290 0 $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT};
3291 }
3292 else {
3293 push @ppd_chunks, sprintf qq{ <INSTALL>%s</INSTALL>\n},
3294 0 $self->{PPM_INSTALL_SCRIPT};
3295 }
3296 }
3297  
3298 217 ▶ if ($self->{PPM_UNINSTALL_SCRIPT}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"PPM_UNINSTALL_SCRIPT"}) 0 217 217
3299 0 ▶ if ($self->{PPM_UNINSTALL_EXEC}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'PPM_UNINSTALL_EXEC'}) { } 0 0 0
3300 push @ppd_chunks, sprintf qq{ <UNINSTALL EXEC="%s">%s</UNINSTALL>\n},
3301 0 $self->{PPM_UNINSTALL_EXEC}, $self->{PPM_UNINSTALL_SCRIPT};
3302 }
3303 else {
3304 push @ppd_chunks, sprintf qq{ <UNINSTALL>%s</UNINSTALL>\n},
3305 0 $self->{PPM_UNINSTALL_SCRIPT};
3306 }
3307 }
3308  
3309 217 ▶ my ($bin_location) = $self->{BINARY_LOCATION} || '';
Condition33%1/3
$self->{'BINARY_LOCATION'} || ''
l!l
02170
MC/DC0%0/1
$self->{'BINARY_LOCATION'} || ''
$self->{'BINARY_LOCATION'}
Truth table50%1/2
A
A= $self->{'BINARY_LOCATION'}
Aresult
11
00
3310 217 $bin_location =~ s/\\/\\\\/g;
3311  
3312 217 push @ppd_chunks, sprintf <<'PPD_XML', $bin_location;
3313 <CODEBASE HREF="%s" />
3314 </IMPLEMENTATION>
3315 </SOFTPKG>
3316 PPD_XML
3317  
3318 217 my @ppd_cmds = $self->stashmeta(join('', @ppd_chunks), $ppd_file);
3319  
3320 217 return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds;
3321 # Creates a PPD (Perl Package Description) for a binary distribution.
3322 ppd :
3323 %s
3324 PPD_OUT
3325  
3326 }
3327  
3328 =item prefixify
3329  
3330 $MM->prefixify($var, $prefix, $new_prefix, $default);
3331  
3332 Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to
3333 replace it's $prefix with a $new_prefix.
3334  
3335 Should the $prefix fail to match I<AND> a PREFIX was given as an
3336 argument to WriteMakefile() it will set it to the $new_prefix +
3337 $default. This is for systems whose file layouts don't neatly fit into
3338 our ideas of prefixes.
3339  
3340 This is for heuristics which attempt to create directory structures
3341 that mirror those of the installed perl.
3342  
3343 For example:
3344  
3345 $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1');
3346  
3347 this will attempt to remove '/usr' from the front of the
3348 $MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir}
3349 if necessary) and replace it with '/home/foo'. If this fails it will
3350 simply use '/home/foo/man/man1'.
3351  
3352 =cut
3353  
3354 3085 ▶sub prefixify {
Subroutine prefixify: called CC=14 SCAR=28.6
Pod documented
3355 3085 my($self,$var,$sprefix,$rprefix,$default) = @_;
3356  
3357 my $path = $self->{uc $var} ||
3358 3085 ▶ $Config_Override{lc $var} || $Config{lc $var} || '';
Condition77%7/9
$$self{uc $var} || $ExtUtils::MM_Unix::Config_Override{lc $var} || $ExtUtils::MM_Unix::Config{lc $var} || ''
l!l
180212830
$$self{uc $var} or $ExtUtils::MM_Unix::Config_Override{lc $var} or $ExtUtils::MM_Unix::Config{lc $var}
l!l&&r!l&&!r
218001283
$$self{uc $var} or $ExtUtils::MM_Unix::Config_Override{lc $var}
l!l&&r!l&&!r
203083
MC/DC66%2/3
$$self{uc $var} || $ExtUtils::MM_Unix::Config_Override{lc $var} || $ExtUtils::MM_Unix::Config{lc $var} || ''
$$self{uc $var} $ExtUtils::MM_Unix::Config_Override{lc $var} $ExtUtils::MM_Unix::Config{lc $var}
Truth table75%3/4
A or B or C
A= $$self{uc $var}B= $ExtUtils::MM_Unix::Config_Override{lc $var}C= $ExtUtils::MM_Unix::Config{lc $var}
ABCresult
1XX1
01X1
0011
0000
3359  
3360 3085 ▶ $rprefix .= '/' if $sprefix =~ m|/$|;
Branch: 1 branch
BranchTrueFalseTotal
if $sprefix =~ m[/$] 0 3085 3085
3361  
3362 3085 ▶ warn " prefixify $var => $path\n" if $Verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 3085 3085
3363 3085 ▶ warn " from $sprefix to $rprefix\n" if $Verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 3085 3085
3364  
3365 3085 ▶ if( $self->{ARGS}{PREFIX} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"ARGS"}{"PREFIX"} and not $path =~ s/^\Q$sprefix\E\b/$rprefix/s) 50 3035 3085
Condition100%3/3
$self->{"ARGS"}{"PREFIX"} and not $path =~ s/^\Q$sprefix\E\b/$rprefix/s
!ll&&!rl&&r
29716450
MC/DC100%2/2
$self->{"ARGS"}{"PREFIX"} and not $path =~ s/^\Q$sprefix\E\b/$rprefix/s
$self->{"ARGS"}{"PREFIX"} not $path =~ s/^\Q$sprefix\E\b/$rprefix/s
Truth table100%3/3
A and not(B)
A= $self->{"ARGS"}{"PREFIX"}B= not $path =~ s/^\Q$sprefix\E\b/$rprefix/s
ABresult
0X0
100
111
3366 $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
3367 {
3368  
3369 50 ▶ warn " cannot prefix, using default.\n" if $Verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 50 50
3370 50 ▶ warn " no default!\n" if !$default && $Verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if not $default and $ExtUtils::MM_Unix::Verbose >= 2 0 50 50
Condition33%1/3
not $default and $ExtUtils::MM_Unix::Verbose >= 2
!ll&&!rl&&r
5000
MC/DC0%0/2
not $default and $ExtUtils::MM_Unix::Verbose >= 2
not $default $ExtUtils::MM_Unix::Verbose >= 2
Truth table33%1/3
not(A) and B
A= not $defaultB= $ExtUtils::MM_Unix::Verbose >= 2
ABresult
0X0
100
111
3371  
3372 50 ▶ $path = $self->catdir($rprefix, $default) if $default;
Branch: 1 branch
BranchTrueFalseTotal
if $default 50 0 50
3373 }
3374  
3375 3085 ▶ print " now $path\n" if $Verbose >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $ExtUtils::MM_Unix::Verbose >= 2 0 3085 3085
3376 3085 return $self->{uc $var} = $path;
3377 }
3378  
3379  
3380 =item processPL (o)
3381  
3382 Defines targets to run *.PL files.
3383  
3384 =cut
3385  
3386 217 ▶sub processPL {
Subroutine processPL: called CC=12 SCAR=25.2
Pod documented
3387 217 my $self = shift;
3388 217 my $pl_files = $self->{PL_FILES};
3389  
3390 217 ▶ return "" unless $pl_files;
Branch: 1 branch
BranchTrueFalseTotal
unless $pl_files 0 217 217
3391  
3392 217 my $m = '';
3393 217 foreach my $plfile (sort keys %$pl_files) {
3394 7 my $targets = $pl_files->{$plfile};
3395 my $list =
3396 ref($targets) eq 'HASH' ? [ sort keys %$targets ] :
3397 ref($targets) eq 'ARRAY' ? $pl_files->{$plfile} :
3398 7 ▶ [$pl_files->{$plfile}];
Branch: 2 branches
BranchTrueFalseTotal
ref $targets eq 'HASH' ? : 2 5 7
ref $targets eq 'ARRAY' ? : 1 4 5
3399  
3400 7 foreach my $target (@$list) {
3401 8 ▶ if( $Is{VMS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"}) 0 8 8
3402 0 $plfile = vmsify($self->eliminate_macros($plfile));
3403 0 $target = vmsify($self->eliminate_macros($target));
3404 }
3405  
3406 # Normally a .PL file runs AFTER pm_to_blib so it can have
3407 # blib in its @INC and load the just built modules. BUT if
3408 # the generated module is something in $(TO_INST_PM) which
3409 # pm_to_blib depends on then it can't depend on pm_to_blib
3410 # else we have a dependency loop.
3411 8 my $pm_dep;
3412 my $perlrun;
3413 8 ▶ if( defined $self->{PM}{$target} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'PM'}{$target}) { } 1 7 8
3414 1 $pm_dep = '';
3415 1 $perlrun = 'PERLRUN';
3416 }
3417 else {
3418 7 $pm_dep = 'pm_to_blib';
3419 7 $perlrun = 'PERLRUNINST';
3420 }
3421  
3422 8 my $extra_inputs = '';
3423 8 ▶ if( ref($targets) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $targets eq "HASH") 2 6 8
3424 my $inputs = ref($targets->{$target})
3425 ? $targets->{$target}
3426 2 ▶ : [$targets->{$target}];
Branch: 1 branch
BranchTrueFalseTotal
ref $targets->{$target} ? : 1 1 2
3427  
3428 2 for my $input (@$inputs) {
3429 3 ▶ if( $Is{VMS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"}) 0 3 3
3430 0 $input = vmsify($self->eliminate_macros($input));
3431 }
3432 3 $extra_inputs .= ' '.$input;
3433 }
3434 }
3435  
3436 8 $m .= <<MAKE_FRAG;
3437  
3438 pure_all :: $target
3439 \$(NOECHO) \$(NOOP)
3440  
3441 $target :: $plfile $pm_dep $extra_inputs
3442 \$($perlrun) $plfile $target $extra_inputs
3443 MAKE_FRAG
3444  
3445 }
3446 }
3447  
3448 217 return $m;
3449 }
3450  
3451 =item specify_shell
3452  
3453 Specify SHELL if needed - not done on Unix.
3454  
3455 =cut
3456  
3457 218 ▶sub specify_shell {
Subroutine specify_shell: called CC=1 SCAR=0.0
Pod documented
3458 218 return '';
3459 }
3460  
3461 =item quote_paren
3462  
3463 Backslashes parentheses C<()> in command line arguments.
3464 Doesn't handle recursive Makefile C<$(...)> constructs,
3465 but handles simple ones.
3466  
3467 =cut
3468  
3469 0 ▶sub quote_paren {
Subroutine quote_paren: not called CC=1 SCAR=6.9
Pod documented
3470 0 my $arg = shift;
3471 0 $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...)
3472 0 $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected
3473 0 $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...)
3474 0 return $arg;
3475 }
3476  
3477 =item replace_manpage_separator
3478  
3479 my $man_name = $MM->replace_manpage_separator($file_path);
3480  
3481 Takes the name of a package, which may be a nested package, in the
3482 form 'Foo/Bar.pm' and replaces the slash with C<::> or something else
3483 safe for a man page file name. Returns the replacement.
3484  
3485 =cut
3486  
3487 22 ▶sub replace_manpage_separator {
Subroutine replace_manpage_separator: called CC=1 SCAR=0.0
Pod documented
3488 22 my($self,$man) = @_;
3489  
3490 22 $man =~ s,/+,::,g;
3491 22 return $man;
3492 }
3493  
3494  
3495 =item cd
3496  
3497 On BSD make, will add a countervailing C<cd ..> on each command since
3498 parallel builds run all the commands in a recipe in the same shell.
3499  
3500 =cut
3501  
3502 1685 ▶sub cd {
Subroutine cd: called CC=2 SCAR=7.0
Pod documented
3503 1685 my($self, $dir, @cmds) = @_;
3504 1685 ▶ @cmds = map "$_ && cd $Updir", @cmds if $self->is_make_type('bsdmake');
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_make_type("bsdmake") 0 1685 1685
3505 # No leading tab and no trailing newline makes for easier embedding
3506 1685 my $make_frag = join "\n\t", map "cd $dir && $_", @cmds;
3507 1685 return $make_frag;
3508 }
3509  
3510 =item oneliner
3511  
3512 =cut
3513  
3514 3372 ▶sub oneliner {
Subroutine oneliner: called CC=2 SCAR=6.9
Pod documented
3515 3372 my($self, $cmd, $switches) = @_;
3516 3372 ▶ $switches = [] unless defined $switches;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $switches 453 2919 3372
3517  
3518 # Strip leading and trailing newlines
3519 3372 $cmd =~ s{^\n+}{};
3520 3372 $cmd =~ s{\n+$}{};
3521  
3522 3372 my @cmds = split /\n/, $cmd;
3523 3372 $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds;
3524 3372 $cmd = $self->escape_newlines($cmd);
3525  
3526 3372 $switches = join ' ', @$switches;
3527  
3528 3372 return qq{\$(ABSPERLRUN) $switches -e $cmd --};
3529 }
3530  
3531  
3532 =item quote_literal
3533  
3534 Quotes macro literal value suitable for being used on a command line so
3535 that when expanded by make, will be received by command as given to
3536 this method:
3537  
3538 my $quoted = $mm->quote_literal(q{it isn't});
3539 # returns:
3540 # 'it isn'\''t'
3541 print MAKEFILE "target:\n\techo $quoted\n";
3542 # when run "make target", will output:
3543 # it isn't
3544  
3545 =cut
3546  
3547 19830 ▶sub quote_literal {
Subroutine quote_literal: called CC=3 SCAR=11.0
Pod documented
3548 19830 my($self, $text, $opts) = @_;
3549 19830 ▶ $opts->{allow_variables} = 1 unless defined $opts->{allow_variables};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opts->{"allow_variables"} 6873 12957 19830
3550  
3551 # Quote single quotes
3552 19830 $text =~ s{'}{'\\''}g;
3553  
3554 $text = $opts->{allow_variables}
3555 19830 ▶ ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text);
Branch: 1 branch
BranchTrueFalseTotal
$opts->{'allow_variables'} ? : 6874 12956 19830
3556  
3557 19830 return "'$text'";
3558 }
3559  
3560  
3561 =item escape_newlines
3562  
3563 =cut
3564  
3565 4468 ▶sub escape_newlines {
Subroutine escape_newlines: called CC=1 SCAR=0.0
Pod documented
3566 4468 my($self, $text) = @_;
3567  
3568 4468 $text =~ s{\n}{\\\n}g;
3569  
3570 4468 return $text;
3571 }
3572  
3573  
3574 =item max_exec_len
3575  
3576 Using L<POSIX>::ARG_MAX. Otherwise falling back to 4096.
3577  
3578 =cut
3579  
3580 1091 ▶sub max_exec_len {
Subroutine max_exec_len: called CC=3 SCAR=11.1
Pod documented
3581 1091 my $self = shift;
3582  
3583 1091 ▶ if (!defined $self->{_MAX_EXEC_LEN}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_MAX_EXEC_LEN"}) 218 873 1091
3584 218 ▶ if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $arg_max = eval { do { require POSIX; &POSIX::ARG_MAX } }) { } 0 218 218
3585 0 $self->{_MAX_EXEC_LEN} = $arg_max;
3586 }
3587 else { # POSIX minimum exec size
3588 218 $self->{_MAX_EXEC_LEN} = 4096;
3589 }
3590 }
3591  
3592 1091 return $self->{_MAX_EXEC_LEN};
3593 }
3594  
3595  
3596 =item static (o)
3597  
3598 Defines the static target.
3599  
3600 =cut
3601  
3602 214 ▶sub static {
Subroutine static: called CC=1 SCAR=0.0
Pod documented
3603 # --- Static Loading Sections ---
3604  
3605 214 my($self) = shift;
3606 214 '
3607 ## $(INST_PM) has been moved to the all: target.
3608 ## It remains here for awhile to allow for old usage: "make static"
3609 static :: $(FIRST_MAKEFILE) $(INST_STATIC)
3610 $(NOECHO) $(NOOP)
3611 ';
3612 }
3613  
3614 215 ▶sub static_lib {
Subroutine static_lib: called CC=5 SCAR=16.1
Pod undocumented
3615 215 my($self) = @_;
3616 215 ▶ return '' unless $self->has_link_code;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_link_code 195 20 215
3617 20 my(@m);
3618 my @libs;
3619 20 ▶ if ($self->{XSMULTI}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'XSMULTI'}) { } 5 15 20
3620 5 for my $ext ($self->_xs_list_basenames) {
3621 10 my ($v, $d, $f) = File::Spec->splitpath($ext);
3622 10 my @d = File::Spec->splitdir($d);
3623 10 ▶ shift @d if $d[0] eq 'lib';
Branch: 1 branch
BranchTrueFalseTotal
if $d[0] eq "lib" 10 0 10
3624 10 my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f);
3625 10 my $instfile = $self->catfile($instdir, "$f\$(LIB_EXT)");
3626 10 my $objfile = "$ext\$(OBJ_EXT)";
3627 10 push @libs, [ $objfile, $instfile, $instdir ];
3628 }
3629 } else {
3630 15 @libs = ([ qw($(OBJECT) $(INST_STATIC) $(INST_ARCHAUTODIR)) ]);
3631 }
3632 20 push @m, map { $self->xs_make_static_lib(@$_); } @libs;
3633 20 join "\n", @m;
3634 }
3635  
3636 =item xs_make_static_lib
3637  
3638 Defines the recipes for the C<static_lib> section.
3639  
3640 =cut
3641  
3642 25 ▶sub xs_make_static_lib {
Subroutine xs_make_static_lib: called CC=1 SCAR=0.0
Pod documented
3643 25 my ($self, $from, $to, $todir) = @_;
3644 25 my @m = sprintf '%s: %s $(MYEXTLIB) %s$(DFSEP).exists'."\n", $to, $from, $todir;
3645 25 push @m, "\t\$(RM_F) \"\$\@\"\n";
3646 25 push @m, $self->static_lib_fixtures;
3647 25 push @m, $self->static_lib_pure_cmd($from);
3648 25 push @m, "\t\$(CHMOD) \$(PERM_RWX) \$\@\n";
3649 25 push @m, $self->static_lib_closures($todir);
3650 25 join '', @m;
3651 }
3652  
3653 =item static_lib_closures
3654  
3655 Records C<$(EXTRALIBS)> in F<extralibs.ld> and F<$(PERL_SRC)/ext.libs>.
3656  
3657 =cut
3658  
3659 25 ▶sub static_lib_closures {
Subroutine static_lib_closures: called CC=3 SCAR=12.0
Pod documented
3660 25 my ($self, $todir) = @_;
3661 25 my @m = sprintf <<'MAKE_FRAG', $todir;
3662 $(NOECHO) $(ECHO) "$(EXTRALIBS)" > %s$(DFSEP)extralibs.ld
3663 MAKE_FRAG
3664 # Old mechanism - still available:
3665 25 ▶ push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PERL_SRC"} and $self->{"EXTRALIBS"} 0 25 25
Condition33%1/3
$self->{"PERL_SRC"} and $self->{"EXTRALIBS"}
!ll&&!rl&&r
2500
MC/DC0%0/2
$self->{"PERL_SRC"} and $self->{"EXTRALIBS"}
$self->{"PERL_SRC"} $self->{"EXTRALIBS"}
Truth table33%1/3
A and B
A= $self->{"PERL_SRC"}B= $self->{"EXTRALIBS"}
ABresult
0X0
100
111
3666 $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)$(DFSEP)ext.libs
3667 MAKE_FRAG
3668 25 @m;
3669 }
3670  
3671 =item static_lib_fixtures
3672  
3673 Handles copying C<$(MYEXTLIB)> as starter for final static library that
3674 then gets added to.
3675  
3676 =cut
3677  
3678 25 ▶sub static_lib_fixtures {
Subroutine static_lib_fixtures: called CC=2 SCAR=6.9
Pod documented
3679 25 my ($self) = @_;
3680 # If this extension has its own library (eg SDBM_File)
3681 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
3682 25 ▶ return unless $self->{MYEXTLIB};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"MYEXTLIB"} 23 2 25
3683 2 "\t\$(CP) \$(MYEXTLIB) \"\$\@\"\n";
3684 }
3685  
3686 =item static_lib_pure_cmd
3687  
3688 Defines how to run the archive utility.
3689  
3690 =cut
3691  
3692 27 ▶sub static_lib_pure_cmd {
Subroutine static_lib_pure_cmd: called CC=3 SCAR=12.3
Pod documented
3693 27 my ($self, $from) = @_;
3694 27 my $ar;
3695 27 ▶ if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'FULL_AR'} and -x $self->{'FULL_AR'}) { } 27 0 27
Condition33%1/3
exists $self->{"FULL_AR"} and -x $self->{"FULL_AR"}
!ll&&!rl&&r
0027
MC/DC0%0/2
exists $self->{"FULL_AR"} and -x $self->{"FULL_AR"}
exists $self->{"FULL_AR"} -x $self->{"FULL_AR"}
Truth table33%1/3
A and B
A= exists $self->{"FULL_AR"}B= -x $self->{"FULL_AR"}
ABresult
0X0
100
111
3696 # Prefer the absolute pathed ar if available so that PATH
3697 # doesn't confuse us. Perl itself is built with the full_ar.
3698 27 $ar = 'FULL_AR';
3699 } else {
3700 0 $ar = 'AR';
3701 }
3702 27 sprintf <<'MAKE_FRAG', $ar, $from;
3703 $(%s) $(AR_STATIC_ARGS) "$@" %s
3704 $(RANLIB) "$@"
3705 MAKE_FRAG
3706 }
3707  
3708 =item staticmake (o)
3709  
3710 Calls makeaperl.
3711  
3712 =cut
3713  
3714 217 ▶sub staticmake {
Subroutine staticmake: called CC=2 SCAR=6.9
Pod documented
3715 217 my($self, %attribs) = @_;
3716 217 my(@static);
3717  
3718 217 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
3719  
3720 # And as it's not yet built, we add the current extension
3721 # but only if it has some C code (or XS code, which implies C code)
3722 217 ▶ if (@{$self->{C}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{"C"};}) 21 196 217
3723 @static = $self->catfile($self->{INST_ARCHLIB},
3724 "auto",
3725 $self->{FULLEXT},
3726 21 "$self->{BASEEXT}$self->{LIB_EXT}"
3727 );
3728 }
3729  
3730 # Either we determine now, which libraries we will produce in the
3731 # subdirectories or we do it at runtime of the make.
3732  
3733 # We could ask all subdir objects, but I cannot imagine, why it
3734 # would be necessary.
3735  
3736 # Instead we determine all libraries for the new perl at
3737 # runtime.
3738 217 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
3739  
3740 $self->makeaperl(MAKE => $self->{MAKEFILE},
3741 DIRS => \@searchdirs,
3742 STAT => \@static,
3743 INCL => \@perlinc,
3744 TARGET => $self->{MAP_TARGET},
3745 TMP => "",
3746 LIBPERL => $self->{LIBPERL_A}
3747 217 );
3748 }
3749  
3750 =item subdir_x (o)
3751  
3752 Helper subroutine for subdirs
3753  
3754 =cut
3755  
3756 78 ▶sub subdir_x {
Subroutine subdir_x: called CC=1 SCAR=0.0
Pod documented
3757 78 my($self, $subdir) = @_;
3758  
3759 78 my $subdir_cmd = $self->cd($subdir,
3760 '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)'
3761 );
3762 78 return sprintf <<'EOT', $subdir_cmd;
3763  
3764 subdirs ::
3765 $(NOECHO) %s
3766 EOT
3767  
3768 }
3769  
3770 =item subdirs (o)
3771  
3772 Defines targets to process subdirectories.
3773  
3774 =cut
3775  
3776 217 ▶sub subdirs {
Subroutine subdirs: called CC=3 SCAR=11.0
Pod documented
3777 # --- Sub-directory Sections ---
3778 217 my($self) = shift;
3779 217 my(@m);
3780 # This method provides a mechanism to automatically deal with
3781 # subdirectories containing further Makefile.PL scripts.
3782 # It calls the subdir_x() method for each subdirectory.
3783 217 foreach my $dir (@{$self->{DIR}}){
3784 78 push @m, $self->subdir_x($dir);
3785 #### print "Including $dir subdirectory\n";
3786 }
3787 217 ▶ if (@m){
Branch: 1 branch
BranchTrueFalseTotal
if (@m) { } 78 139 217
3788 78 unshift @m, <<'EOF';
3789  
3790 # The default clean, realclean and test targets in this Makefile
3791 # have automatically been given entries for each subdir.
3792  
3793 EOF
3794 } else {
3795 139 push(@m, "\n# none")
3796 }
3797 217 join('',@m);
3798 }
3799  
3800 =item test (o)
3801  
3802 Defines the test targets.
3803  
3804 =cut
3805  
3806 216 ▶sub test {
Subroutine test: called CC=20 SCAR=30.5
Pod documented
3807 216 my($self, %attribs) = @_;
3808 216 ▶ my $tests = $attribs{TESTS} || '';
Condition33%1/3
$attribs{'TESTS'} || ''
l!l
02160
MC/DC0%0/1
$attribs{'TESTS'} || ''
$attribs{'TESTS'}
Truth table50%1/2
A
A= $attribs{'TESTS'}
Aresult
11
00
3809 216 ▶ if (!$tests && -d 't' && defined $attribs{RECURSIVE_TEST_FILES}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $tests and -d 't' and defined $attribs{'RECURSIVE_TEST_FILES'}) { } 0 216 216
elsif (not $tests and -d 't') { } 160 56 216
Condition66%4/6
not $tests and -d "t" and defined $attribs{"RECURSIVE_TEST_FILES"}
!ll&&!rl&&r
561600
not $tests and -d "t"
!ll&&!rl&&r
056160
MC/DC0%0/3
not $tests and -d "t" and defined $attribs{"RECURSIVE_TEST_FILES"}
not $tests -d "t" defined $attribs{"RECURSIVE_TEST_FILES"}
Truth table50%2/4
not(A) and B and C
A= not $testsB= -d "t"C= defined $attribs{"RECURSIVE_TEST_FILES"}
ABCresult
0XX0
10X0
1100
1111
3810 0 $tests = $self->find_tests_recursive;
3811 }
3812 ▶ elsif (!$tests && -d 't') {
Condition66%2/3
not $tests and -d "t"
!ll&&!rl&&r
056160
MC/DC50%1/2
not $tests and -d "t"
not $tests -d "t"
Truth table66%2/3
not(A) and B
A= not $testsB= -d "t"
ABresult
0X0
100
111
3813 160 $tests = $self->find_tests;
3814 }
3815 # have to do this because nmake is broken
3816 216 ▶ $tests =~ s!/!\\!g if $self->is_make_type('nmake');
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_make_type("nmake") 0 216 216
3817 # note: 'test.pl' name is also hardcoded in init_dirscan()
3818 216 my @m;
3819 216 ▶ my $default_testtype = $Config{usedl} ? 'dynamic' : 'static';
Branch: 1 branch
BranchTrueFalseTotal
$ExtUtils::MM_Unix::Config{'usedl'} ? : 214 2 216
3820 216 push @m, <<EOF;
3821 TEST_VERBOSE=0
3822 TEST_TYPE=test_\$(LINKTYPE)
3823 TEST_FILE = test.pl
3824 TEST_FILES = $tests
3825 TESTDB_SW = -d
3826  
3827 testdb :: testdb_\$(LINKTYPE)
3828 \$(NOECHO) \$(NOOP)
3829  
3830 test :: \$(TEST_TYPE)
3831 \$(NOECHO) \$(NOOP)
3832  
3833 # Occasionally we may face this degenerate target:
3834 test_ : test_$default_testtype
3835 \$(NOECHO) \$(NOOP)
3836  
3837 EOF
3838  
3839 216 for my $linktype (qw(dynamic static)) {
3840 432 my $directdeps = join ' ', grep !$self->{SKIPHASH}{$_}, $linktype, "pure_all"; # no depend on a linktype if SKIPped
3841 432 push @m, "subdirs-test_$linktype :: $directdeps\n";
3842 432 foreach my $dir (@{ $self->{DIR} }) {
3843 156 my $test = $self->cd($dir, "\$(MAKE) test_$linktype \$(PASTHRU)");
3844 156 push @m, "\t\$(NOECHO) $test\n";
3845 }
3846 432 push @m, "\n";
3847 432 ▶ if ($tests or -f "test.pl") {
Branch: 1 branch
BranchTrueFalseTotal
if ($tests or -f 'test.pl') { } 320 112 432
Condition66%2/3
$tests or -f "test.pl"
l!l&&r!l&&!r
3200112
MC/DC50%1/2
$tests or -f "test.pl"
$tests -f "test.pl"
Truth table66%2/3
A or B
A= $testsB= -f "test.pl"
ABresult
1X1
011
000
3848 320 for my $testspec ([ '', '' ], [ 'db', ' $(TESTDB_SW)' ]) {
3849 640 my ($db, $switch) = @$testspec;
3850 640 my ($command, $deps);
3851 # if testdb, build all but don't test all
3852 640 ▶ $deps = $db eq 'db' ? $directdeps : "subdirs-test_$linktype";
Branch: 1 branch
BranchTrueFalseTotal
$db eq 'db' ? : 320 320 640
3853 640 ▶ if ($linktype eq 'static' and $self->needs_linking) {
Branch: 1 branch
BranchTrueFalseTotal
if ($linktype eq 'static' and $self->needs_linking) { } 30 610 640
Condition100%3/3
$linktype eq "static" and $self->needs_linking
!ll&&!rl&&r
32029030
MC/DC100%2/2
$linktype eq "static" and $self->needs_linking
$linktype eq "static" $self->needs_linking
Truth table100%3/3
A and B
A= $linktype eq "static"B= $self->needs_linking
ABresult
0X0
100
111
3854 30 my $target = File::Spec->rel2abs('$(MAP_TARGET)');
3855 30 $command = qq{"$target" \$(MAP_PERLINC)};
3856 30 $deps .= ' $(MAP_TARGET)';
3857 } else {
3858 610 $command = '$(FULLPERLRUN)' . $switch;
3859 }
3860 640 push @m, "test${db}_$linktype :: $deps\n";
3861 640 ▶ if ($db eq 'db') {
Branch: 1 branch
BranchTrueFalseTotal
if ($db eq 'db') { } 320 320 640
3862 320 push @m, $self->test_via_script($command, '$(TEST_FILE)')
3863 } else {
3864 320 ▶ push @m, $self->test_via_script($command, '$(TEST_FILE)')
Branch: 1 branch
BranchTrueFalseTotal
if -f "test.pl" 146 174 320
3865 if -f "test.pl";
3866 320 ▶ push @m, $self->test_via_harness($command, '$(TEST_FILES)')
Branch: 1 branch
BranchTrueFalseTotal
if $tests 320 0 320
3867 if $tests;
3868 }
3869 640 push @m, "\n";
3870 }
3871 } else {
3872 112 push @m, _sprintf562 <<'EOF', $linktype;
3873 testdb_%1$s test_%1$s :: subdirs-test_%1$s
3874 $(NOECHO) $(ECHO) 'No tests defined for $(NAME) extension.'
3875  
3876 EOF
3877 }
3878 }
3879  
3880 216 join "", @m;
3881 }
3882  
3883 =item test_via_harness (override)
3884  
3885 For some reason which I forget, Unix machines like to have
3886 PERL_DL_NONLAZY set for tests.
3887  
3888 =cut
3889  
3890 320 ▶sub test_via_harness {
Subroutine test_via_harness: called CC=1 SCAR=0.0
Pod documented
3891 320 my($self, $perl, $tests) = @_;
3892 320 return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests);
3893 }
3894  
3895 =item test_via_script (override)
3896  
3897 Again, the PERL_DL_NONLAZY thing.
3898  
3899 =cut
3900  
3901 466 ▶sub test_via_script {
Subroutine test_via_script: called CC=1 SCAR=0.0
Pod documented
3902 466 my($self, $perl, $script) = @_;
3903 466 return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script);
3904 }
3905  
3906  
3907 =item tool_xsubpp (o)
3908  
3909 Determines typemaps, xsubpp version, prototype behaviour.
3910  
3911 =cut
3912  
3913 217 ▶sub tool_xsubpp {
Subroutine tool_xsubpp: called CC=19 SCAR=34.4
Pod documented
3914 217 my($self) = shift;
3915 217 ▶ return "" unless $self->needs_linking;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
3916  
3917 21 my $xsdir;
3918 21 my @xsubpp_dirs = @INC;
3919  
3920 # Make sure we pick up the new xsubpp if we're building perl.
3921 21 ▶ unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"PERL_CORE"} 0 21 21
3922  
3923 21 my $foundxsubpp = 0;
3924 21 foreach my $dir (@xsubpp_dirs) {
3925 168 $xsdir = $self->catdir($dir, 'ExtUtils');
3926 168 ▶ if( -r $self->catfile($xsdir, "xsubpp") ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-r $self->catfile($xsdir, "xsubpp")) 21 147 168
3927 21 $foundxsubpp = 1;
3928 21 last;
3929 }
3930 }
3931 21 ▶ die "ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp" if !$foundxsubpp;
Branch: 1 branch
BranchTrueFalseTotal
unless $foundxsubpp 0 21 21
3932  
3933 21 my $tmdir = $self->catdir($self->{PERL_LIB},"ExtUtils");
3934 21 my(@tmdeps) = $self->catfile($tmdir,'typemap');
3935 21 ▶ if( $self->{TYPEMAPS} ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"TYPEMAPS"}) 21 0 21
3936 21 foreach my $typemap (@{$self->{TYPEMAPS}}){
3937 8 ▶ if( ! -f $typemap ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not -f $typemap) { } 0 8 8
3938 0 warn "Typemap $typemap not found.\n";
3939 }
3940 else {
3941 8 ▶ $typemap = vmsify($typemap) if $Is{VMS};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"VMS"} 0 8 8
3942 8 push(@tmdeps, $typemap);
3943 }
3944 }
3945 }
3946 21 ▶ push(@tmdeps, "typemap") if -f "typemap";
Branch: 1 branch
BranchTrueFalseTotal
if -f "typemap" 0 21 21
3947 # absolutised because with deep-located typemaps, eg "lib/XS/typemap",
3948 # if xsubpp is called from top level with
3949 # $(XSUBPP) ... -typemap "lib/XS/typemap" "lib/XS/Test.xs"
3950 # it says:
3951 # Can't find lib/XS/type map in (fulldir)/lib/XS
3952 # because ExtUtils::ParseXS::process_file chdir's to .xs file's
3953 # location. This is the only way to get all specified typemaps used,
3954 # wherever located.
3955 21 my @tmargs = map { '-typemap '.$self->quote_literal(File::Spec->rel2abs($_)) } @tmdeps;
3956 21 $_ = $self->quote_dep($_) for @tmdeps;
3957 21 ▶ if( exists $self->{XSOPT} ){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"XSOPT"}) 0 21 21
3958 0 unshift( @tmargs, $self->{XSOPT} );
3959 }
3960  
3961 21 ▶ if ($Is{VMS} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($Is{"VMS"} and $ExtUtils::MM_Unix::Config{"ldflags"} and $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]i and not exists $self->{"XSOPT"} && $self->{"XSOPT"} =~ /linenumbers/) 0 21 21
Condition25%3/12
$Is{"VMS"} and $ExtUtils::MM_Unix::Config{"ldflags"} and $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]i and not exists $self->{"XSOPT"} && $self->{"XSOPT"} =~ /linenumbers/
!ll&&!rl&&r
2100
$Is{"VMS"} and $ExtUtils::MM_Unix::Config{"ldflags"} and $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]i
!ll&&!rl&&r
2100
$Is{"VMS"} and $ExtUtils::MM_Unix::Config{"ldflags"}
!ll&&!rl&&r
2100
exists $self->{'XSOPT'} && $self->{'XSOPT'} =~ /linenumbers/
!ll&&!rl&&r
000
MC/DC0%0/5
$Is{"VMS"} and $ExtUtils::MM_Unix::Config{"ldflags"} and $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]i and not exists $self->{"XSOPT"} && $self->{"XSOPT"} =~ /linenumbers/
$Is{"VMS"} $ExtUtils::MM_Unix::Config{"ldflags"} $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]i exists $self->{'XSOPT'} $self->{'XSOPT'} =~ /linenumbers/
Truth table16%1/6
A and B and C and not(D && E)
A= $Is{"VMS"}B= $ExtUtils::MM_Unix::Config{"ldflags"}C= $ExtUtils::MM_Unix::Config{"ldflags"} =~ m[/Debug]iD= exists $self->{'XSOPT'}E= $self->{'XSOPT'} =~ /linenumbers/
ABCDEresult
0XXXX0
10XXX0
110XX0
111110
1110X1
111101
3962 $Config{'ldflags'} &&
3963 $Config{'ldflags'} =~ m!/Debug!i &&
3964 (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)
3965 )
3966 {
3967 0 unshift(@tmargs,'-nolinenumbers');
3968 }
3969  
3970  
3971 21 ▶ $self->{XSPROTOARG} = "-noprototypes" unless defined $self->{XSPROTOARG};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"XSPROTOARG"} 21 0 21
3972 21 $self->tool_xsubpp_emit($xsdir, \@tmdeps, \@tmargs);
3973 }
3974  
3975 21 ▶sub tool_xsubpp_emit {
Subroutine tool_xsubpp_emit: called CC=1 SCAR=0.0
Pod undocumented
3976 21 my ($self, $xsdir, $tmdeps, $tmargs) = @_;
3977 21 my $xsdirdep = $self->quote_dep($xsdir);
3978 # -dep for use when dependency not command
3979 21 return qq{
3980 XSUBPPDIR = $xsdir
3981 XSUBPP = "\$(XSUBPPDIR)\$(DFSEP)xsubpp"
3982 XSUBPPRUN = \$(PERLRUN) \$(XSUBPP)
3983 XSPROTOARG = $self->{XSPROTOARG}
3984 XSUBPPDEPS = @$tmdeps $xsdirdep\$(DFSEP)xsubpp
3985 XSUBPPARGS = @$tmargs
3986 XSUBPP_EXTRA_ARGS =
3987 };
3988 }
3989  
3990 =item all_target
3991  
3992 Build man pages, too
3993  
3994 =cut
3995  
3996 213 ▶sub all_target {
Subroutine all_target: called CC=1 SCAR=0.0
Pod documented
3997 213 my $self = shift;
3998  
3999 213 return <<'MAKE_EXT';
4000 all :: pure_all manifypods
4001 $(NOECHO) $(NOOP)
4002 MAKE_EXT
4003 }
4004  
4005 =item top_targets (o)
4006  
4007 Defines the targets all, subdirs, config, and O_FILES
4008  
4009 =cut
4010  
4011 213 ▶sub top_targets {
Subroutine top_targets: called CC=6 SCAR=18.8
Pod documented
4012 # --- Target Sections ---
4013  
4014 213 my($self) = shift;
4015 213 my(@m);
4016  
4017 213 ▶ push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"SKIPHASH"}{"all"} 213 0 213
4018  
4019 213 push @m, sprintf <<'EOF';
4020 pure_all :: config pm_to_blib subdirs linkext
4021 $(NOECHO) $(NOOP)
4022  
4023 subdirs :: $(MYEXTLIB)
4024 $(NOECHO) $(NOOP)
4025  
4026 config :: $(FIRST_MAKEFILE) blibdirs
4027 $(NOECHO) $(NOOP)
4028 EOF
4029  
4030 push @m, '
4031 $(O_FILES) : $(H_FILES)
4032 213 ▶' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->{"O_FILES"} or [];} and @{$self->{"H"} or [];} 0 213 213
Condition57%4/7
@{$self->{"O_FILES"} or [];} and @{$self->{"H"} or [];}
!ll&&!rl&&r
195180
$self->{'O_FILES'} || []
l!l
2130
$self->{'H'} || []
l!l
180
MC/DC0%0/2
@{$self->{"O_FILES"} or [];} and @{$self->{"H"} or [];}
@{$self->{"O_FILES"} or [];} @{$self->{"H"} or [];}
MC/DC0%0/1
$self->{'O_FILES'} || []
$self->{'O_FILES'}
MC/DC0%0/1
$self->{'H'} || []
$self->{'H'}
Truth table66%2/3
A and B
A= @{$self->{"O_FILES"} or [];}B= @{$self->{"H"} or [];}
ABresult
0X0
100
111
Truth table50%1/2
A
A= $self->{'O_FILES'}
Aresult
11
00
Truth table50%1/2
A
A= $self->{'H'}
Aresult
11
00
4033  
4034 213 push @m, q{
4035 help :
4036 perldoc ExtUtils::MakeMaker
4037 };
4038  
4039 213 join('',@m);
4040 }
4041  
4042 =item writedoc
4043  
4044 Obsolete, deprecated method. Not used since Version 5.21.
4045  
4046 =cut
4047  
4048 0 ▶sub writedoc {
Subroutine writedoc: not called CC=2 SCAR=17.9
Pod documented
4049 # --- perllocal.pod section ---
4050 0 my($self,$what,$name,@attribs)=@_;
4051 0 ▶ my $time = gmtime($ENV{SOURCE_DATE_EPOCH} || time);
Condition0%0/2
$ENV{'SOURCE_DATE_EPOCH'} || time
l!l
00
MC/DC0%0/1
$ENV{'SOURCE_DATE_EPOCH'} || time
$ENV{'SOURCE_DATE_EPOCH'}
Truth table0%0/2
A
A= $ENV{'SOURCE_DATE_EPOCH'}
Aresult
11
00
4052 0 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
4053 0 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
4054 0 print "\n\n=back\n\n";
4055 }
4056  
4057 =item xs_c (o)
4058  
4059 Defines the suffix rules to compile XS files to C.
4060  
4061 =cut
4062  
4063 217 ▶sub xs_c {
Subroutine xs_c: called CC=2 SCAR=6.9
Pod documented
4064 217 my($self) = shift;
4065 217 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
4066 21 '
4067 .xs.c:
4068 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc
4069 $(MV) $*.xsc $*.c
4070 ';
4071 }
4072  
4073 =item xs_cpp (o)
4074  
4075 Defines the suffix rules to compile XS files to C++.
4076  
4077 =cut
4078  
4079 0 ▶sub xs_cpp {
Subroutine xs_cpp: not called CC=2 SCAR=17.9
Pod documented
4080 0 my($self) = shift;
4081 0 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 0 0 0
4082 0 '
4083 .xs.cpp:
4084 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc
4085 $(MV) $*.xsc $*.cpp
4086 ';
4087 }
4088  
4089 =item xs_o (o)
4090  
4091 Defines suffix rules to go from XS to object files directly. This was
4092 originally only intended for broken make implementations, but is now
4093 necessary for per-XS file under C<XSMULTI>, since each XS file might
4094 have an individual C<$(VERSION)>.
4095  
4096 =cut
4097  
4098 217 ▶sub xs_o {
Subroutine xs_o: called CC=9 SCAR=22.1
Pod documented
4099 217 my ($self) = @_;
4100 217 ▶ return '' unless $self->needs_linking();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->needs_linking 196 21 217
4101 21 ▶ my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'XSMULTI'} ? : 5 16 21
4102 21 my $dbgout = $self->dbgoutflag;
4103 21 ▶ $dbgout = $dbgout ? "$dbgout " : '';
Branch: 1 branch
BranchTrueFalseTotal
$dbgout ? : 0 21 21
4104 21 my $frag = '';
4105 # dmake makes noise about ambiguous rule
4106 21 ▶ $frag .= sprintf <<'EOF', $dbgout, $m_o unless $self->is_make_type('dmake');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_make_type("dmake") 21 0 21
4107 .xs$(OBJ_EXT) :
4108 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc
4109 $(MV) $*.xsc $*.c
4110 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) %s$*.c %s
4111 EOF
4112 21 ▶ if ($self->{XSMULTI}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"XSMULTI"}) 5 16 21
4113 5 for my $ext ($self->_xs_list_basenames) {
4114 10 my $pmfile = "$ext.pm";
4115 10 ▶ croak "$ext.xs has no matching $pmfile: $!" unless -f $pmfile;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $pmfile 0 10 10
4116 10 my $version = $self->parse_version($pmfile);
4117 10 my $cccmd = $self->{CONST_CCCMD};
4118 10 $cccmd =~ s/^\s*CCCMD\s*=\s*//;
4119 10 $cccmd =~ s/\$\(DEFINE_VERSION\)/-DVERSION=\\"$version\\"/;
4120 10 $cccmd =~ s/\$\(XS_DEFINE_VERSION\)/-DXS_VERSION=\\"$version\\"/;
4121 10 $self->_xsbuild_replace_macro($cccmd, 'xs', $ext, 'INC');
4122 10 my $define = '$(DEFINE)';
4123 10 $self->_xsbuild_replace_macro($define, 'xs', $ext, 'DEFINE');
4124 # 1 2 3 4 5
4125 10 $frag .= _sprintf562 <<'EOF', $ext, $cccmd, $m_o, $define, $dbgout;
4126  
4127 %1$s$(OBJ_EXT): %1$s.xs
4128 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc
4129 $(MV) $*.xsc $*.c
4130 %2$s $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) %4$s %5$s$*.c %3$s
4131 EOF
4132 }
4133 }
4134 21 ▶ $frag =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/sg if $Is{ApplCor};
Branch: 1 branch
BranchTrueFalseTotal
if $Is{"ApplCor"} 0 21 21
4135 21 $frag;
4136 }
4137  
4138 # param gets modified
4139 20 ▶sub _xsbuild_replace_macro {
Subroutine _xsbuild_replace_macro: called CC=2 SCAR=6.9
4140 20 my ($self, undef, $xstype, $ext, $varname) = @_;
4141 20 my $value = $self->_xsbuild_value($xstype, $ext, $varname);
4142 20 ▶ return unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 19 1 20
4143 1 $_[1] =~ s/\$\($varname\)/$value/;
4144 }
4145  
4146 40 ▶sub _xsbuild_value {
Subroutine _xsbuild_value: called CC=3 SCAR=11.0
4147 40 my ($self, $xstype, $ext, $varname) = @_;
4148 return $self->{XSBUILD}{$xstype}{$ext}{$varname}
4149 40 ▶ if $self->{XSBUILD}{$xstype}{$ext}{$varname};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"XSBUILD"}{$xstype}{$ext}{$varname} 2 38 40
4150 return $self->{XSBUILD}{$xstype}{all}{$varname}
4151 38 ▶ if $self->{XSBUILD}{$xstype}{all}{$varname};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"XSBUILD"}{$xstype}{"all"}{$varname} 0 38 38
4152 38 ();
4153 }
4154  
4155 96 1;
4156  
4157 =back
4158  
4159 =head1 SEE ALSO
4160  
4161 L<ExtUtils::MakeMaker>
4162  
4163 =cut
4164  
4165 __END__
« lib/ExtUtils/MM_OS2.pm ↑ Summary lib/ExtUtils/MakeMaker.pm »