Install.pm

filter: Statementstmt 59.5% 523 / 879 Branchbran 38.5% 151 / 392 Conditioncond 31.0% 80 / 258 MC/DCmcdc 4.1% 6 / 146 Subroutinesub 77.9% 67 / 86 Podpod 4.5% 2 / 44 totaltotal 45.9% 829 / 1805 CC 323 SCAR 43.7
CC
323
Cov
49%
process_CLIB
526.6
process_test
454.2
process_INSTALL_SKIP
92.9
CRAP 79.1
« Install/FrozenShit/ParseXS/Node.pm ↑ Summary Install/Util.pm »
1 package XS::Install;
2 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use Cwd qw/getcwd abs_path/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use ExtUtils::MakeMaker;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use XS::Loader;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use XS::Install::Deps;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use XS::Install::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use XS::Install::Payload;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶use XS::Install::CMake;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 11 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 11 our $VERSION = '1.5.2';
16 11 my $THIS_MODULE = 'XS::Install';
17  
18 11 our @EXPORT_OK = qw/write_makefile not_available/;
19 11 our @EXPORT;
20  
21 11 ▶if ($0 =~ /Makefile.PL$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($0 =~ /Makefile.PL$/) 0 11 11
22 0 @EXPORT = qw/write_makefile not_available/;
23 0 _require_makemaker();
24 }
25  
26 11 my $xs_mask = '*.xs';
27 11 my $c_mask = '*.c *.cc *.cpp *.cxx';
28 11 my $h_mask = '*.h *.hh *.hpp *.hxx';
29 11 my $map_mask = '*.map';
30  
31 11 my $win32 = $^O eq 'MSWin32';
32 11 my $linux = $^O eq 'linux';
33 11 my $freebsd = $^O eq 'freebsd';
34 11 my $mac = $^O eq 'darwin';
35 11 my $dragonfly = $^O eq 'dragonfly';
36 11 my $netbsd = $^O eq 'netbsd';
37 11 my $openbsd = $^O eq 'openbsd';
38 11 my $solaris = $^O eq 'solaris';
39  
40 11 ▶my $native_bsd_make = $freebsd || $dragonfly || $netbsd || $openbsd || $solaris;
Condition33%4/12
$freebsd || $dragonfly || $netbsd || $openbsd || $solaris
l!l&&r!l&&!r
0011
$freebsd or $dragonfly or $netbsd or $openbsd
l!l&&r!l&&!r
0011
$freebsd or $dragonfly or $netbsd
l!l&&r!l&&!r
0011
$freebsd or $dragonfly
l!l&&r!l&&!r
0011
MC/DC0%0/5
$freebsd || $dragonfly || $netbsd || $openbsd || $solaris
$freebsd $dragonfly $netbsd $openbsd $solaris
Truth table16%1/6
A or B or C or D || E
A= $freebsdB= $dragonflyC= $netbsdD= $openbsdE= $solaris
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
41 11 ▶my $fix_bsd_make_j = $freebsd || $dragonfly || $netbsd;
Condition33%2/6
$freebsd || $dragonfly || $netbsd
l!l&&r!l&&!r
0011
$freebsd or $dragonfly
l!l&&r!l&&!r
0011
MC/DC0%0/3
$freebsd || $dragonfly || $netbsd
$freebsd $dragonfly $netbsd
Truth table25%1/4
A or B || C
A= $freebsdB= $dragonflyC= $netbsd
ABCresult
1XX1
01X1
0011
0000
42  
43 0 ▶sub write_makefile {
Subroutine write_makefile: not called CC=2 SCAR=17.9
Pod documented
44 0 _require_makemaker();
45  
46 0 my ($main_params, $test_params) = makemaker_args(@_);
47  
48 0 MY::init_methods();
49 0 WriteMakefile(%$main_params);
50  
51 0 ▶ if ($test_params) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test_params) 0 0 0
52 0 MY::init_methods();
53 0 WriteMakefile(%$test_params);
54 }
55 }
56  
57 31 ▶sub makemaker_args {
Subroutine makemaker_args: called CC=6 SCAR=18.0
Pod undocumented
58 31 ▶ my $params = ref($_[0]) eq 'HASH' ? $_[0] : {@_};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 31 31
59 31 _sync();
60 31 ▶ die "You must define a NAME param" unless $params->{NAME};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"NAME"} 0 31 31
61  
62 31 pre_process($params);
63 31 process_FROM($params);
64 31 process_REQUIRES($params);
65 31 process_BIN_DEPS($params);
66 31 process_PARSE_XS($params);
67 31 process_CPLUS($params);
68 31 process_CCFLAGS($params);
69 31 $params->{OPTIMIZE} = merge_optimize($Config{optimize}, '-O2', $params->{OPTIMIZE});
70 31 process_PKG_CONFIG($params);
71 31 process_SANITIZE($params);
72 31 process_CLIB($params);
73 31 process_binary($params);
74 31 process_PM($params);
75 31 process_PAYLOAD($params);
76 31 process_LD($params);
77  
78 31 my $test_mm_args;
79 31 ▶ if ($params->{_XSTEST}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{'_XSTEST'}) { } 0 31 31
80 0 process_test_makefile($params);
81 } else {
82 31 $test_mm_args = process_test($params);
83 31 my $cmake_params = process_cmake_test($params, $params->{CMAKE_PARAMS}, $test_mm_args);
84 31 ▶ run_cmake($params, $cmake_params, $test_mm_args) if ($cmake_params);
Branch: 1 branch
BranchTrueFalseTotal
if $cmake_params 0 31 31
85 }
86 31 process_BIN_SHARE($params);
87 31 attach_BIN_DEPENDENT($params);
88 31 warn_BIN_DEPENDENT($params);
89 31 fix_flags($params);
90  
91 31 process_INSTALL_SKIP($params);
92 31 post_process($params);
93  
94 31 ▶ return ($params, $test_mm_args) if wantarray();
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 11 20 31
95 20 return $params;
96 }
97  
98 31 ▶sub pre_process {
Subroutine pre_process: called CC=20 SCAR=41.5
Pod undocumented
99 31 my $params = shift;
100  
101 31 my $postamble = $params->{postamble};
102 31 ▶ if ($postamble) {
Branch: 1 branch
BranchTrueFalseTotal
if ($postamble) 0 31 31
103 0 my $ref = ref $postamble;
104 0 ▶ if (!$ref) { $postamble = [$postamble] }
Branch: 3 branches
BranchTrueFalseTotal
if (not $ref) { } 0 0 0
elsif ($ref eq 'HASH') { } 0 0 0
elsif ($ref ne 'ARRAY') { } 0 0 0
105 0 elsif ($ref eq 'HASH') { $postamble = [values %$postamble] }
106 0 elsif ($ref ne 'ARRAY') { die "postamble must be string or array ref" }
107 }
108 31 ▶ $postamble ||= [];
Condition50%1/2
$postamble ||= []
l!l
031
MC/DC0%0/1
$postamble ||= []
$postamble
Truth table50%1/2
A
A= $postamble
Aresult
11
00
109 31 $params->{postamble} = $postamble;
110  
111 31 ▶ $params->{clean} ||= {};
Condition50%1/2
$params->{"clean"} ||= {}
l!l
031
MC/DC0%0/1
$params->{"clean"} ||= {}
$params->{"clean"}
Truth table50%1/2
A
A= $params->{"clean"}
Aresult
11
00
112 31 ▶ $params->{clean}{FILES} ||= '';
Condition50%1/2
$params->{"clean"}{"FILES"} ||= ""
l!l
031
MC/DC0%0/1
$params->{"clean"}{"FILES"} ||= ""
$params->{"clean"}{"FILES"}
Truth table50%1/2
A
A= $params->{"clean"}{"FILES"}
Aresult
11
00
113  
114 31 ▶ if (my $comp = ($ENV{COMPILER} || $ENV{CC})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $comp = $ENV{"COMPILER"} || $ENV{"CC"}) 0 31 31
Condition33%1/3
$ENV{'COMPILER'} || $ENV{'CC'}
l!l&&r!l&&!r
0031
MC/DC0%0/2
$ENV{'COMPILER'} || $ENV{'CC'}
$ENV{'COMPILER'} $ENV{'CC'}
Truth table33%1/3
A || B
A= $ENV{'COMPILER'}B= $ENV{'CC'}
ABresult
1X1
011
000
115 0 $params->{CC} = $comp;
116 }
117  
118 31 ▶ if (my $opt = $ENV{OPTIMIZE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $opt = $ENV{"OPTIMIZE"}) 31 0 31
119 31 $params->{OPTIMIZE} = $opt;
120 }
121  
122 31 canonize_array_split($params->{TYPEMAPS});
123 31 canonize_array_split($params->{PARSE_XS});
124  
125 31 ▶ my $module_info = XS::Install::Payload::binary_module_info($params->{NAME}) || {};
Condition50%1/2
XS::Install::Payload::binary_module_info($params->{'NAME'}) || {}
l!l
031
MC/DC0%0/1
XS::Install::Payload::binary_module_info($params->{'NAME'}) || {}
XS::Install::Payload::binary_module_info($params->{'NAME'})
Truth table50%1/2
A
A= XS::Install::Payload::binary_module_info($params->{'NAME'})
Aresult
11
00
126 $params->{MODULE_INFO} = {
127 BIN_DEPENDENT => $module_info->{BIN_DEPENDENT},
128 STATIC_LIBS => [],
129 SHARED_LIBS => [],
130 ORIG => {
131 INC => $params->{INC} || '',
132 CCFLAGS => $params->{CCFLAGS},
133 LDDLFLAGS => $params->{LDDLFLAGS},
134 LINK => $params->{LINK},
135 },
136 31 ▶ INSTALL_SKIP => [],
Condition50%1/2
$params->{'INC'} || ''
l!l
031
MC/DC0%0/1
$params->{'INC'} || ''
$params->{'INC'}
Truth table50%1/2
A
A= $params->{'INC'}
Aresult
11
00
137 };
138  
139 31 ▶ $params->{UNIQUE_LIBNAME} //= $win32;
Condition33%1/3
$params->{"UNIQUE_LIBNAME"} //= $win32
l!l&&r!l&&!r
0310
MC/DC0%0/2
$params->{"UNIQUE_LIBNAME"} //= $win32
$params->{"UNIQUE_LIBNAME"} $win32
Truth table33%1/3
A //= B
A= $params->{"UNIQUE_LIBNAME"}B= $win32
ABresult
1X1
011
000
140 31 ▶ *DynaLoader::mod2fname = \&XS::Loader::mod2fname_unique if delete $params->{UNIQUE_LIBNAME};
Branch: 1 branch
BranchTrueFalseTotal
if delete $params->{"UNIQUE_LIBNAME"} 0 31 31
141  
142 31 ▶ $params->{BIN_SHARE} = {} if $params->{BIN_SHARE} && !ref($params->{BIN_SHARE});
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"BIN_SHARE"} and not ref $params->{"BIN_SHARE"} 0 31 31
Condition66%2/3
$params->{"BIN_SHARE"} and not ref $params->{"BIN_SHARE"}
!ll&&!rl&&r
2740
MC/DC0%0/2
$params->{"BIN_SHARE"} and not ref $params->{"BIN_SHARE"}
$params->{"BIN_SHARE"} not ref $params->{"BIN_SHARE"}
Truth table66%2/3
A and not(B)
A= $params->{"BIN_SHARE"}B= not ref $params->{"BIN_SHARE"}
ABresult
0X0
100
111
143 31 ▶ $params->{BIN_SHARE}{LINK} //= $params->{LINK} if $params->{BIN_SHARE} && $params->{LINK};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"BIN_SHARE"} and $params->{"LINK"} 0 31 31
Condition33%2/6
$params->{"BIN_SHARE"} and $params->{"LINK"}
!ll&&!rl&&r
2740
$params->{"BIN_SHARE"}{"LINK"} //= $params->{"LINK"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$params->{"BIN_SHARE"} and $params->{"LINK"}
$params->{"BIN_SHARE"} $params->{"LINK"}
MC/DC0%0/2
$params->{"BIN_SHARE"}{"LINK"} //= $params->{"LINK"}
$params->{"BIN_SHARE"}{"LINK"} $params->{"LINK"}
Truth table66%2/3
A and B
A= $params->{"BIN_SHARE"}B= $params->{"LINK"}
ABresult
0X0
100
111
Truth table0%0/3
A //= B
A= $params->{"BIN_SHARE"}{"LINK"}B= $params->{"LINK"}
ABresult
1X1
011
000
144 }
145  
146 31 ▶sub process_FROM {
Subroutine process_FROM: called CC=10 SCAR=24.9
Pod undocumented
147 31 my $params = shift;
148 31 ▶ my $module = $params->{NAME} or die "You must define a NAME param";
Branch: 1 branch
BranchTrueFalseTotal
my $module = $params->{"NAME"} or die "You must define a NAME param" 31 0 31
149  
150 31 ▶ if (my $file = delete $params->{ALL_FROM}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $file = delete $params->{"ALL_FROM"}) 1 30 31
151 1 ▶ $params->{VERSION_FROM} = $file unless $params->{VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"VERSION"} 1 0 1
152 1 ▶ $params->{ABSTRACT_FROM} = $file unless $params->{ABSTRACT};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"ABSTRACT"} 1 0 1
153 }
154  
155 31 my $pm = 'lib/'._pkg_file($module);
156 31 my $pod = 'lib/'._pkg_slash($module).'.pod';
157  
158 31 ▶ $params->{VERSION_FROM} ||= $pm unless $params->{VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"VERSION"} 31 0 31
Condition66%2/3
$params->{"VERSION_FROM"} ||= $pm
l!l&&r!l&&!r
1300
MC/DC0%0/2
$params->{"VERSION_FROM"} ||= $pm
$params->{"VERSION_FROM"} $pm
Truth table66%2/3
A ||= B
A= $params->{"VERSION_FROM"}B= $pm
ABresult
1X1
011
000
159 31 ▶ $params->{ABSTRACT_FROM} ||= (-f $pod) ? $pod : $pm unless $params->{ABSTRACT};
Branch: 2 branches
BranchTrueFalseTotal
unless $params->{"ABSTRACT"} 31 0 31
-f $pod ? : 0 30 30
Condition66%2/3
$params->{"ABSTRACT_FROM"} ||= -f $pod ? $pod : $pm
l!l&&r!l&&!r
1300
MC/DC0%0/2
$params->{"ABSTRACT_FROM"} ||= -f $pod ? $pod : $pm
$params->{"ABSTRACT_FROM"} -f $pod ? $pod : $pm
Truth table66%2/3
A ||= B
A= $params->{"ABSTRACT_FROM"}B= -f $pod ? $pod : $pm
ABresult
1X1
011
000
160 }
161  
162 31 ▶sub process_REQUIRES {
Subroutine process_REQUIRES: called CC=11 SCAR=28.2
Pod undocumented
163 31 my $params = shift;
164  
165 31 ▶ $params->{CONFIGURE_REQUIRES} ||= {};
Condition50%1/2
$params->{"CONFIGURE_REQUIRES"} ||= {}
l!l
031
MC/DC0%0/1
$params->{"CONFIGURE_REQUIRES"} ||= {}
$params->{"CONFIGURE_REQUIRES"}
Truth table50%1/2
A
A= $params->{"CONFIGURE_REQUIRES"}
Aresult
11
00
166 31 ▶ $params->{BUILD_REQUIRES} ||= {};
Condition50%1/2
$params->{"BUILD_REQUIRES"} ||= {}
l!l
031
MC/DC0%0/1
$params->{"BUILD_REQUIRES"} ||= {}
$params->{"BUILD_REQUIRES"}
Truth table50%1/2
A
A= $params->{"BUILD_REQUIRES"}
Aresult
11
00
167  
168 31 ▶ $params->{TEST_REQUIRES} ||= {};
Condition50%1/2
$params->{"TEST_REQUIRES"} ||= {}
l!l
031
MC/DC0%0/1
$params->{"TEST_REQUIRES"} ||= {}
$params->{"TEST_REQUIRES"}
Truth table50%1/2
A
A= $params->{"TEST_REQUIRES"}
Aresult
11
00
169 31 ▶ $params->{TEST_REQUIRES}{'Test::Simple'} ||= '0.96';
Condition50%1/2
$params->{"TEST_REQUIRES"}{"Test::Simple"} ||= "0.96"
l!l
031
MC/DC0%0/1
$params->{"TEST_REQUIRES"}{"Test::Simple"} ||= "0.96"
$params->{"TEST_REQUIRES"}{"Test::Simple"}
Truth table50%1/2
A
A= $params->{"TEST_REQUIRES"}{"Test::Simple"}
Aresult
11
00
170 31 ▶ $params->{TEST_REQUIRES}{'Test::More'} ||= 0;
Condition50%1/2
$params->{"TEST_REQUIRES"}{"Test::More"} ||= 0
l!l
031
MC/DC0%0/1
$params->{"TEST_REQUIRES"}{"Test::More"} ||= 0
$params->{"TEST_REQUIRES"}{"Test::More"}
Truth table50%1/2
A
A= $params->{"TEST_REQUIRES"}{"Test::More"}
Aresult
11
00
171 31 ▶ $params->{TEST_REQUIRES}{'Test::Deep'} ||= 0;
Condition50%1/2
$params->{"TEST_REQUIRES"}{"Test::Deep"} ||= 0
l!l
031
MC/DC0%0/1
$params->{"TEST_REQUIRES"}{"Test::Deep"} ||= 0
$params->{"TEST_REQUIRES"}{"Test::Deep"}
Truth table50%1/2
A
A= $params->{"TEST_REQUIRES"}{"Test::Deep"}
Aresult
11
00
172  
173 31 ▶ $params->{PREREQ_PM} ||= {};
Condition50%1/2
$params->{"PREREQ_PM"} ||= {}
l!l
031
MC/DC0%0/1
$params->{"PREREQ_PM"} ||= {}
$params->{"PREREQ_PM"}
Truth table50%1/2
A
A= $params->{"PREREQ_PM"}
Aresult
11
00
174  
175 31 ▶ unless ($params->{NAME} eq $THIS_MODULE) { # skip when building XS::Install itself
Branch: 1 branch
BranchTrueFalseTotal
unless ($params->{"NAME"} eq $THIS_MODULE) 31 0 31
176 31 ▶ $params->{CONFIGURE_REQUIRES}{$THIS_MODULE} ||= $VERSION;
Condition33%1/3
$params->{"CONFIGURE_REQUIRES"}{$THIS_MODULE} ||= $XS::Install::VERSION
l!l&&r!l&&!r
0310
MC/DC0%0/2
$params->{"CONFIGURE_REQUIRES"}{$THIS_MODULE} ||= $XS::Install::VERSION
$params->{"CONFIGURE_REQUIRES"}{$THIS_MODULE} $XS::Install::VERSION
Truth table33%1/3
A ||= B
A= $params->{"CONFIGURE_REQUIRES"}{$THIS_MODULE}B= $XS::Install::VERSION
ABresult
1X1
011
000
177 31 ▶ $params->{PREREQ_PM }{$THIS_MODULE} ||= $VERSION;
Condition33%1/3
$params->{"PREREQ_PM"}{$THIS_MODULE} ||= $XS::Install::VERSION
l!l&&r!l&&!r
0310
MC/DC0%0/2
$params->{"PREREQ_PM"}{$THIS_MODULE} ||= $XS::Install::VERSION
$params->{"PREREQ_PM"}{$THIS_MODULE} $XS::Install::VERSION
Truth table33%1/3
A ||= B
A= $params->{"PREREQ_PM"}{$THIS_MODULE}B= $XS::Install::VERSION
ABresult
1X1
011
000
178 }
179 }
180  
181 31 ▶sub process_PM {
Subroutine process_PM: called CC=6 SCAR=18.0
Pod undocumented
182 31 my $params = shift;
183 31 ▶ return if $params->{PM}; # user-defined value overrides defaults
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"PM"} 0 31 31
184  
185 31 my $instroot = _instroot($params);
186 31 my @name_parts = split '::', $params->{NAME};
187 31 ▶ $params->{PMLIBDIRS} ||= ['lib', $name_parts[-1]];
Condition50%1/2
$params->{"PMLIBDIRS"} ||= ["lib", $name_parts[-1]]
l!l
031
MC/DC0%0/1
$params->{"PMLIBDIRS"} ||= ["lib", $name_parts[-1]]
$params->{"PMLIBDIRS"}
Truth table50%1/2
A
A= $params->{"PMLIBDIRS"}
Aresult
11
00
188 31 my $pm = $params->{PM} = {};
189  
190 31 foreach my $dir (@{$params->{PMLIBDIRS}}) {
191 62 ▶ next unless -d $dir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $dir 31 31 62
192 31 foreach my $file (_scan_files('*.pm *.pl *.pod', $dir)) {
193 58 my $rel = $file;
194 58 $rel =~ s/^$dir//;
195 58 my $instpath = "$instroot/$rel";
196 58 $instpath =~ s#[/\\]{2,}#/#g;
197 58 $pm->{$file} = $instpath;
198 }
199 }
200 }
201  
202 31 ▶sub process_PAYLOAD {
Subroutine process_PAYLOAD: called CC=2 SCAR=6.9
Pod undocumented
203 31 my $params = shift;
204 31 ▶ my $payload = delete $params->{PAYLOAD} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $payload = delete $params->{"PAYLOAD"} or return 10 21 31
205 10 _process_map($payload, '*');
206 10 _install($params, $payload, 'payload');
207 }
208  
209 31 ▶sub process_BIN_DEPS {
Subroutine process_BIN_DEPS: called CC=3 SCAR=11.0
Pod undocumented
210 31 my $params = shift;
211 31 my $bin_deps = delete $params->{BIN_DEPS};
212 31 canonize_array_split($bin_deps);
213 31 ▶ push @$bin_deps, $THIS_MODULE unless $params->{NAME} eq $THIS_MODULE;
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"NAME"} eq $THIS_MODULE 31 0 31
214  
215 31 my $typemaps = $params->{TYPEMAPS};
216 31 $params->{TYPEMAPS} = [];
217 31 my $seen = {};
218 31 _apply_BIN_DEPS($params, $_, $seen) for @$bin_deps;
219 31 push @{$params->{TYPEMAPS}}, @$typemaps;
220 }
221  
222 31 ▶sub _apply_BIN_DEPS {
Subroutine _apply_BIN_DEPS: called CC=24 SCAR=37.4
223 31 my ($params, $module, $seen) = @_;
224 31 my $stop_sharing;
225 31 ▶ $stop_sharing = 1 if $module =~ s/^-//;
Branch: 1 branch
BranchTrueFalseTotal
if $module =~ s/^-// 0 31 31
226  
227 31 ▶ return if $seen->{$module}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen->{$module}++ 0 31 31
228  
229 31 my ($installed_version, $failure) = binary_module_version($module);
230 31 ▶ die "[XS::Install] binary dependency '$module' must be installed to proceed (details: $failure)\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $installed_version 0 31 31
231 unless $installed_version;
232 31 ▶ $params->{CONFIGURE_REQUIRES}{$module} ||= $installed_version;
Condition33%1/3
$params->{"CONFIGURE_REQUIRES"}{$module} ||= $installed_version
l!l&&r!l&&!r
3100
MC/DC0%0/2
$params->{"CONFIGURE_REQUIRES"}{$module} ||= $installed_version
$params->{"CONFIGURE_REQUIRES"}{$module} $installed_version
Truth table33%1/3
A ||= B
A= $params->{"CONFIGURE_REQUIRES"}{$module}B= $installed_version
ABresult
1X1
011
000
233 31 ▶ $params->{PREREQ_PM}{$module} ||= $installed_version;
Condition33%1/3
$params->{"PREREQ_PM"}{$module} ||= $installed_version
l!l&&r!l&&!r
3100
MC/DC0%0/2
$params->{"PREREQ_PM"}{$module} ||= $installed_version
$params->{"PREREQ_PM"}{$module} $installed_version
Truth table33%1/3
A ||= B
A= $params->{"PREREQ_PM"}{$module}B= $installed_version
ABresult
1X1
011
000
234 31 $params->{MODULE_INFO}{BIN_DEPS}{$module} = $installed_version;
235 31 ▶ push @{$params->{MODULE_INFO}{VISIBLE_BIN_DEPS} ||= []}, $module unless $stop_sharing;
Branch: 1 branch
BranchTrueFalseTotal
unless $stop_sharing 31 0 31
Condition50%1/2
$params->{"MODULE_INFO"}{"VISIBLE_BIN_DEPS"} ||= []
l!l
031
MC/DC0%0/1
$params->{"MODULE_INFO"}{"VISIBLE_BIN_DEPS"} ||= []
$params->{"MODULE_INFO"}{"VISIBLE_BIN_DEPS"}
Truth table50%1/2
A
A= $params->{"MODULE_INFO"}{"VISIBLE_BIN_DEPS"}
Aresult
11
00
236  
237 31 ▶ my $info = XS::Install::Payload::binary_module_info($module)
Branch: 1 branch
BranchTrueFalseTotal
my $info = XS::Install::Payload::binary_module_info($module) or die "[XS::Install] this module wants '${module}' as a binary dependence, however '${module}' doesn't provide any binary interface\n" 31 0 31
238 or die "[XS::Install] this module wants '$module' as a binary dependence, however '$module' doesn't provide any binary interface\n";
239  
240 # add so/dll to linker list
241 31 my $shared_list = $params->{MODULE_INFO}{SHARED_LIBS};
242 31 my $module_path = $module;
243 31 $module_path =~ s#::#/#g;
244 31 ▶ die "SHOULDN'T EVER HAPPEN" unless $module =~ /([^:]+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $module =~ /([^:]+)$/ 0 31 31
245 31 my $module_last_name = $1;
246 31 foreach my $dir (@INC) {
247 248 my $lib_path = "$dir/auto/$module_path/";
248 248 ▶ if ($info->{FILE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($info->{'FILE'}) { } 0 248 248
249 0 $lib_path .= $info->{FILE};
250 } else { # DEPRECATED
251 248 $lib_path .= $module_last_name.".".$Config{dlext};
252 }
253  
254 248 ▶ next unless -f $lib_path;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $lib_path 248 0 248
255 0 push @$shared_list, abs_path($lib_path);
256 0 last;
257 }
258  
259 31 ▶ if ($info->{INCLUDE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($info->{"INCLUDE"}) 31 0 31
260 31 my $incdir = XS::Install::Payload::include_dir($module);
261 31 _string_merge($params->{INC}, "-I$incdir");
262 }
263  
264 31 _string_merge($params->{INC}, $info->{INC});
265 31 _string_merge($params->{CCFLAGS}, $info->{CCFLAGS});
266 31 _string_merge($params->{LDDLFLAGS}, $info->{LDDLFLAGS});
267 31 _string_merge($params->{LINK}, $info->{LINK});
268 31 _string_merge($params->{DEFINE}, $info->{DEFINE});
269 31 _string_merge($params->{XSOPT}, $info->{XSOPT});
270  
271 31 _merge_libs($params, $info->{LIBS});
272  
273 31 ▶ if (my $passthrough = $info->{PASSTHROUGH}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $passthrough = $info->{"PASSTHROUGH"}) 0 31 31
274 0 _apply_BIN_DEPS($params, $_, $seen) for @$passthrough;
275 }
276  
277 31 ▶ if (my $typemaps = $info->{TYPEMAPS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $typemaps = $info->{"TYPEMAPS"}) 31 0 31
278 31 my $tm_dir = XS::Install::Payload::typemap_dir($module);
279 31 foreach my $typemap (@$typemaps) {
280 31 my $tmfile = "$tm_dir/$typemap";
281 31 $tmfile =~ s#[/\\]{2,}#/#g;
282 31 ▶ push @{$params->{TYPEMAPS} ||= []}, $tmfile;
Condition50%1/2
$params->{"TYPEMAPS"} ||= []
l!l
310
MC/DC0%0/1
$params->{"TYPEMAPS"} ||= []
$params->{"TYPEMAPS"}
Truth table50%1/2
A
A= $params->{"TYPEMAPS"}
Aresult
11
00
283 }
284 }
285  
286 31 ▶ $params->{CPLUS} = $info->{CPLUS} if $info->{CPLUS} and (!$params->{CPLUS} or $params->{CPLUS} < $info->{CPLUS});
Branch: 1 branch
BranchTrueFalseTotal
if $info->{"CPLUS"} and !$params->{"CPLUS"} || $params->{"CPLUS"} < $info->{"CPLUS"} 0 31 31
Condition16%1/6
$info->{"CPLUS"} and !$params->{"CPLUS"} || $params->{"CPLUS"} < $info->{"CPLUS"}
!ll&&!rl&&r
3100
not $params->{"CPLUS"} or $params->{"CPLUS"} < $info->{"CPLUS"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$info->{"CPLUS"} and !$params->{"CPLUS"} || $params->{"CPLUS"} < $info->{"CPLUS"}
$info->{"CPLUS"} not $params->{"CPLUS"} $params->{"CPLUS"} < $info->{"CPLUS"}
Truth table25%1/4
A and not(B) or C
A= $info->{"CPLUS"}B= not $params->{"CPLUS"}C= $params->{"CPLUS"} < $info->{"CPLUS"}
ABCresult
0XX0
1000
11X1
1011
287  
288 31 ▶ if (my $parsexs = $info->{PARSE_XS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $parsexs = $info->{"PARSE_XS"}) 31 0 31
289 31 ▶ push @{$params->{PARSE_XS}||=[]}, @$parsexs;
Condition50%1/2
$params->{"PARSE_XS"} ||= []
l!l
310
MC/DC0%0/1
$params->{"PARSE_XS"} ||= []
$params->{"PARSE_XS"}
Truth table50%1/2
A
A= $params->{"PARSE_XS"}
Aresult
11
00
290 }
291 }
292  
293 31 ▶sub process_PARSE_XS { # inject ParseXS plugins into xsubpp
Subroutine process_PARSE_XS: called CC=2 SCAR=7.0
Pod undocumented
294 31 my $params = shift;
295 31 my $list = $params->{PARSE_XS};
296 31 ▶ return unless @$list;
Branch: 1 branch
BranchTrueFalseTotal
unless @$list 0 31 31
297 31 _uniq_list($list);
298 31 my $inc = join ' ', map { "-M$_" } @$list;
299 31 push @{$params->{postamble}}, "XSUBPPRUN = \$(PERLRUN) -Ilib $inc \$(XSUBPP)";
300 }
301  
302 31 ▶sub process_binary {
Subroutine process_binary: called CC=23 SCAR=36.0
Pod undocumented
303 31 my $params = shift;
304  
305 31 ▶ $params->{XS} ||= $params->{_XSTEST} ? [] : [_scan_files($xs_mask)];
Branch: 1 branch
BranchTrueFalseTotal
$params->{'_XSTEST'} ? : 0 25 25
Condition66%2/3
$params->{"XS"} ||= $params->{"_XSTEST"} ? [] : [_scan_files($xs_mask)]
l!l&&r!l&&!r
6250
MC/DC0%0/2
$params->{"XS"} ||= $params->{"_XSTEST"} ? [] : [_scan_files($xs_mask)]
$params->{"XS"} $params->{"_XSTEST"} ? [] : [_scan_files($xs_mask)]
Truth table66%2/3
A ||= B
A= $params->{"XS"}B= $params->{"_XSTEST"} ? [] : [_scan_files($xs_mask)]
ABresult
1X1
011
000
306 31 ▶ $params->{C} ||= $params->{_XSTEST} ? [] : [_scan_files($c_mask)];
Branch: 1 branch
BranchTrueFalseTotal
$params->{'_XSTEST'} ? : 0 28 28
Condition66%2/3
$params->{"C"} ||= $params->{"_XSTEST"} ? [] : [_scan_files($c_mask)]
l!l&&r!l&&!r
3280
MC/DC0%0/2
$params->{"C"} ||= $params->{"_XSTEST"} ? [] : [_scan_files($c_mask)]
$params->{"C"} $params->{"_XSTEST"} ? [] : [_scan_files($c_mask)]
Truth table66%2/3
A ||= B
A= $params->{"C"}B= $params->{"_XSTEST"} ? [] : [_scan_files($c_mask)]
ABresult
1X1
011
000
307  
308 31 canonize_array_split($params->{SRC});
309  
310 31 ▶ if (ref($params->{XS}) ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params->{"XS"} ne "HASH") 29 2 31
311 29 canonize_array_files($params->{XS});
312 29 $params->{XS} = { map {$_ => undef} @{$params->{XS}} };
313 }
314  
315 31 my %xsi;
316 31 foreach my $xsfile (keys %{$params->{XS}}, map { _scan_files($xs_mask, $_) } @{$params->{SRC}}) {
317 77 my $cfile = $params->{XS}{$xsfile};
318 77 my $suffix;
319 77 ▶ unless ($cfile) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cfile) 76 1 77
320 76 ▶ my $cext = $params->{CPLUS} ? 'cc' : 'c';
Branch: 1 branch
BranchTrueFalseTotal
$params->{'CPLUS'} ? : 0 76 76
321 76 ▶ if ($xsfile =~ /\.xs$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xsfile =~ /\.xs$/) { } 76 0 76
322 76 $cfile = $xsfile;
323 76 $cfile =~ s/\.xs$/_xsgen.$cext/;
324 76 $suffix = "_xsgen.$cext";
325 } else {
326 0 $cfile = "$xsfile.$cext";
327 }
328 76 $params->{XS}{$xsfile} = $cfile;
329 }
330 77 ▶ unless ($suffix) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($suffix) 1 76 77
331 1 $suffix = $cfile;
332 1 $suffix =~ s/^[^.]+//;
333 }
334  
335 77 ▶ my $xsi_deps = XS::Install::Deps::find_xsi_deps([$xsfile])->{$xsfile} || [];
Condition50%1/2
XS::Install::Deps::find_xsi_deps([$xsfile])->{$xsfile} || []
l!l
770
MC/DC0%0/1
XS::Install::Deps::find_xsi_deps([$xsfile])->{$xsfile} || []
XS::Install::Deps::find_xsi_deps([$xsfile])->{$xsfile}
Truth table50%1/2
A
A= XS::Install::Deps::find_xsi_deps([$xsfile])->{$xsfile}
Aresult
11
00
336 0 map { $xsi{$_} = $xsfile } @$xsi_deps;
337  
338 77 push @{$params->{postamble}}, "$cfile : $xsfile @$xsi_deps \$(FIRST_MAKEFILE)\n".
339 "\t\$(XSUBPPRUN) \$(XSPROTOARG) \$(XSUBPPARGS) -csuffix $suffix \$(XSUBPP_EXTRA_ARGS) $xsfile > ${xsfile}c\n".
340 "\t\$(MV) ${xsfile}c $cfile";
341 }
342  
343 31 canonize_array_files($params->{C});
344 31 push @{$params->{C}}, _scan_files($c_mask, $_) for @{$params->{SRC}};
345 31 my @cdeps_list = (@{$params->{C}}, keys(%{$params->{XS}}), keys(%xsi));
346 31 push @{$params->{C}}, values %{$params->{XS}};
347 31 _uniq_list($params->{C});
348 31 _uniq_list(\@cdeps_list);
349  
350 my $cdeps = XS::Install::Deps::find_header_deps({
351 files => \@cdeps_list,
352 headers => ['./'],
353 0 inc => [map { s/^-I//; $_ } split(' ', $params->{MODULE_INFO}{ORIG}{INC})],
354 });
355  
356 # push C to OBJECT and process C files header deps
357 31 canonize_array_files($params->{OBJECT});
358 31 foreach my $cfile (@{$params->{C}}) {
359 179 my $ofile = c2obj_file($cfile);
360 179 push @{$params->{OBJECT}}, $ofile;
361  
362 179 my $deps = delete $cdeps->{$cfile};
363 0 ▶ push @{$params->{postamble}}, "$ofile : @$deps" if $deps && @$deps;
Branch: 1 branch
BranchTrueFalseTotal
if $deps and @$deps 0 179 179
Condition66%2/3
$deps and @$deps
!ll&&!rl&&r
771020
MC/DC0%0/2
$deps and @$deps
$deps @$deps
Truth table66%2/3
A and B
A= $depsB= @$deps
ABresult
0X0
100
111
364 }
365 31 _uniq_list($params->{OBJECT});
366  
367 # process XS & XSI header deps
368 31 foreach my $f (keys %xsi) {
369 0 my $deps = delete $cdeps->{$f};
370 0 ▶ next unless $deps && @$deps;
Branch: 1 branch
BranchTrueFalseTotal
unless $deps and @$deps 0 0 0
Condition0%0/3
$deps and @$deps
!ll&&!rl&&r
000
MC/DC0%0/2
$deps and @$deps
$deps @$deps
Truth table0%0/3
A and B
A= $depsB= @$deps
ABresult
0X0
100
111
371 0 ▶ push @{$cdeps->{$xsi{$f}} ||= []}, @$deps;
Condition0%0/2
$$cdeps{$xsi{$f}} ||= []
l!l
00
MC/DC0%0/1
$$cdeps{$xsi{$f}} ||= []
$$cdeps{$xsi{$f}}
Truth table0%0/2
A
A= $$cdeps{$xsi{$f}}
Aresult
11
00
372 }
373 31 foreach my $xsfile (keys %{$params->{XS}}) {
374 77 my $deps = delete $cdeps->{$xsfile};
375 77 ▶ next unless $deps && @$deps;
Branch: 1 branch
BranchTrueFalseTotal
unless $deps and @$deps 77 0 77
Condition33%1/3
$deps and @$deps
!ll&&!rl&&r
0770
MC/DC0%0/2
$deps and @$deps
$deps @$deps
Truth table33%1/3
A and B
A= $depsB= @$deps
ABresult
0X0
100
111
376 0 _uniq_list($deps);
377 0 my $cfile = $params->{XS}{$xsfile};
378 0 my $ofile = c2obj_file($cfile);
379 0 push @{$params->{postamble}}, "$ofile : @$deps";
380 }
381  
382 31 delete $params->{H}; # prevent MM from making O_FILES depend on all H_FILES
383  
384 31 $params->{clean}{FILES} .= ' $(O_FILES)';
385 }
386  
387 0 ▶sub process_CMAKE {
Subroutine process_CMAKE: not called CC=7 SCAR=40.3
Pod undocumented
388 0 my ($target, $params, $info) = @_;
389  
390 0 my $bdir = $info->{DIR}.'/build';
391 0 my $pdir = $info->{DIR}.'/cmake_props';
392 0 my $prefix = 'cmake_prefix';
393 0 ▶ mkdir($bdir) unless -d $bdir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $bdir 0 0 0
394 0 ▶ mkdir($pdir) unless -d $pdir;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $pdir 0 0 0
395 0 ▶ mkdir("$pdir/$prefix") unless -d "$pdir/$prefix";
Branch: 1 branch
BranchTrueFalseTotal
unless -d "$pdir/$prefix" 0 0 0
396  
397 0 my $make = '$(MAKE)';
398 0 ▶ $make = 'gmake' if $info->{GMAKE} and $native_bsd_make;
Branch: 1 branch
BranchTrueFalseTotal
if $info->{"GMAKE"} and $native_bsd_make 0 0 0
Condition0%0/3
$info->{"GMAKE"} and $native_bsd_make
!ll&&!rl&&r
000
MC/DC0%0/2
$info->{"GMAKE"} and $native_bsd_make
$info->{"GMAKE"} $native_bsd_make
Truth table0%0/3
A and B
A= $info->{"GMAKE"}B= $native_bsd_make
ABresult
0X0
100
111
399  
400 0 my $cflags = $params->{INC};
401 0 _string_merge($cflags, $params->{CCFLAGS});
402 0 _string_merge($cflags, $params->{DEFINE});
403 0 _string_merge($cflags, $params->{OPTIMIZE});
404  
405 0 _string_merge($info->{CMAKE_OPTIONS}, "-DCMAKE_INSTALL_PREFIX:PATH=$prefix");
406  
407 $params->{CMAKE_PARAMS} = {
408 BUILD_DIR => $bdir,
409 PROP_DIR => $pdir,
410 MAIN_TARGET => $target,
411 TARGETS => {
412 $target => "-fPIC $cflags",
413 },
414 OPTIONS => $info->{CMAKE_OPTIONS},
415 0 };
416  
417 0 $info->{DIR} = $bdir;
418 0 $info->{TARGET} = $target;
419 0 ▶ $info->{FLAGS} ||= '';
Condition0%0/2
$info->{"FLAGS"} ||= ""
l!l
00
MC/DC0%0/1
$info->{"FLAGS"} ||= ""
$info->{"FLAGS"}
Truth table0%0/2
A
A= $info->{"FLAGS"}
Aresult
11
00
420 0 $info->{BUILD_CMD} = "cd ../cmake_props && $make $info->{FLAGS} $info->{TARGET}";
421 0 $info->{CLEAN_CMD} = '';
422 0 $info->{FORCE_TRACKING} = 1;
423  
424 0 $params->{clean}{FILES} .= " $bdir $pdir";
425  
426 0 push @{$params->{postamble}}, "cmake_install : dynamic\n".
427 "\tcd $bdir && $make install \$(DEV_NULL)";
428  
429 0 my $cmake_share = run_cmake($params, $params->{CMAKE_PARAMS});
430 0 $cmake_share->{CMAKE_TMP_INSTALL_DIR} = "$bdir/$prefix";
431 0 apply_CMAKE($params, $cmake_share);
432 }
433  
434 31 ▶sub process_CLIB {
Subroutine process_CLIB: called CC=24 SCAR=62.7
Pod undocumented
435 31 my $params = shift;
436 31 my $clibs = '';
437 31 ▶ my $clib = delete $params->{CLIB} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $clib = delete $params->{"CLIB"} or return 0 31 31
438 0 ▶ $clib = [$clib] unless ref($clib) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $clib eq "ARRAY" 0 0 0
439 0 ▶ return unless @$clib;
Branch: 1 branch
BranchTrueFalseTotal
unless @$clib 0 0 0
440  
441 0 ▶ my $wa_open = $mac ? '-Wl,-force_load' : '-Wl,--whole-archive';
Branch: 1 branch
BranchTrueFalseTotal
$mac ? : 0 0 0
442 0 ▶ my $wa_close = $mac ? '' : '-Wl,--no-whole-archive';
Branch: 1 branch
BranchTrueFalseTotal
$mac ? : 0 0 0
443  
444 0 foreach my $info (@$clib) {
445 0 my $cmake_target = $info->{CMAKE_TARGET};
446 0 ▶ if ($cmake_target) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmake_target) 0 0 0
447 0 process_CMAKE($cmake_target, $params, $info);
448 }
449  
450 0 my $build_cmd = $info->{BUILD_CMD};
451 0 my $clean_cmd = $info->{CLEAN_CMD};
452 0 my $build_dep = $info->{BUILD_DEP};
453  
454 0 ▶ if (!$build_cmd and !$build_dep) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($build_cmd or $build_dep) 0 0 0
Condition0%0/3
$build_cmd or $build_dep
l!l&&r!l&&!r
000
MC/DC0%0/2
$build_cmd or $build_dep
$build_cmd $build_dep
Truth table0%0/3
A or B
A= $build_cmdB= $build_dep
ABresult
1X1
011
000
455 0 my $make = '$(MAKE)';
456 0 ▶ $make = 'gmake' if $info->{GMAKE} and $native_bsd_make;
Branch: 1 branch
BranchTrueFalseTotal
if $info->{"GMAKE"} and $native_bsd_make 0 0 0
Condition0%0/3
$info->{"GMAKE"} and $native_bsd_make
!ll&&!rl&&r
000
MC/DC0%0/2
$info->{"GMAKE"} and $native_bsd_make
$info->{"GMAKE"} $native_bsd_make
Truth table0%0/3
A and B
A= $info->{"GMAKE"}B= $native_bsd_make
ABresult
0X0
100
111
457 0 ▶ $info->{TARGET} ||= '';
Condition0%0/2
$info->{"TARGET"} ||= ""
l!l
00
MC/DC0%0/1
$info->{"TARGET"} ||= ""
$info->{"TARGET"}
Truth table0%0/2
A
A= $info->{"TARGET"}
Aresult
11
00
458 0 ▶ $info->{FLAGS} ||= '';
Condition0%0/2
$info->{"FLAGS"} ||= ""
l!l
00
MC/DC0%0/1
$info->{"FLAGS"} ||= ""
$info->{"FLAGS"}
Truth table0%0/2
A
A= $info->{"FLAGS"}
Aresult
11
00
459 0 $build_cmd = "$make $info->{FLAGS} $info->{TARGET}";
460 0 $clean_cmd = "$make clean";
461 }
462 0 ▶ $info->{FILE} = [$info->{FILE}] if exists $info->{FILE} && ref $info->{FILE} ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if exists $info->{"FILE"} and ref $info->{"FILE"} ne "ARRAY" 0 0 0
Condition0%0/3
exists $info->{"FILE"} and ref $info->{"FILE"} ne "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $info->{"FILE"} and ref $info->{"FILE"} ne "ARRAY"
exists $info->{"FILE"} ref $info->{"FILE"} ne "ARRAY"
Truth table0%0/3
A and B
A= exists $info->{"FILE"}B= ref $info->{"FILE"} ne "ARRAY"
ABresult
0X0
100
111
463 0 my $path = '';
464 0 my $static = 0;
465 0 ▶ for my $f (@{$info->{FILE} || []}) {
Condition0%0/2
$info->{'FILE'} || []
l!l
00
MC/DC0%0/1
$info->{'FILE'} || []
$info->{'FILE'}
Truth table0%0/2
A
A= $info->{'FILE'}
Aresult
11
00
466 0 ▶ next unless $f;
Branch: 1 branch
BranchTrueFalseTotal
unless $f 0 0 0
467 0 ▶ $static = 1 if $f =~ /\.l?a$/;
Branch: 1 branch
BranchTrueFalseTotal
if $f =~ /\.l?a$/ 0 0 0
468 0 $path .= $info->{DIR}.'/'.$f.' ';
469 }
470 0 $clibs .= $path;
471  
472 0 ▶ my $force = $info->{FORCE_TRACKING} ? 'FORCE' : '';
Branch: 1 branch
BranchTrueFalseTotal
$info->{'FORCE_TRACKING'} ? : 0 0 0
473
474 0 ▶ if ($build_dep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($build_dep) { } 0 0 0
475 0 push @{$params->{postamble}}, "$path : $force $build_dep;";
476 } else {
477 0 push @{$params->{postamble}}, "$path : $force; cd $info->{DIR} && $build_cmd\n";
478 }
479
480 0 ▶ push @{$params->{postamble}}, "clean :: ; cd $info->{DIR} && $clean_cmd\n" if $clean_cmd;
Branch: 1 branch
BranchTrueFalseTotal
if $clean_cmd 0 0 0
481
482 0 ▶ if ($static) {
Branch: 1 branch
BranchTrueFalseTotal
if ($static) { } 0 0 0
483 0 push @{$params->{MODULE_INFO}{STATIC_LIBS}}, "$wa_open $path $wa_close";
484 } else {
485 0 push @{$params->{MODULE_INFO}{SHARED_LIBS}}, $path;
486 }
487 }
488 0 push @{$params->{postamble}}, "\$(INST_DYNAMIC) : $clibs";
489 }
490  
491 31 ▶sub process_PKG_CONFIG {
Subroutine process_PKG_CONFIG: called CC=4 SCAR=13.9
Pod undocumented
492 31 my $params = shift;
493 31 canonize_array_split($params->{PKG_CONFIG});
494 31 my $pkgs = $params->{PKG_CONFIG};
495  
496 31 my @bin_share_auto;
497 31 for my $pkg (@$pkgs) {
498 3 ▶ push @bin_share_auto, $pkg unless $pkg =~ s/^\s*-//;
Branch: 1 branch
BranchTrueFalseTotal
unless $pkg =~ s/^\s*-// 2 1 3
499 }
500  
501 31 set_pkg_config($params, $pkgs);
502  
503 31 ▶ my $bin_share = $params->{BIN_SHARE} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $bin_share = $params->{"BIN_SHARE"} or return 4 27 31
504 4 my $bin_share_pkgs = delete $bin_share->{PKG_CONFIG};
505 4 canonize_array_split($bin_share_pkgs);
506 4 set_pkg_config($bin_share, [@bin_share_auto, @$bin_share_pkgs]);
507 }
508  
509 35 ▶sub set_pkg_config {
Subroutine set_pkg_config: called CC=4 SCAR=13.9
Pod undocumented
510 35 my ($params, $pkgs) = @_;
511 35 ▶ return unless @$pkgs;
Branch: 1 branch
BranchTrueFalseTotal
unless @$pkgs 29 6 35
512 6 require XS::Install::PkgConfigFixed;
513  
514 6 for my $pkg (@$pkgs) {
515 6 my $res = PkgConfig->find($pkg);
516 6 ▶ warn $res->errmsg if $res->errmsg;
Branch: 1 branch
BranchTrueFalseTotal
if $res->errmsg 0 6 6
517 6 my @ccargs = $res->get_cflags;
518  
519 6 _string_merge($params->{INC}, join ' ', grep /^-I/, @ccargs);
520 6 _string_merge($params->{CCFLAGS}, join ' ', grep !/^-I/, @ccargs);
521 6 _string_merge($params->{LINK}, scalar $res->get_ldflags);
522 }
523 }
524  
525 31 ▶sub process_BIN_SHARE {
Subroutine process_BIN_SHARE: called CC=21 SCAR=34.4
Pod undocumented
526 31 my $params = shift;
527 31 ▶ my $bin_share = delete $params->{BIN_SHARE} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $bin_share = delete $params->{"BIN_SHARE"} or return 4 27 31
528 4 ▶ return unless %$bin_share;
Branch: 1 branch
BranchTrueFalseTotal
unless %$bin_share 0 4 4
529 4 ▶ return if $params->{_XSTEST};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"_XSTEST"} 0 4 4
530  
531 4 ▶ my $typemaps = delete($bin_share->{TYPEMAPS}) || {};
Condition100%2/2
delete $bin_share->{'TYPEMAPS'} || {}
l!l
13
MC/DC100%1/1
delete $bin_share->{'TYPEMAPS'} || {}
delete $bin_share->{'TYPEMAPS'}
Truth table100%2/2
A
A= delete $bin_share->{'TYPEMAPS'}
Aresult
11
00
532 4 _process_map($typemaps, $map_mask);
533 4 _install($params, $typemaps, 'tm');
534 4 ▶ $bin_share->{TYPEMAPS} = [values %$typemaps] if scalar keys %$typemaps;
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %$typemaps 1 3 4
535  
536 4 ▶ my $include = delete($bin_share->{INCLUDE}) || {};
Condition100%2/2
delete $bin_share->{'INCLUDE'} || {}
l!l
13
MC/DC100%1/1
delete $bin_share->{'INCLUDE'} || {}
delete $bin_share->{'INCLUDE'}
Truth table100%2/2
A
A= delete $bin_share->{'INCLUDE'}
Aresult
11
00
537 4 ▶ if ($include == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($include == 1) { } 0 4 4
538 0 $bin_share->{INCLUDE} = 1;
539 } else {
540 4 _process_map($include, $h_mask);
541 4 _install($params, $include, 'i');
542 4 ▶ $bin_share->{INCLUDE} = 1 if scalar(keys %$include);
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %$include 1 3 4
543 }
544  
545 4 ▶ $bin_share->{LIBS} = [$bin_share->{LIBS}] if $bin_share->{LIBS} and ref($bin_share->{LIBS}) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if $bin_share->{"LIBS"} and ref $bin_share->{"LIBS"} ne "ARRAY" 0 4 4
Condition66%2/3
$bin_share->{"LIBS"} and ref $bin_share->{"LIBS"} ne "ARRAY"
!ll&&!rl&&r
310
MC/DC0%0/2
$bin_share->{"LIBS"} and ref $bin_share->{"LIBS"} ne "ARRAY"
$bin_share->{"LIBS"} ref $bin_share->{"LIBS"} ne "ARRAY"
Truth table66%2/3
A and B
A= $bin_share->{"LIBS"}B= ref $bin_share->{"LIBS"} ne "ARRAY"
ABresult
0X0
100
111
546  
547 4 ▶ if (my $list = $params->{MODULE_INFO}{BIN_DEPENDENT}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $list = $params->{"MODULE_INFO"}{"BIN_DEPENDENT"}) 0 4 4
548 0 ▶ $bin_share->{BIN_DEPENDENT} = $list if @$list;
Branch: 1 branch
BranchTrueFalseTotal
if @$list 0 0 0
549 }
550  
551 4 ▶ if (my $vinfo = $params->{MODULE_INFO}{BIN_DEPS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $vinfo = $params->{"MODULE_INFO"}{"BIN_DEPS"}) 4 0 4
552 4 ▶ $bin_share->{BIN_DEPS} = $vinfo if %$vinfo;
Branch: 1 branch
BranchTrueFalseTotal
if %$vinfo 4 0 4
553 }
554  
555 4 ▶ $bin_share->{PARSE_XS} = [$bin_share->{PARSE_XS}] if $bin_share->{PARSE_XS} and ref($bin_share->{PARSE_XS}) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if $bin_share->{"PARSE_XS"} and ref $bin_share->{"PARSE_XS"} ne "ARRAY" 0 4 4
Condition33%1/3
$bin_share->{"PARSE_XS"} and ref $bin_share->{"PARSE_XS"} ne "ARRAY"
!ll&&!rl&&r
400
MC/DC0%0/2
$bin_share->{"PARSE_XS"} and ref $bin_share->{"PARSE_XS"} ne "ARRAY"
$bin_share->{"PARSE_XS"} ref $bin_share->{"PARSE_XS"} ne "ARRAY"
Truth table33%1/3
A and B
A= $bin_share->{"PARSE_XS"}B= ref $bin_share->{"PARSE_XS"} ne "ARRAY"
ABresult
0X0
100
111
556  
557 4 ▶ return unless %$bin_share;
Branch: 1 branch
BranchTrueFalseTotal
unless %$bin_share 0 4 4
558  
559 4 ▶ if (my $vbd = $params->{MODULE_INFO}{VISIBLE_BIN_DEPS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $vbd = $params->{"MODULE_INFO"}{"VISIBLE_BIN_DEPS"}) 4 0 4
560 4 my $pt =
561 _uniq_list($vbd);
562 4 $bin_share->{PASSTHROUGH} = $vbd;
563 }
564  
565 4 $bin_share->{LOADABLE} = has_binary($params);
566  
567 4 ▶ $bin_share->{CPLUS} //= $params->{CPLUS} if $params->{CPLUS};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"CPLUS"} 0 4 4
Condition0%0/3
$bin_share->{"CPLUS"} //= $params->{"CPLUS"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$bin_share->{"CPLUS"} //= $params->{"CPLUS"}
$bin_share->{"CPLUS"} $params->{"CPLUS"}
Truth table0%0/3
A //= B
A= $bin_share->{"CPLUS"}B= $params->{"CPLUS"}
ABresult
1X1
011
000
568 4 $bin_share->{FILE} = module_so_file($params);
569  
570 # generate info file
571 4 mkdir 'blib';
572 4 my $infopath = 'blib/info';
573 4 XS::Install::Util::module_info_write($infopath, $bin_share);
574 4 _install($params, {$infopath => 'info'}, '');
575 }
576  
577 31 ▶sub attach_BIN_DEPENDENT {
Subroutine attach_BIN_DEPENDENT: called CC=3 SCAR=11.1
Pod undocumented
578 31 my $params = shift;
579 31 ▶ my @deps = keys %{$params->{MODULE_INFO}{BIN_DEPS} || {}};
Condition50%1/2
$params->{'MODULE_INFO'}{'BIN_DEPS'} || {}
l!l
310
MC/DC0%0/1
$params->{'MODULE_INFO'}{'BIN_DEPS'} || {}
$params->{'MODULE_INFO'}{'BIN_DEPS'}
Truth table50%1/2
A
A= $params->{'MODULE_INFO'}{'BIN_DEPS'}
Aresult
11
00
580 31 ▶ return unless @deps;
Branch: 1 branch
BranchTrueFalseTotal
unless @deps 0 31 31
581  
582 31 push @{$params->{postamble}}, "sync_bin_deps:\n".
583 "\t\$(PERL) -M${THIS_MODULE}::Util -e '${THIS_MODULE}::Util::cmd_sync_bin_deps()' $params->{NAME} @deps";
584 31 push @{$params->{postamble}}, "install :: sync_bin_deps";
585 }
586  
587 31 ▶sub warn_BIN_DEPENDENT {
Subroutine warn_BIN_DEPENDENT: called CC=8 SCAR=33.4
Pod undocumented
588 31 my $params = shift;
589 31 ▶ return unless $params->{VERSION_FROM};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"VERSION_FROM"} 0 31 31
590 31 my $module = $params->{NAME};
591 31 ▶ return if $module eq $THIS_MODULE;
Branch: 1 branch
BranchTrueFalseTotal
if $module eq $THIS_MODULE 0 31 31
592 31 ▶ my $list = $params->{MODULE_INFO}{BIN_DEPENDENT} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $list = $params->{"MODULE_INFO"}{"BIN_DEPENDENT"} or return 0 31 31
593 0 ▶ return unless @$list;
Branch: 1 branch
BranchTrueFalseTotal
unless @$list 0 0 0
594 0 my ($installed_version, $failure) = binary_module_version($module);
595 0 ▶ return unless $installed_version;
Branch: 1 branch
BranchTrueFalseTotal
unless $installed_version 0 0 0
596 0 ▶ my $new_version = MM->parse_version($params->{VERSION_FROM}) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $new_version = "MM"->parse_version($params->{"VERSION_FROM"}) or return 0 0 0
597 0 ▶ return if $installed_version eq $new_version;
Branch: 1 branch
BranchTrueFalseTotal
if $installed_version eq $new_version 0 0 0
598 0 warn << "EOF";
599 ******************************************************************************
600 $THIS_MODULE: There are XS modules that binary depend on current XS module $module.
601 They were built with currently installed $module version $installed_version.
602 If you install $module version $new_version, you will have to reinstall all XS modules that binary depend on it:
603 cpanm -f @$list
604 ******************************************************************************
605 EOF
606 }
607  
608 31 ▶sub process_SANITIZE {
Subroutine process_SANITIZE: called CC=7 SCAR=37.9
Pod undocumented
609 31 my $params = shift;
610 31 ▶ my $mode = $ENV{SANITIZE} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $mode = $ENV{"SANITIZE"} or return 0 31 31
611  
612 0 my @preload;
613  
614 0 ▶ if ($mode =~ /a/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode =~ /a/i) 0 0 0
615 0 push @preload, _cc_get_so_path($params, 'libasan.so');
616 0 _string_merge($params->{CCFLAGS}, '-fsanitize=address -fno-omit-frame-pointer');
617 0 _string_merge($params->{LINK}, '-lasan');
618 }
619  
620 0 ▶ if ($mode =~ /u/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode =~ /u/i) 0 0 0
621 0 push @preload, _cc_get_so_path($params, 'libubsan.so');
622 0 _string_merge($params->{CCFLAGS}, '-fsanitize=undefined');
623 0 _string_merge($params->{LINK}, '-lubsan');
624 }
625  
626 0 @preload = grep {$_} @preload;
627  
628 0 ▶ if (@preload and !$win32) {
Branch: 1 branch
BranchTrueFalseTotal
if (@preload and not $win32) 0 0 0
Condition0%0/3
@preload and not $win32
!ll&&!rl&&r
000
MC/DC0%0/2
@preload and not $win32
@preload not $win32
Truth table0%0/3
A and not(B)
A= @preloadB= not $win32
ABresult
0X0
100
111
629 0 ▶ my $preload = 'LD_PRELOAD='.join($win32 ? ';' : ':', @preload);
Branch: 1 branch
BranchTrueFalseTotal
$win32 ? : 0 0 0
630 0 push @{$params->{postamble}}, "ABSPERL = $preload \$(PERL)";
631 0 push @{$params->{postamble}}, "PERLRUN = $preload \$(PERL)";
632 0 push @{$params->{postamble}}, "FULLPERLRUN = $preload \$(FULLPERL)";
633 }
634 }
635  
636 0 ▶sub _cc_get_so_path {
Subroutine _cc_get_so_path: not called CC=3 SCAR=24.8
637 0 my ($params, $so) = @_;
638 0 ▶ my $cc = $params->{CC} || $Config{cc};
Condition0%0/3
$params->{'CC'} || $XS::Install::Config{'cc'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$params->{'CC'} || $XS::Install::Config{'cc'}
$params->{'CC'} $XS::Install::Config{'cc'}
Truth table0%0/3
A || B
A= $params->{'CC'}B= $XS::Install::Config{'cc'}
ABresult
1X1
011
000
639 0 my $file = `$cc -print-file-name=$so`;
640 0 chomp($file);
641 0 ▶ return if $file eq $so;
Branch: 1 branch
BranchTrueFalseTotal
if $file eq $so 0 0 0
642 0 return $file;
643 }
644  
645 31 ▶sub process_CPLUS {
Subroutine process_CPLUS: called CC=5 SCAR=29.4
Pod undocumented
646 31 my $params = shift;
647 31 ▶ my $use_cpp = $params->{CPLUS} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $use_cpp = $params->{"CPLUS"} or return 0 31 31
648  
649 0 my $cppv = int($use_cpp);
650 0 ▶ $cppv = 11 if $cppv < 11;
Branch: 1 branch
BranchTrueFalseTotal
if $cppv < 11 0 0 0
651 0 _string_merge($params->{CCFLAGS}, "-std=c++$cppv");
652  
653 0 $params->{CC} = _get_cplusplus($params->{CC}, $cppv);
654 0 ▶ $params->{LD} ||= '$(CC)';
Condition0%0/2
$params->{"LD"} ||= "\$(CC)"
l!l
00
MC/DC0%0/1
$params->{"LD"} ||= "\$(CC)"
$params->{"LD"}
Truth table0%0/2
A
A= $params->{"LD"}
Aresult
11
00
655 0 _string_merge($params->{XSOPT}, '-C++');
656  
657 # prevent C++ from compile errors on perls <= 5.18, as perl had buggy <perl.h> prior to 5.20
658 0 ▶ _string_merge($params->{CCFLAGS}, "-Wno-reserved-user-defined-literal -Wno-literal-suffix -Wno-unknown-warning-option") if $^V < v5.20;
Branch: 1 branch
BranchTrueFalseTotal
if $^V < v5.20 0 0 0
659 }
660  
661 31 ▶sub process_CCFLAGS {
Subroutine process_CCFLAGS: called CC=2 SCAR=7.1
Pod undocumented
662 31 my $params = shift;
663 31 $params->{CCFLAGS} = string_merge($params->{CCFLAGS}, $Config{ccflags});
664 31 ▶ _string_merge($params->{CCFLAGS}, '-Wno-unused-parameter') if $win32; # on Strawberry's mingw PERL_UNUSED_DECL doesn't work
Branch: 1 branch
BranchTrueFalseTotal
if $win32 0 31 31
665 }
666  
667 31 ▶sub fix_flags {
Subroutine fix_flags: called CC=4 SCAR=22.9
Pod undocumented
668 31 my $params = shift;
669 31 _string_merge($params->{CCFLAGS}, '-o $@');
670  
671 31 ▶ if ($params->{OPTIMIZE} =~ /(^|\s)-g(\s|$)/) { # remove stripping flag is debug enabled
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"OPTIMIZE"} =~ /(^|\s)-g(\s|$)/) 0 31 31
672 0 ▶ 1 while $params->{OPTIMIZE} =~ s/(^|\s)-s(\s|$)/ /;
Branch: 1 branch
BranchTrueFalseTotal
$params->{"OPTIMIZE"} =~ s/(^|\s)-s(\s|$)/ / and do { '???' } 0 0 0
673 0 $params->{OPTIMIZE} =~ s/\s+/ /g; $params->{OPTIMIZE} =~ s/^\s+//; $params->{OPTIMIZE} =~ s/\s+$//;
674 0 ▶ 1 while $params->{LDDLFLAGS} =~ s/(^|\s)-s(\s|$)/ /;
Branch: 1 branch
BranchTrueFalseTotal
$params->{"LDDLFLAGS"} =~ s/(^|\s)-s(\s|$)/ / and do { 1 } 0 0 0
675 }
676 }
677  
678 31 ▶sub process_LD {
Subroutine process_LD: called CC=7 SCAR=25.7
Pod undocumented
679 31 my $params = shift;
680  
681 31 ▶ $params->{LDFROM} ||= '$(OBJECT)';
Condition50%1/2
$params->{"LDFROM"} ||= "\$(OBJECT)"
l!l
031
MC/DC0%0/1
$params->{"LDFROM"} ||= "\$(OBJECT)"
$params->{"LDFROM"}
Truth table50%1/2
A
A= $params->{"LDFROM"}
Aresult
11
00
682  
683 {
684 31 my $str = join(' ', @{$params->{MODULE_INFO}{STATIC_LIBS}});
685 31 ▶ $params->{LDFROM} .= ' '.$str if $str;
Branch: 1 branch
BranchTrueFalseTotal
if $str 0 31 31
686 }
687  
688 # MacOSX doesn't allow for linking with bundles :(
689 # Linux/Unix does not need them, as .so-files will be loaded by perl
690 31 ▶ if ($win32) {
Branch: 1 branch
BranchTrueFalseTotal
if ($win32) 0 31 31
691 0 my %seen;
692 0 my @shared_libs = grep {!$seen{$_}++} reverse @{$params->{MODULE_INFO}{SHARED_LIBS}};
693 0 my $str = join(' ', @shared_libs);
694 0 $params->{MODULE_INFO}{SHARED_LIBS_LINKING} = $str;
695 0 ▶ $params->{LDFROM} .= ' '.$str if $str;
Branch: 1 branch
BranchTrueFalseTotal
if $str 0 0 0
696 }
697  
698 31 my $cfg_lddlflags = $Config{lddlflags};
699 31 ▶ $params->{LDDLFLAGS} = string_merge($cfg_lddlflags, $params->{LDDLFLAGS}) if index($params->{LDDLFLAGS} || '', $cfg_lddlflags) == -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($params->{"LDDLFLAGS"} || "", $cfg_lddlflags) == -1 31 0 31
Condition50%1/2
$params->{'LDDLFLAGS'} || ''
l!l
031
MC/DC0%0/1
$params->{'LDDLFLAGS'} || ''
$params->{'LDDLFLAGS'}
Truth table50%1/2
A
A= $params->{'LDDLFLAGS'}
Aresult
11
00
700 }
701  
702 31 ▶sub process_test {
Subroutine process_test: called CC=22 SCAR=61.2
Pod undocumented
703 31 my $params = shift;
704 31 ▶ my $tp = $params->{test} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $tp = $params->{"test"} or return 0 31 31
705 0 ▶ return unless $tp->{SRC} or $tp->{XS} or $tp->{CLIB};
Branch: 1 branch
BranchTrueFalseTotal
unless $tp->{"SRC"} or $tp->{"XS"} or $tp->{"CLIB"} 0 0 0
Condition0%0/6
$tp->{"SRC"} or $tp->{"XS"} or $tp->{"CLIB"}
l!l&&r!l&&!r
000
$tp->{"SRC"} or $tp->{"XS"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$tp->{"SRC"} or $tp->{"XS"} or $tp->{"CLIB"}
$tp->{"SRC"} $tp->{"XS"} $tp->{"CLIB"}
Truth table0%0/4
A or B or C
A= $tp->{"SRC"}B= $tp->{"XS"}C= $tp->{"CLIB"}
ABCresult
1XX1
01X1
0011
0000
706  
707 0 canonize_array_split($tp->{$_}) for qw/TYPEMAPS BIN_DEPS/;
708  
709 0 ▶ my $array_merge = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
710 0 ▶ my $a1 = shift || [];
Condition0%0/2
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
711 0 ▶ my $a2 = shift || [];
Condition0%0/2
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
712 0 return [@$a1, @$a2];
713 0 };
714  
715 0 my $ldfrom = '$(OBJECT)';
716 0 ▶ $ldfrom .= ' '.module_so($params) unless $mac; # MacOSX doesn't allow for linking with bundles :(
Branch: 1 branch
BranchTrueFalseTotal
unless $mac 0 0 0
717
718 0 ▶ my $test_module_name = $tp->{NAME} || 'MyTest';
Condition0%0/2
$tp->{'NAME'} || 'MyTest'
l!l
00
MC/DC0%0/1
$tp->{'NAME'} || 'MyTest'
$tp->{'NAME'}
Truth table0%0/2
A
A= $tp->{'NAME'}
Aresult
11
00
719  
720 my %args = (
721 NAME => $test_module_name,
722 VERSION => $tp->{VERSION} || '0.0.0',
723 ABSTRACT => "test module",
724 SRC => $tp->{SRC},
725 XS => $tp->{XS},
726 0 ▶ BIN_DEPS => $array_merge->([keys %{$params->{MODULE_INFO}{BIN_DEPS}||{}}], $tp->{BIN_DEPS}),
Condition0%0/14
$params->{'MODULE_INFO'}{'BIN_DEPS'} || {}
l!l
00
$tp->{"CPLUS"} // $params->{"CPLUS"}
l!l&&r!l&&!r
000
$tp->{'CC'} || $params->{'CC'}
l!l&&r!l&&!r
000
$tp->{'LD'} || $params->{'LD'}
l!l&&r!l&&!r
000
$tp->{'PARSE_XS'} || $params->{'PARSE_XS'}
l!l&&r!l&&!r
000
MC/DC0%0/1
$params->{'MODULE_INFO'}{'BIN_DEPS'} || {}
$params->{'MODULE_INFO'}{'BIN_DEPS'}
MC/DC0%0/2
$tp->{"CPLUS"} // $params->{"CPLUS"}
$tp->{"CPLUS"} $params->{"CPLUS"}
MC/DC0%0/2
$tp->{'CC'} || $params->{'CC'}
$tp->{'CC'} $params->{'CC'}
MC/DC0%0/2
$tp->{'LD'} || $params->{'LD'}
$tp->{'LD'} $params->{'LD'}
MC/DC0%0/2
$tp->{'PARSE_XS'} || $params->{'PARSE_XS'}
$tp->{'PARSE_XS'} $params->{'PARSE_XS'}
Truth table0%0/2
A
A= $params->{'MODULE_INFO'}{'BIN_DEPS'}
Aresult
11
00
Truth table0%0/3
A // B
A= $tp->{"CPLUS"}B= $params->{"CPLUS"}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $tp->{'CC'}B= $params->{'CC'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $tp->{'LD'}B= $params->{'LD'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $tp->{'PARSE_XS'}B= $params->{'PARSE_XS'}
ABresult
1X1
011
000
727 TYPEMAPS => $array_merge->($params->{TYPEMAPS}, $tp->{TYPEMAPS}),
728 CPLUS => $tp->{CPLUS} // $params->{CPLUS},
729 CC => $tp->{CC} || $params->{CC},
730 LD => $tp->{LD} || $params->{LD},
731 LDFROM => $ldfrom,
732 INC => string_merge($params->{MODULE_INFO}{ORIG}{INC}, $tp->{INC}),
733 CCFLAGS => string_merge($params->{MODULE_INFO}{ORIG}{CCFLAGS}, $tp->{CCFLAGS}),
734 DEFINE => string_merge($params->{DEFINE}, $tp->{DEFINE}),
735 LDDLFLAGS => string_merge($params->{MODULE_INFO}{ORIG}{LDDLFLAGS}, $tp->{LDDLFLAGS}),
736 LINK => string_merge($params->{MODULE_INFO}{ORIG}{LINK}, $tp->{LINK}),
737 XSOPT => string_merge($params->{XSOPT}, $tp->{XSOPT}),
738 PKG_CONFIG => $array_merge->($params->{PKG_CONFIG}, $tp->{PKG_CONFIG}),
739 LIBS => $params->{LIBS},
740 CLIB => $tp->{CLIB},
741 MAKEFILE => 'Makefile.test',
742 OPTIMIZE => merge_optimize($params->{OPTIMIZE}, "-O0", $tp->{OPTIMIZE}, $ENV{TEST_OPTIMIZE}),
743 PARSE_XS => $tp->{PARSE_XS} || $params->{PARSE_XS},
744 0 ▶ NO_MYMETA => 1,
Condition0%0/2
$tp->{'VERSION'} || '0.0.0'
l!l
00
MC/DC0%0/1
$tp->{'VERSION'} || '0.0.0'
$tp->{'VERSION'}
Truth table0%0/2
A
A= $tp->{'VERSION'}
Aresult
11
00
745 _XSTEST => 1,
746 );
747  
748 0 my $mm_args = makemaker_args(%args);
749 0 ▶ return undef unless has_binary($mm_args) || $tp->{CLIB};
Branch: 1 branch
BranchTrueFalseTotal
unless has_binary($mm_args) or $tp->{"CLIB"} 0 0 0
Condition0%0/3
has_binary($mm_args) or $tp->{"CLIB"}
l!l&&r!l&&!r
000
MC/DC0%0/2
has_binary($mm_args) or $tp->{"CLIB"}
has_binary($mm_args) $tp->{"CLIB"}
Truth table0%0/3
A or B
A= has_binary($mm_args)B= $tp->{"CLIB"}
ABresult
1X1
011
000
750
751 0 push @{$params->{MODULE_INFO}{INSTALL_SKIP}}, "${test_module_name}[\\\\/]$test_module_name\\..+";
752  
753 0 my $make_params = '';
754 0 ▶ $make_params .= ' --no-print-directory' if $linux;
Branch: 1 branch
BranchTrueFalseTotal
if $linux 0 0 0
755 0 my $cmd = "\@\$(MAKE)$make_params -f Makefile.test";
756  
757 0 push @{$params->{postamble}},
758 '# --- XS::Install tests compilation section',
759 "ctest_object : ; $cmd object",
760 "ctest_ld : ctest_object \$(INST_DYNAMIC); $cmd",
761 'subdirs-test_dynamic :: ctest_object ctest_ld',
762 'ctest :: ctest_object ctest_ld',
763 "clean :: ; $cmd veryclean",
764 ;
765  
766 # can't transfer requirements to only TEST_REQUIRES because on target machine "perl Makefile.PL" will run before they get installed,
767 # and thus test's makemaker_args() will fail without binary dependency installed. We need to install it before Makefile.PL runs.
768 0 ▶ if (my $prereq = $mm_args->{PREREQ_PM}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $prereq = $mm_args->{"PREREQ_PM"}) 0 0 0
769 0 my $creq = $params->{CONFIGURE_REQUIRES};
770 0 my $treq = $params->{TEST_REQUIRES};
771 0 foreach my $k (keys %$prereq) {
772 0 ▶ next if $k eq $THIS_MODULE;
Branch: 1 branch
BranchTrueFalseTotal
if $k eq $THIS_MODULE 0 0 0
773 0 ▶ $creq->{$k} //= $prereq->{$k};
Condition0%0/3
$creq->{$k} //= $prereq->{$k}
l!l&&r!l&&!r
000
MC/DC0%0/2
$creq->{$k} //= $prereq->{$k}
$creq->{$k} $prereq->{$k}
Truth table0%0/3
A //= B
A= $creq->{$k}B= $prereq->{$k}
ABresult
1X1
011
000
774 0 ▶ $treq->{$k} //= $prereq->{$k};
Condition0%0/3
$treq->{$k} //= $prereq->{$k}
l!l&&r!l&&!r
000
MC/DC0%0/2
$treq->{$k} //= $prereq->{$k}
$treq->{$k} $prereq->{$k}
Truth table0%0/3
A //= B
A= $treq->{$k}B= $prereq->{$k}
ABresult
1X1
011
000
775 }
776 }
777  
778 0 return $mm_args;
779 }
780  
781 0 ▶sub process_test_makefile {
Subroutine process_test_makefile: not called CC=1 SCAR=6.9
Pod undocumented
782 0 my $params = shift;
783 0 push @{$params->{postamble}}, 'object : $(OBJECT)';
784 }
785  
786 31 ▶sub process_cmake_test {
Subroutine process_cmake_test: called CC=7 SCAR=35.8
Pod undocumented
787 31 my ($params, $cmake_params, $test) = @_;
788  
789 31 my $clibs = '';
790 31 ▶ my $clib = $params->{test}{CLIB} or return $cmake_params;
Branch: 1 branch
BranchTrueFalseTotal
my $clib = $params->{"test"}{"CLIB"} or return $cmake_params 0 31 31
791 0 ▶ $clib = [$clib] unless ref($clib) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $clib eq "ARRAY" 0 0 0
792 0 ▶ return $cmake_params unless @$clib;
Branch: 1 branch
BranchTrueFalseTotal
unless @$clib 0 0 0
793  
794 0 ▶ my $cflags = $test->{INC} || '';
Condition0%0/2
$test->{'INC'} || ''
l!l
00
MC/DC0%0/1
$test->{'INC'} || ''
$test->{'INC'}
Truth table0%0/2
A
A= $test->{'INC'}
Aresult
11
00
795 0 _string_merge($cflags, $test->{CCFLAGS});
796 0 _string_merge($cflags, $test->{DEFINE});
797 0 _string_merge($cflags, $test->{OPTIMIZE});
798 0 $cflags =~ s/-o \$@//;
799  
800 0 foreach my $info (@$clib) {
801 0 my $cmake_target = $info->{CMAKE_TARGET};
802 0 ▶ next unless ($cmake_target);
Branch: 1 branch
BranchTrueFalseTotal
unless $cmake_target 0 0 0
803  
804 0 $cmake_params->{TARGETS}{$cmake_target} = "-fPIC $cflags";
805 }
806  
807 0 return $cmake_params;
808 }
809  
810 0 ▶sub run_cmake {
Subroutine run_cmake: not called CC=3 SCAR=24.8
Pod undocumented
811 0 my ($params, $cmake_params) = @_;
812  
813 0 my @options;
814 0 ▶ while (my ($target, $opts) = each(%{$cmake_params->{TARGETS}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$cmake_params{"TARGETS"};}) 0 0 0
815 0 push @options, qq(-D${target}_COMP_OPTIONS="$opts");
816 }
817  
818 0 my $targets = join(';', keys %{$cmake_params->{TARGETS}});
819 0 ▶ push(@options, $cmake_params->{OPTIONS}) if $cmake_params->{OPTIONS};
Branch: 1 branch
BranchTrueFalseTotal
if $cmake_params->{"OPTIONS"} 0 0 0
820 0 my $options = join(' ', @options);
821  
822 0 return XS::Install::CMake::configure($cmake_params->{BUILD_DIR}, $cmake_params->{PROP_DIR}, $cmake_params->{MAIN_TARGET}, qq(-DCONF_TARGETS="$targets" $options));
823 }
824  
825 0 ▶sub apply_CMAKE {
Subroutine apply_CMAKE: not called CC=8 SCAR=42.8
Pod undocumented
826 0 my ($params, $props) = @_;
827 0 my $bs = $params->{BIN_SHARE};
828 0 my $cmake = $props->{CMAKE_BIN};
829 0 my $make = '$(MAKE)';
830 0 ▶ $params->{INC} ||= '';
Condition0%0/2
$params->{"INC"} ||= ""
l!l
00
MC/DC0%0/1
$params->{"INC"} ||= ""
$params->{"INC"}
Truth table0%0/2
A
A= $params->{"INC"}
Aresult
11
00
831 0 my $make_copy = "cmake_inc_copy :: cmake_install\n";
832 0 for my $i (@{$props->{INSTALL_INCLUDE}}) {
833 0 ▶ $bs->{INCLUDE} //= 1;
Condition0%0/2
$bs->{"INCLUDE"} //= 1
l!l
00
MC/DC0%0/1
$bs->{"INCLUDE"} //= 1
$bs->{"INCLUDE"}
Truth table0%0/2
A
A= $bs->{"INCLUDE"}
Aresult
11
00
834 0 $make_copy .= "\t$cmake -E copy_directory $props->{CMAKE_TMP_INSTALL_DIR}/$i \$(INST_ARCHLIB)/\$(FULLEXT).x/i/\n";
835 }
836 0 for my $i (@{$props->{BUILD_INCLUDE}}) {
837 0 _string_merge($params->{INC}, "-I$i");
838 0 _string_merge($params->{MODULE_INFO}{ORIG}{INC}, "-I$i");
839 0 ▶ _string_merge($params->{test}{INC}, "-I$i") if $params->{test};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"test"} 0 0 0
840 }
841 0 _uniq_list($props->{INC});
842 0 my @incs = map {"-I$_"} @{$props->{INC}};
843 0 _string_merge($params->{INC}, @incs);
844 0 _string_merge($params->{MODULE_INFO}{ORIG}{INC}, @incs);
845 0 ▶ _string_merge($params->{test}{INC}, @incs) if $params->{test};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"test"} 0 0 0
846  
847 0 ▶ if ($bs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bs) 0 0 0
848 0 _string_merge($bs->{CCFLAGS}, @{$props->{CCFLAGS}});
849 0 _string_merge($bs->{DEFINE}, @{$props->{DEFINE}});
850 0 _string_merge($bs->{INC}, @incs);
851 0 _string_merge($bs->{LINK}, @{$props->{LIBS}});
852 }
853  
854 0 $params->{CCFLAGS} = string_merge($params->{CCFLAGS}, @{$props->{CCFLAGS}});
855 0 $params->{DEFINE} = string_merge($params->{DEFINE}, @{$props->{DEFINE}});
856 0 $params->{LINK} = string_merge($params->{LINK}, @{$props->{LIBS}});
857  
858 0 push @{$params->{postamble}}, $make_copy;
859 0 push @{$params->{postamble}}, "pm_to_blib : cmake_inc_copy";
860 }
861  
862 31 ▶sub process_INSTALL_SKIP {
Subroutine process_INSTALL_SKIP: called CC=11 SCAR=45.3
Pod undocumented
863 31 my $params = shift;
864 31 my $list = $params->{MODULE_INFO}{INSTALL_SKIP};
865 31 ▶ return unless $list && @$list;
Branch: 1 branch
BranchTrueFalseTotal
unless $list and @$list 31 0 31
Condition33%1/3
$list and @$list
!ll&&!rl&&r
0310
MC/DC0%0/2
$list and @$list
$list @$list
Truth table33%1/3
A and B
A= $listB= @$list
ABresult
0X0
100
111
866 0 my %hash = map {$_ => 1} @$list;
867 0 my $file = "INSTALL.SKIP";
868 0 my $lastc;
869 0 ▶ if (open my $fh, '<', $file) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, "<", $file) 0 0 0
870 0 my @lines = <$fh>;
871 0 ▶ $lastc = substr($lines[-1], -1, 1) if @lines;
Branch: 1 branch
BranchTrueFalseTotal
if @lines 0 0 0
872 0 map {chomp} @lines;
873 0 delete $hash{$_} for @lines;
874 0 close $fh;
875 }
876 0 ▶ return unless %hash;
Branch: 1 branch
BranchTrueFalseTotal
unless %hash 0 0 0
877 0 ▶ if (open my $fh, '>>', $file) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, ">>", $file) 0 0 0
878 0 ▶ print $fh "\n" if defined($lastc) && $lastc ne "\n" && $lastc ne "\r";
Branch: 1 branch
BranchTrueFalseTotal
if defined $lastc and $lastc ne "\n" and $lastc ne "\r" 0 0 0
Condition0%0/6
defined $lastc and $lastc ne "\n" and $lastc ne "\r"
!ll&&!rl&&r
000
defined $lastc and $lastc ne "\n"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $lastc and $lastc ne "\n" and $lastc ne "\r"
defined $lastc $lastc ne "\n" $lastc ne "\r"
Truth table0%0/4
A and B and C
A= defined $lastcB= $lastc ne "\n"C= $lastc ne "\r"
ABCresult
0XX0
10X0
1100
1111
879 0 print $fh join("\n", keys %hash);
880 0 print $fh "\n";
881 0 close $fh;
882 }
883 }
884  
885 31 ▶sub post_process {
Subroutine post_process: called CC=5 SCAR=16.1
Pod undocumented
886 31 my $params = shift;
887 31 my $postamble = $params->{postamble};
888 31 my $mi = $params->{MODULE_INFO};
889  
890 31 ▶ if (my $link = $params->{LINK}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $link = $params->{"LINK"}) 3 28 31
891 3 ▶ my $dl = $params->{dynamic_lib} ||= {};
Condition50%1/2
$params->{"dynamic_lib"} ||= {}
l!l
03
MC/DC0%0/1
$params->{"dynamic_lib"} ||= {}
$params->{"dynamic_lib"}
Truth table50%1/2
A
A= $params->{"dynamic_lib"}
Aresult
11
00
892 3 _string_merge($dl->{OTHERLDFLAGS}, $link);
893 3 $dl->{OTHERLDFLAGS} = _uniq_link($dl->{OTHERLDFLAGS});
894 }
895  
896 31 ▶ delete @$params{qw/C H OBJECT XS CCFLAGS LDFROM OPTIMIZE XSOPT/} unless has_binary($params);
Branch: 1 branch
BranchTrueFalseTotal
unless has_binary($params) 1 30 31
897 31 delete @$params{qw/CPLUS PARSE_XS SRC MODULE_INFO _XSTEST CMAKE_PARAMS PKG_CONFIG LINK/};
898  
899 # convert array to hash for postamble
900 31 $params->{postamble} = {};
901 31 my $i = 0;
902 31 $params->{postamble}{++$i} = $_ for @$postamble;
903 }
904  
905 31 ▶sub _merge_libs {
Subroutine _merge_libs: called CC=10 SCAR=42.7
906 31 my ($params, $add_libs) = @_;
907 31 ▶ return unless $add_libs and @$add_libs;
Branch: 1 branch
BranchTrueFalseTotal
unless $add_libs and @$add_libs 31 0 31
Condition33%1/3
$add_libs and @$add_libs
!ll&&!rl&&r
3100
MC/DC0%0/2
$add_libs and @$add_libs
$add_libs @$add_libs
Truth table33%1/3
A and B
A= $add_libsB= @$add_libs
ABresult
0X0
100
111
908 0 ▶ my $libs = $params->{LIBS} || [];
Condition0%0/2
$params->{'LIBS'} || []
l!l
00
MC/DC0%0/1
$params->{'LIBS'} || []
$params->{'LIBS'}
Truth table0%0/2
A
A= $params->{'LIBS'}
Aresult
11
00
909 0 ▶ $libs = [$libs] unless ref($libs) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $libs eq "ARRAY" 0 0 0
910 0 ▶ if ($libs and @$libs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($libs and @$libs) { } 0 0 0
Condition0%0/3
$libs and @$libs
!ll&&!rl&&r
000
MC/DC0%0/2
$libs and @$libs
$libs @$libs
Truth table0%0/3
A and B
A= $libsB= @$libs
ABresult
0X0
100
111
911 0 my @result;
912 0 foreach my $l1 (@$libs) {
913 0 foreach my $l2 (@$add_libs) {
914 0 ▶ push @result, $l2 ? "$l1 $l2" : $l1;
Branch: 1 branch
BranchTrueFalseTotal
$l2 ? : 0 0 0
915 }
916 }
917 0 $params->{LIBS} = \@result;
918 }
919 else {
920 0 $params->{LIBS} = $add_libs;
921 }
922 }
923  
924 250 ▶sub canonize_array {
Subroutine canonize_array: called CC=3 SCAR=11.0
Pod undocumented
925 250 ▶ if (!$_[0]) { $_[0] = [] }
Branch: 2 branches
BranchTrueFalseTotal
if (not $_[0]) { } 182 68 250
elsif (ref $_[0] ne 'ARRAY') { } 9 59 68
926 9 elsif (ref($_[0]) ne 'ARRAY') { $_[0] = [$_[0]] }
927 }
928  
929 250 ▶sub canonize_array_split {
Subroutine canonize_array_split: called CC=1 SCAR=0.0
Pod undocumented
930 250 canonize_array($_[0]);
931 250 @{$_[0]} = map { split ' ' } @{$_[0]};
932 }
933  
934 91 ▶sub canonize_array_files {
Subroutine canonize_array_files: called CC=1 SCAR=0.0
Pod undocumented
935 91 canonize_array_split($_[0]);
936 11 ▶ @{$_[0]} = map { glob } @{$_[0]};
Subroutine BEGIN: called CC=1 SCAR=0.0
937 }
938  
939 # returns version of binary module which was installed with XS::Install without loading it
940 31 ▶sub binary_module_version {
Subroutine binary_module_version: called CC=4 SCAR=14.2
Pod undocumented
941 31 my $module = shift;
942 # user might use his own module for it's Makefile.PL (very rare case but possible, for example this module does it)
943 # to avoid finding it, and find only installed pm, we must se if it has data dir (Module.x) in the same folder
944 # so we will just find the data folder and get the pm from there
945 31 ▶ my $ddir = XS::Install::Payload::data_dir($module) or return (0, "data dir for $module not found");
Branch: 1 branch
BranchTrueFalseTotal
my $ddir = XS::Install::Payload::data_dir($module) or return 0, "data dir for $module not found" 31 0 31
946 31 my $pm = $ddir;
947 31 $pm =~ s#\.x$#.pm#;
948 31 ▶ return (0, "no $pm found") unless -f $pm;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $pm 0 31 31
949 31 my $version = MM->parse_version($pm);
950 31 ▶ return (0, "version from $pm cannot be parsed") unless $version;
Branch: 1 branch
BranchTrueFalseTotal
unless $version 0 31 31
951 31 return ($version, undef);
952 }
953  
954 86 ▶sub has_c { return $_[0]->{C} && scalar(@{$_[0]->{C}}) ? 1 : 0 }
Subroutine has_c: called CC=3 SCAR=11.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'C'} && scalar @{$_[0]{'C'};} ? : 84 2 86
Condition50%1/2
$_[0]{"C"} and scalar @{$_[0]{"C"};}
!ll
086
MC/DC0%0/1
$_[0]{"C"} and scalar @{$_[0]{"C"};}
$_[0]{"C"}
Truth table50%1/2
A
A= $_[0]{"C"}
Aresult
00
11
955 2 ▶sub has_object { return $_[0]->{OBJECT} && scalar(@{$_[0]->{OBJECT}}) ? 1 : 0 }
Subroutine has_object: called CC=3 SCAR=12.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'OBJECT'} && scalar @{$_[0]{'OBJECT'};} ? : 0 2 2
Condition50%1/2
$_[0]{"OBJECT"} and scalar @{$_[0]{"OBJECT"};}
!ll
02
MC/DC0%0/1
$_[0]{"OBJECT"} and scalar @{$_[0]{"OBJECT"};}
$_[0]{"OBJECT"}
Truth table50%1/2
A
A= $_[0]{"OBJECT"}
Aresult
00
11
956 2 ▶sub has_xs { return $_[0]->{XS} && scalar(keys %{$_[0]->{XS}}) ? 1 : 0 }
Subroutine has_xs: called CC=3 SCAR=12.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'XS'} && scalar keys %{$_[0]{'XS'};} ? : 0 2 2
Condition50%1/2
$_[0]{"XS"} and scalar keys %{$_[0]{"XS"};}
!ll
02
MC/DC0%0/1
$_[0]{"XS"} and scalar keys %{$_[0]{"XS"};}
$_[0]{"XS"}
Truth table50%1/2
A
A= $_[0]{"XS"}
Aresult
00
11
957 2 ▶sub has_ext { return $_[0]->{MODULE_INFO} && $_[0]->{MODULE_INFO}{STATIC_LIBS} && scalar(@{$_[0]->{MODULE_INFO}{STATIC_LIBS}}) ? 1 : 0 }
Subroutine has_ext: called CC=4 SCAR=16.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'MODULE_INFO'} && $_[0]{'MODULE_INFO'}{'STATIC_LIBS'} && scalar @{$_[0]{'MODULE_INFO'}{'STATIC_LIBS'};} ? : 0 2 2
Condition40%2/5
$_[0]{"MODULE_INFO"} and $_[0]{"MODULE_INFO"}{"STATIC_LIBS"} and scalar @{$_[0]{"MODULE_INFO"}{"STATIC_LIBS"};}
!ll
02
$_[0]{"MODULE_INFO"} and $_[0]{"MODULE_INFO"}{"STATIC_LIBS"}
!ll&&!rl&&r
002
MC/DC0%0/2
$_[0]{"MODULE_INFO"} and $_[0]{"MODULE_INFO"}{"STATIC_LIBS"} and scalar @{$_[0]{"MODULE_INFO"}{"STATIC_LIBS"};}
$_[0]{"MODULE_INFO"} $_[0]{"MODULE_INFO"}{"STATIC_LIBS"}
Truth table33%1/3
A and B
A= $_[0]{"MODULE_INFO"}B= $_[0]{"MODULE_INFO"}{"STATIC_LIBS"}
ABresult
0X0
100
111
958 86 ▶sub has_binary { return has_c($_[0]) || has_object($_[0]) || has_xs($_[0]) || has_ext($_[0]) }
Subroutine has_binary: called CC=4 SCAR=14.9
Pod undocumented
Condition66%6/9
has_c($_[0]) || has_object($_[0]) || has_xs($_[0]) || has_ext($_[0])
l!l&&r!l&&!r
8402
has_c($_[0]) or has_object($_[0]) or has_xs($_[0])
l!l&&r!l&&!r
8402
has_c($_[0]) or has_object($_[0])
l!l&&r!l&&!r
8402
MC/DC25%1/4
has_c($_[0]) || has_object($_[0]) || has_xs($_[0]) || has_ext($_[0])
has_c($_[0]) has_object($_[0]) has_xs($_[0]) has_ext($_[0])
Truth table40%2/5
A or B or C || D
A= has_c($_[0])B= has_object($_[0])C= has_xs($_[0])D= has_ext($_[0])
ABCDresult
1XXX1
01XX1
001X1
00011
00000
959  
960 31 ▶sub merge_optimize {
Subroutine merge_optimize: called CC=7 SCAR=19.5
Pod undocumented
961 31 my $to = shift;
962 31 ▶ $to ||= '';
Condition50%1/2
$to ||= ""
l!l
310
MC/DC0%0/1
$to ||= ""
$to
Truth table50%1/2
A
A= $to
Aresult
11
00
963 31 my @singleton = (qr/-O[0-9]/, qr/-g[0-9]?/);
964 31 foreach my $from (@_) {
965 62 ▶ next unless $from;
Branch: 1 branch
BranchTrueFalseTotal
unless $from 0 62 62
966 62 foreach my $tok (split ' ', $from) {
967 124 foreach my $qr (@singleton) {
968 248 ▶ next unless $tok =~ /^$qr$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $tok =~ /^$qr$/ 186 62 248
969 62 $to =~ s/(^|\s)$qr(\s|$)/ /g;
970 }
971 124 $to .= " $tok";
972 }
973 }
974 31 $to =~ s/^\s+//;
975 31 $to =~ s/\s+$//;
976 31 $to =~ s/\s{2,}/ /g;
977 31 return $to;
978 }
979  
980 22 ▶sub _install {
Subroutine _install: called CC=4 SCAR=13.9
981 22 my ($params, $map, $path) = @_;
982 22 ▶ return unless %$map;
Branch: 1 branch
BranchTrueFalseTotal
unless %$map 6 16 22
983 16 my $instroot = _instroot($params);
984 16 ▶ my $pm = $params->{PM} ||= {};
Condition50%1/2
$params->{"PM"} ||= {}
l!l
160
MC/DC0%0/1
$params->{"PM"} ||= {}
$params->{"PM"}
Truth table50%1/2
A
A= $params->{"PM"}
Aresult
11
00
985 16 ▶ while (my ($source, $dest) = each %$map) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$map) 33 16 49
986 33 my $instpath = "$instroot/\$(FULLEXT).x/$path/$dest";
987 33 $instpath =~ s#[/\\]{2,}#/#g;
988 33 $pm->{$source} = $instpath;
989 }
990 }
991  
992 47 ▶sub _instroot { return has_binary($_[0]) ? '$(INST_ARCHLIB)' : '$(INST_LIB)' }
Subroutine _instroot: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
has_binary($_[0]) ? : 46 1 47
993  
994 0 ▶sub module_so {
Subroutine module_so: not called CC=2 SCAR=17.9
Pod undocumented
995 0 my $params = shift;
996 0 ▶ return undef unless has_binary($params);
Branch: 1 branch
BranchTrueFalseTotal
unless has_binary($params) 0 0 0
997 0 return _instroot($params).'/auto/'._pkg_slash($params->{NAME}).'/'.module_so_file($params);
998 }
999  
1000 4 ▶sub module_so_file {
Subroutine module_so_file: called CC=4 SCAR=15.0
Pod undocumented
1001 4 my $params = shift;
1002 4 ▶ return undef unless has_binary($params);
Branch: 1 branch
BranchTrueFalseTotal
unless has_binary($params) 0 4 4
1003 4 my @modparts = split(/::/, $params->{NAME});
1004 4 my $modfname = $modparts[-1];
1005 4 ▶ $modfname = DynaLoader::mod2fname(\@modparts) if defined &DynaLoader::mod2fname;
Branch: 1 branch
BranchTrueFalseTotal
if defined &DynaLoader::mod2fname 0 4 4
1006 4 ▶ return $modfname.'.'.($params->{DLEXT} || $Config{dlext});
Condition33%1/3
$params->{'DLEXT'} || $XS::Install::Config{'dlext'}
l!l&&r!l&&!r
040
MC/DC0%0/2
$params->{'DLEXT'} || $XS::Install::Config{'dlext'}
$params->{'DLEXT'} $XS::Install::Config{'dlext'}
Truth table33%1/3
A || B
A= $params->{'DLEXT'}B= $XS::Install::Config{'dlext'}
ABresult
1X1
011
000
1007 }
1008  
1009 31 ▶sub _sync {
Subroutine _sync: called CC=3 SCAR=14.2
1010 11 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1011 31 my $from = 'MYSOURCE';
1012 31 my $to = 'MY';
1013 31 foreach my $method (keys %{"${from}::"}) {
1014 0 ▶ next unless defined &{"${from}::$method"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined &{"${from}::$method";} 0 0 0
1015 0 *{"${to}::$method"} = \&{"${from}::$method"};
1016 }
1017 }
1018  
1019 131 ▶sub _scan_files {
Subroutine _scan_files: called CC=6 SCAR=17.9
1020 131 my ($mask, $dir) = @_;
1021 131 ▶ return grep {_is_file_ok($_)} glob($mask) unless $dir;
Branch: 1 branch
BranchTrueFalseTotal
unless $dir 53 78 131
1022  
1023 78 my @list = grep {_is_file_ok($_)} glob(join(' ', map {"$dir/$_"} split(' ', $mask)));
1024  
1025 78 ▶ opendir(my $dh, $dir) or die "Could not open dir '$dir' for scanning: $!";
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $dir or die "Could not open dir '${dir}' for scanning: $!" 78 0 78
1026 78 ▶ while (my $entry = readdir $dh) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $entry = readdir $dh)) 315 78 393
1027 315 ▶ next if $entry =~ /^\./;
Branch: 1 branch
BranchTrueFalseTotal
if $entry =~ /^\./ 156 159 315
1028 159 my $path = "$dir/$entry";
1029 159 ▶ next unless -d $path;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $path 129 30 159
1030 30 push @list, _scan_files($mask, $path);
1031 }
1032 78 closedir $dh;
1033  
1034 78 return @list;
1035 }
1036  
1037 245 ▶sub _is_file_ok {
Subroutine _is_file_ok: called CC=6 SCAR=18.7
1038 245 my $file = shift;
1039 245 ▶ return unless -f $file;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $file 3 242 245
1040 242 ▶ return if $file =~ /\#/;
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /\#/ 0 242 242
1041 242 ▶ return if $file =~ /~$/; # emacs temp files
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /~$/ 0 242 242
1042 242 ▶ return if $file =~ /,v$/; # RCS files
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /,v$/ 0 242 242
1043 242 ▶ return if $file =~ m{\.swp$}; # vim swap files
Branch: 1 branch
BranchTrueFalseTotal
if $file =~ /\.swp$/ 0 242 242
1044 242 return 1;
1045 }
1046  
1047 18 ▶sub _process_map {
Subroutine _process_map: called CC=7 SCAR=19.5
1048 18 my ($map, $mask) = @_;
1049 18 foreach my $source (keys %$map) {
1050 18 ▶ my $dest = $map->{$source} || $source;
Condition66%2/3
$map->{$source} || $source
l!l&&r!l&&!r
1260
MC/DC0%0/2
$map->{$source} || $source
$map->{$source} $source
Truth table66%2/3
A || B
A= $map->{$source}B= $source
ABresult
1X1
011
000
1051 18 ▶ if (-f $source) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $source) 11 7 18
1052 11 ▶ $dest .= $source if $dest =~ m#[/\\]$#;
Branch: 1 branch
BranchTrueFalseTotal
if $dest =~ m([/\\]$) 2 9 11
1053 11 $dest =~ s#[/\\]{2,}#/#g;
1054 11 $dest =~ s#^[/\\]+##;
1055 11 $map->{$source} = $dest;
1056 11 next;
1057 }
1058 7 ▶ next unless -d $source;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $source 0 7 7
1059  
1060 7 delete $map->{$source};
1061 7 my @files = _scan_files($mask, $source);
1062 7 foreach my $file (@files) {
1063 18 my $dest_file = $file;
1064 18 $dest_file =~ s/^$source//;
1065 18 $dest_file = "$dest/$dest_file";
1066 18 $dest_file =~ s#[/\\]{2,}#/#g;
1067 18 $dest_file =~ s#^[/\\]+##;
1068 18 $map->{$file} = $dest_file;
1069 }
1070 }
1071 }
1072  
1073 128 ▶sub _uniq_list {
Subroutine _uniq_list: called CC=1 SCAR=0.0
1074 128 my $list = shift;
1075 128 my %uniq;
1076 128 @$list = grep { !$uniq{$_}++ } @$list;
1077 }
1078  
1079 269 ▶sub _string_merge {
Subroutine _string_merge: called CC=4 SCAR=13.9
1080 269 ▶ return unless $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[1] 156 113 269
1081 113 ▶ $_[0] ||= '';
Condition100%2/2
$_[0] ||= ""
l!l
3776
MC/DC100%1/1
$_[0] ||= ""
$_[0]
Truth table100%2/2
A
A= $_[0]
Aresult
11
00
1082 113 ▶ $_[0] .= $_[0] ? " $_[1]" : $_[1];
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 37 76 113
1083 }
1084  
1085 62 ▶sub string_merge {
Subroutine string_merge: called CC=6 SCAR=18.2
Pod undocumented
1086 62 my $s = shift;
1087 62 ▶ $s //= '';
Condition100%2/2
$s //= ""
l!l
3131
MC/DC100%1/1
$s //= ""
$s
Truth table100%2/2
A
A= $s
Aresult
11
00
1088 62 for my $val (@_) {
1089 62 ▶ next unless defined($val) && length($val);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val and length $val 31 31 62
Condition66%2/3
defined $val and length $val
!ll&&!rl&&r
31031
MC/DC50%1/2
defined $val and length $val
defined $val length $val
Truth table66%2/3
A and B
A= defined $valB= length $val
ABresult
0X0
100
111
1090 31 ▶ if (!$s) { $s = $val }
Branch: 1 branch
BranchTrueFalseTotal
if (not $s) { } 31 0 31
1091 0 else { $s .= " $val"; }
1092 }
1093 62 return $s;
1094 }
1095  
1096 179 ▶sub c2obj_file {
Subroutine c2obj_file: called CC=1 SCAR=0.0
Pod undocumented
1097 179 my $file = shift;
1098 179 $file =~ s/\.[^.]+$//;
1099 179 return $file.'$(OBJ_EXT)';
1100 }
1101  
1102 {
1103 package
1104 MY;
1105 11 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
1106  
1107 11 ▶ my $gcc_compliant = $Config{cc} =~ /\b(gcc|clang)\b/i ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$MY::Config{'cc'} =~ /\b(gcc|clang)\b/i ? : 0 11 11
1108  
1109 0 ▶ sub init_methods {
Subroutine init_methods: not called CC=3 SCAR=23.9
1110 11 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
1111  
1112 # change "subdirs-test*" rule type from "::" to ":" as GNU make has a bug and can't do its deps in parallel
1113 0 ▶ sub _fix_subdirs {
Subroutine _fix_subdirs: not called CC=1 SCAR=6.9
1114 0 my $s = shift;
1115 0 $s =~ s/^((subdirs-test(?:_dynamic|_static)?\s*)+)::/$1:/mg;
1116 0 return $s;
1117 }
1118  
1119 0 ▶ *postamble = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
1120 0 my $self = shift;
1121 0 my %args = @_;
1122  
1123 0 my @list;
1124 0 my $i = 1;
1125 0 while (1) {
1126 0 ▶ last unless exists $args{$i};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{$i} 0 0 0
1127 0 push @list, $args{$i};
1128 0 ++$i;
1129 }
1130  
1131 0 return _fix_subdirs(join("\n\n", @list));
1132 0 };
1133  
1134 0 ▶ *test = sub { return _fix_subdirs(shift->SUPER::test(@_)) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
1135  
1136 0 ▶ if ($fix_bsd_make_j) { # bsd's make has a bug: wrong value of $* when building in parallel, we use $< instead
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_bsd_make_j) 0 0 0
1137 0 ▶ *c_o = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
1138 0 my $self = shift;
1139 0 my $ret = $self->SUPER::c_o(@_);
1140 0 $ret =~ s/\$\*\.c(c|pp|xx)?[ \t]*$/\$</gism;
1141 0 return $ret;
1142 0 };
1143 }
1144  
1145 0 ▶ if ($win32) {
Branch: 1 branch
BranchTrueFalseTotal
if ($win32) 0 0 0
1146 0 ▶ *dynamic_lib = sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
1147 0 my ($self, %attribs) = @_;
1148 0 my $code = $self->SUPER::dynamic_lib(%attribs);
1149  
1150 0 ▶ unless ($gcc_compliant) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($gcc_compliant) 0 0 0
1151 0 warn(
1152 "$THIS_MODULE: to maintain UNIX-like shared library behaviour on windows (export all symbols by default), we need gcc-compliant linker. ".
1153 "$THIS_MODULE-dependant modules should only be installed on perls with MinGW shell (like strawberry perl), or at least having gcc compiler. ".
1154 "I will continue, but this module's binary dependencies may not work."
1155 );
1156 0 return $code;
1157 }
1158 0 ▶ return $code unless $code;
Branch: 1 branch
BranchTrueFalseTotal
unless $code 0 0 0
1159  
1160 # remove .def-related from code, remove double DLL build, remove dll.exp from params, add export all symbols param.
1161 0 ▶ my $DLLTOOL = $Config{dlltool} || 'dlltool';
Condition0%0/2
$MY::Config{'dlltool'} || 'dlltool'
l!l
00
MC/DC0%0/1
$MY::Config{'dlltool'} || 'dlltool'
$MY::Config{'dlltool'}
Truth table0%0/2
A
A= $MY::Config{'dlltool'}
Aresult
11
00
1162 0 my (@out, $last_ld);
1163 0 ▶ map { $last_ld = $_ if /\$\(LD\)\s/ } split /\n/, $code;
Branch: 1 branch
BranchTrueFalseTotal
if /\$\(LD\)\s/ 0 0 0
1164 0 foreach my $line (split /\n/, $code) {
1165 0 ▶ next if $line =~ /$DLLTOOL/; # drop dlltool calls (we dont need .def file)
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /$DLLTOOL/ 0 0 0
1166 0 ▶ if ($line =~ /\$\(LD\)\s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /\$\(LD\)\s/) 0 0 0
1167 0 ▶ next if $line ne $last_ld;
Branch: 1 branch
BranchTrueFalseTotal
if $line ne $last_ld 0 0 0
1168 0 $line =~ s/\$\(LD\)\s/\$(LD) -Wl,--export-all-symbols /;
1169 0 $line =~ s/\bdll\.exp\b//;
1170 }
1171 0 $line =~ s/\$\(EXPORT_LIST\)//g; # remove <PACKAGE>.def from target dependency
1172 0 push @out, $line;
1173 }
1174  
1175 0 $code = join("\n", @out);
1176 0 return $code;
1177 0 };
1178  
1179 0 ▶ *dlsyms = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
1180 0 my ($self, %attribs) = @_;
1181 0 ▶ return '' if $gcc_compliant; # our dynamic_lib target doesn't need any .def files with gcc
Branch: 1 branch
BranchTrueFalseTotal
if $gcc_compliant 0 0 0
1182 0 return $self->SUPER::dlsyms(%attribs);
1183 0 };
1184 };
1185 }
1186 }
1187  
1188 11 ▶sub _require_makemaker {
Subroutine _require_makemaker: not called CC=2 SCAR=14.6
1189 0 ▶ unless ($INC{'ExtUtils/MakeMaker.pm'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($INC{"ExtUtils/MakeMaker.pm"}) 0 0 0
1190 0 require ExtUtils::MakeMaker;
1191 0 ExtUtils::MakeMaker->import();
1192 }
1193 }
1194  
1195 0 ▶sub not_available {
Subroutine not_available: not called CC=1 SCAR=6.9
Pod documented
1196 0 my $msg = shift;
1197 0 die "OS unsupported: $msg\n";
1198 }
1199  
1200 0 ▶sub _get_cplusplus {
Subroutine _get_cplusplus: not called CC=6 SCAR=37.4
1201 0 my ($cpp, $minstd) = @_;
1202 0 ▶ $cpp ||= 'c++'; # exists on most platforms/compilers
Condition0%0/2
$cpp ||= "c++"
l!l
00
MC/DC0%0/1
$cpp ||= "c++"
$cpp
Truth table0%0/2
A
A= $cpp
Aresult
11
00
1203  
1204 # check compiler existance
1205 0 my $v_out = `$cpp -v 2>&1`;
1206 0 ▶ not_available("C++ compiler not available") unless defined $v_out;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v_out 0 0 0
1207  
1208 #check if C++ compiler supports -std=XXX
1209 0 mkdir 'tmp';
1210 0 my $tmpfile = 'tmp/__xs_install_check_cpp.cc';
1211 0 my $outfile = 'tmp/__xs_install_check_cpp.out';
1212 0 ▶ if (open my $fh, '>', $tmpfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, ">", $tmpfile) 0 0 0
1213 0 print $fh "int main () { return 0; }\n";
1214 0 close $fh;
1215 0 unlink $outfile;
1216 0 `$cpp -c -std=c++$minstd -o $outfile $tmpfile 2>&1`;
1217 0 my $success = -f $outfile;
1218 0 unlink $tmpfile, $outfile;
1219 0 rmdir 'tmp';
1220 0 ▶ not_available("C++ compiler does not support -std=c++$minstd") unless $success;
Branch: 1 branch
BranchTrueFalseTotal
unless $success 0 0 0
1221 }
1222  
1223 #check exceptions
1224 not_available(
1225 0 ▶ "SJLJ compiler detected\n".
Branch: 1 branch
BranchTrueFalseTotal
if $v_out =~ /--enable-sjlj-exceptions/ 0 0 0
1226 "***************************************************************\n".
1227 "You are using c++ compiler with SJLJ exceptions enabled.\n".
1228 "It makes it impossible to use C++ exceptions and perl together.\n".
1229 "You need to use compiler with DWARF2 or SEH exceptions configured.\n".
1230 "If you are using Strawberry Perl, install Strawberry 5.26 or higher\n".
1231 "where they use mingw with SEH exceptions.\n".
1232 "***************************************************************"
1233 ) if $v_out =~ /--enable-sjlj-exceptions/;
1234  
1235 0 return $cpp;
1236 }
1237  
1238 62 ▶sub _pkg_slash {
Subroutine _pkg_slash: called CC=1 SCAR=0.0
1239 62 my $pkg = shift;
1240 62 $pkg =~ s#::#/#g;
1241 62 return $pkg;
1242 }
1243  
1244 0 ▶sub _pkg_last {
Subroutine _pkg_last: not called CC=2 SCAR=17.9
1245 0 my $pkg = shift;
1246 0 ▶ return unless $pkg =~ /([^:]+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $pkg =~ /([^:]+)$/ 0 0 0
1247 0 return $1;
1248 }
1249  
1250 31 ▶sub _pkg_file { return _pkg_slash(shift).'.pm' }
Subroutine _pkg_file: called CC=1 SCAR=0.0
1251  
1252 3 ▶sub _split_path_args {
Subroutine _split_path_args: called CC=2 SCAR=6.9
1253 3 my $str = shift;
1254  
1255 3 my $simple_arg = qr/[^"' \t]+/;
1256 3 my $dquoted_arg = qr/"([^"]+|\\")*"/;
1257 3 my $quoted_arg = qr/'([^']+|\\')*'/;
1258  
1259 3 my @args;
1260 3 ▶ push @args, $1 while $str =~ s/^\s*($simple_arg|$dquoted_arg|$quoted_arg)(\s+|$)//g;
Branch: 1 branch
BranchTrueFalseTotal
$str =~ s/^\s*($simple_arg|$dquoted_arg|$quoted_arg)(\s+|$)//g and do { push @args, $1 } 8 3 11
1261  
1262 3 return @args;
1263 }
1264  
1265 3 ▶sub _uniq_link {
Subroutine _uniq_link: called CC=1 SCAR=0.0
1266 3 my $link = shift;
1267 3 my @args = _split_path_args($link);
1268 3 my %uniq;
1269 3 @args = grep { !$uniq{$_}++ } @args;
1270 3 return join ' ', @args;
1271 }
1272  
1273 11 1;
« Install/FrozenShit/ParseXS/Node.pm ↑ Summary Install/Util.pm »