lib/ExtUtils/MM_Unix.pm

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