alienfile

filter: Statementstmt 28.8% 51 / 177 Branchbran 9.7% 8 / 82 Conditioncond 7.6% 5 / 65 MC/DCmcdc 0.0% 0 / 39 Subroutinesub 61.1% 11 / 18 Podpod n/a totaltotal 19.6% 75 / 381 CC 67 SCAR 49.4
CC
67
Cov
20%
_windows_openssl_root
343.9
__ANON__
240.0
_cmake_generator_args
90.0
CRAP 140.2
↑ Summary blib/lib/Alien/ngtcp2/Install/Files.pm »
1 1 ▶use alienfile 2.84;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Cwd qw(abs_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use IPC::Cmd qw(can_run run);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 my $minimum_version = '1.25.0';
9 1 my $crypto_backend = 'picotls';
10 1 my $crypto_package = 'libngtcp2_crypto_picotls';
11  
12 1 ▶sub _pkg_config_command {
Subroutine _pkg_config_command: called CC=4 SCAR=17.9
13 return $ENV{PKG_CONFIG}
14 1 ▶ if defined($ENV{PKG_CONFIG}) && length($ENV{PKG_CONFIG});
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{"PKG_CONFIG"} and length $ENV{"PKG_CONFIG"} 0 1 1
Condition33%1/3
defined $ENV{"PKG_CONFIG"} and length $ENV{"PKG_CONFIG"}
!ll&&!rl&&r
100
MC/DC0%0/2
defined $ENV{"PKG_CONFIG"} and length $ENV{"PKG_CONFIG"}
defined $ENV{"PKG_CONFIG"} length $ENV{"PKG_CONFIG"}
Truth table33%1/3
A and B
A= defined $ENV{"PKG_CONFIG"}B= length $ENV{"PKG_CONFIG"}
ABresult
0X0
100
111
15  
16 1 ▶ return can_run('pkg-config') || can_run('pkgconf');
Condition33%1/3
can_run('pkg-config') || can_run('pkgconf')
l!l&&r!l&&!r
001
MC/DC0%0/2
can_run('pkg-config') || can_run('pkgconf')
can_run('pkg-config') can_run('pkgconf')
Truth table33%1/3
A || B
A= can_run('pkg-config')B= can_run('pkgconf')
ABresult
1X1
011
000
17 }
18  
19 1 ▶sub _pkg_config_has {
Subroutine _pkg_config_has: called CC=2 SCAR=8.1
20 1 my ($command, $package, $version) = @_;
21  
22 1 ▶ return 0 if !defined $command;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $command 1 0 1
23  
24 0 return system(
25 $command,
26 "--atleast-version=$version",
27 $package,
28 ) == 0;
29 }
30  
31 0 ▶sub _pkg_config_output {
Subroutine _pkg_config_output: not called CC=3 SCAR=24.8
32 0 my ($command, @args) = @_;
33  
34 0 ▶ return if !defined $command;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $command 0 0 0
35  
36 0 my $stdout = '';
37 0 my $ok = run(
38 command => [$command, @args],
39 buffer => \$stdout,
40 verbose => 0,
41 );
42  
43 0 ▶ return if !$ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
44  
45 0 $stdout =~ s/\s+\z//;
46  
47 0 return $stdout;
48 }
49  
50 0 ▶sub _cmake_path {
Subroutine _cmake_path: not called CC=3 SCAR=24.8
51 0 my ($path) = @_;
52  
53 0 ▶ return $path if !defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 0 0
54  
55 0 ▶ $path =~ s{\\}{/}g if $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 0 0
56  
57 0 return $path;
58 }
59  
60 0 ▶sub _cmake_generator_args {
Subroutine _cmake_generator_args: not called CC=9 SCAR=45.0
61 0 ▶ return () if $^O ne 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O ne "MSWin32" 0 0 0
62  
63 0 ▶ my $cc = lc($Config{cc} || '');
Condition0%0/2
$Alien::Build::Auto::X0::Alienfile::Config{'cc'} || ''
l!l
00
MC/DC0%0/1
$Alien::Build::Auto::X0::Alienfile::Config{'cc'} || ''
$Alien::Build::Auto::X0::Alienfile::Config{'cc'}
Truth table0%0/2
A
A= $Alien::Build::Auto::X0::Alienfile::Config{'cc'}
Aresult
11
00
64 0 ▶ return () if $cc !~ /(?:gcc|mingw)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $cc =~ /(?:gcc|mingw)/ 0 0 0
65  
66 0 my @args = ('-G', 'MinGW Makefiles');
67 0 ▶ my $make = can_run($Config{make} || '')
Condition0%0/8
can_run($Alien::Build::Auto::X0::Alienfile::Config{'make'} || '') || can_run('mingw32-make') || can_run('gmake')
l!l&&r!l&&!r
000
can_run($Alien::Build::Auto::X0::Alienfile::Config{"make"} || "") or can_run("mingw32-make")
l!l&&r!l&&!r
000
$Alien::Build::Auto::X0::Alienfile::Config{'make'} || ''
l!l
00
MC/DC0%0/3
can_run($Alien::Build::Auto::X0::Alienfile::Config{'make'} || '') || can_run('mingw32-make') || can_run('gmake')
can_run($Alien::Build::Auto::X0::Alienfile::Config{"make"} || "") can_run("mingw32-make") can_run('gmake')
MC/DC0%0/1
$Alien::Build::Auto::X0::Alienfile::Config{'make'} || ''
$Alien::Build::Auto::X0::Alienfile::Config{'make'}
Truth table0%0/4
A or B || C
A= can_run($Alien::Build::Auto::X0::Alienfile::Config{"make"} || "")B= can_run("mingw32-make")C= can_run('gmake')
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/2
A
A= $Alien::Build::Auto::X0::Alienfile::Config{'make'}
Aresult
11
00
68 || can_run('mingw32-make')
69 || can_run('gmake');
70  
71 0 ▶ if (defined($make) && length($make)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $make and length $make) 0 0 0
Condition0%0/3
defined $make and length $make
!ll&&!rl&&r
000
MC/DC0%0/2
defined $make and length $make
defined $make length $make
Truth table0%0/3
A and B
A= defined $makeB= length $make
ABresult
0X0
100
111
72 0 push @args,
73 '-DCMAKE_MAKE_PROGRAM=' . _cmake_path($make);
74 }
75  
76 0 return @args;
77 }
78  
79 1 ▶sub _windows_openssl_root {
Subroutine _windows_openssl_root: called CC=19 SCAR=58.4
80 1 ▶ return if $^O ne 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O ne "MSWin32" 1 0 1
81  
82 0 my @candidates;
83  
84 push @candidates, $ENV{OPENSSL_ROOT_DIR}
85 if defined($ENV{OPENSSL_ROOT_DIR})
86 0 ▶ && length($ENV{OPENSSL_ROOT_DIR});
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{"OPENSSL_ROOT_DIR"} and length $ENV{"OPENSSL_ROOT_DIR"} 0 0 0
Condition0%0/3
defined $ENV{"OPENSSL_ROOT_DIR"} and length $ENV{"OPENSSL_ROOT_DIR"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ENV{"OPENSSL_ROOT_DIR"} and length $ENV{"OPENSSL_ROOT_DIR"}
defined $ENV{"OPENSSL_ROOT_DIR"} length $ENV{"OPENSSL_ROOT_DIR"}
Truth table0%0/3
A and B
A= defined $ENV{"OPENSSL_ROOT_DIR"}B= length $ENV{"OPENSSL_ROOT_DIR"}
ABresult
0X0
100
111
87  
88 0 ▶ for my $libdir (split /\s+/, $Config{libpth} || '') {
Condition0%0/2
$Alien::Build::Auto::X0::Alienfile::Config{'libpth'} || ''
l!l
00
MC/DC0%0/1
$Alien::Build::Auto::X0::Alienfile::Config{'libpth'} || ''
$Alien::Build::Auto::X0::Alienfile::Config{'libpth'}
Truth table0%0/2
A
A= $Alien::Build::Auto::X0::Alienfile::Config{'libpth'}
Aresult
11
00
89 0 push @candidates,
90 File::Spec->catdir($libdir, File::Spec->updir);
91 }
92  
93 0 ▶ if (defined($Config{prefix}) && length($Config{prefix})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Alien::Build::Auto::X0::Alienfile::Config{"prefix"} and length $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}) 0 0 0
Condition0%0/3
defined $Alien::Build::Auto::X0::Alienfile::Config{"prefix"} and length $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Alien::Build::Auto::X0::Alienfile::Config{"prefix"} and length $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}
defined $Alien::Build::Auto::X0::Alienfile::Config{"prefix"} length $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}
Truth table0%0/3
A and B
A= defined $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}B= length $Alien::Build::Auto::X0::Alienfile::Config{"prefix"}
ABresult
0X0
100
111
94 push @candidates,
95 File::Spec->catdir(
96 $Config{prefix},
97 0 File::Spec->updir,
98 'c',
99 );
100 }
101  
102 0 ▶ my $path_sep = $Config{path_sep} || ';';
Condition0%0/2
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'} || ';'
l!l
00
MC/DC0%0/1
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'} || ';'
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'}
Truth table0%0/2
A
A= $Alien::Build::Auto::X0::Alienfile::Config{'path_sep'}
Aresult
11
00
103 0 ▶ for my $entry (split /\Q$path_sep\E/, $ENV{PATH} || '') {
Condition0%0/2
$ENV{'PATH'} || ''
l!l
00
MC/DC0%0/1
$ENV{'PATH'} || ''
$ENV{'PATH'}
Truth table0%0/2
A
A= $ENV{'PATH'}
Aresult
11
00
104 0 ▶ next if !length $entry;
Branch: 1 branch
BranchTrueFalseTotal
unless length $entry 0 0 0
105  
106 0 my ($volume, $dirs, $file)
107 = File::Spec->splitpath($entry, 1);
108 0 my $name = $dirs;
109 0 $name =~ s{[\\/]+\z}{};
110 0 $name =~ s{.*[\\/]}{};
111  
112 0 ▶ next if lc($name) ne 'bin';
Branch: 1 branch
BranchTrueFalseTotal
if lc $name ne "bin" 0 0 0
113  
114 0 push @candidates,
115 File::Spec->catdir($entry, File::Spec->updir);
116 }
117  
118 0 my %seen;
119  
120 0 for my $candidate (@candidates) {
121 0 ▶ next if !defined($candidate) || !length($candidate);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $candidate and length $candidate 0 0 0
Condition0%0/3
defined $candidate and length $candidate
!ll&&!rl&&r
000
MC/DC0%0/2
defined $candidate and length $candidate
defined $candidate length $candidate
Truth table0%0/3
A and B
A= defined $candidateB= length $candidate
ABresult
0X0
100
111
122  
123 0 my $root = abs_path($candidate);
124 0 ▶ next if !defined $root || $seen{$root}++;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $root or $seen{$root}++ 0 0 0
Condition0%0/3
not defined $root or $seen{$root}++
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $root or $seen{$root}++
not defined $root $seen{$root}++
Truth table0%0/3
not(A) or B
A= not defined $rootB= $seen{$root}++
ABresult
1X1
011
000
125  
126 0 my $header = File::Spec->catfile(
127 $root,
128 'include',
129 'openssl',
130 'ssl.h',
131 );
132  
133 0 ▶ return $root if -f $header;
Branch: 1 branch
BranchTrueFalseTotal
if -f $header 0 0 0
134 }
135  
136 0 return;
137 }
138  
139 1 ▶sub _windows_openssl_version {
Subroutine _windows_openssl_version: called CC=6 SCAR=32.0
140 1 my ($root) = @_;
141  
142 1 ▶ return if !defined($root) || !length($root);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $root and length $root 1 0 1
Condition33%1/3
defined $root and length $root
!ll&&!rl&&r
100
MC/DC0%0/2
defined $root and length $root
defined $root length $root
Truth table33%1/3
A and B
A= defined $rootB= length $root
ABresult
0X0
100
111
143  
144 0 my $exe = File::Spec->catfile(
145 $root,
146 'bin',
147 'openssl.exe',
148 );
149 0 ▶ return if !-f $exe;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $exe 0 0 0
150  
151 0 my $stdout = '';
152 0 my $ok = run(
153 command => [$exe, 'version'],
154 buffer => \$stdout,
155 verbose => 0,
156 );
157  
158 0 ▶ return if !$ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
159  
160 0 ▶ return $1
Branch: 1 branch
BranchTrueFalseTotal
if $stdout =~ /OpenSSL\s+(\d+\.\d+\.\d+[a-z]*)/i 0 0 0
161 if $stdout =~ /OpenSSL\s+(\d+\.\d+\.\d+[a-z]*)/i;
162  
163 0 return;
164 }
165  
166 1 ▶sub _windows_openssl_supported {
Subroutine _windows_openssl_supported: called CC=8 SCAR=39.1
167 1 my ($version) = @_;
168  
169 1 ▶ return 0 if !defined($version);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $version 1 0 1
170 0 ▶ return 0 if $version !~ /\A(\d+)\.(\d+)\.(\d+)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $version =~ /\A(\d+)\.(\d+)\.(\d+)/ 0 0 0
171  
172 0 my ($major, $minor, $patch) = ($1, $2, $3);
173  
174 0 ▶ return 1 if $major > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $major > 1 0 0 0
175 0 ▶ return 0 if $major < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $major < 1 0 0 0
176  
177 0 ▶ return 1 if $minor > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $minor > 1 0 0 0
178 0 ▶ return 0 if $minor < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $minor < 1 0 0 0
179  
180 0 ▶ return $patch >= 1 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$patch >= 1 ? : 0 0 0
181 }
182  
183 1 my $pkg_config = _pkg_config_command();
184 1 my $system_openssl_available
185 = _pkg_config_has($pkg_config, 'openssl', '1.1.1');
186 1 my $windows_openssl_root = _windows_openssl_root();
187 1 my $windows_openssl_version
188 = _windows_openssl_version($windows_openssl_root);
189 1 my $windows_openssl_supported
190 = _windows_openssl_supported($windows_openssl_version);
191  
192 1 ▶if ($^O eq 'MSWin32' && !$windows_openssl_supported) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32" and not $windows_openssl_supported) 0 1 1
Condition33%1/3
$^O eq "MSWin32" and not $windows_openssl_supported
!ll&&!rl&&r
100
MC/DC0%0/2
$^O eq "MSWin32" and not $windows_openssl_supported
$^O eq "MSWin32" not $windows_openssl_supported
Truth table33%1/3
A and not(B)
A= $^O eq "MSWin32"B= not $windows_openssl_supported
ABresult
0X0
100
111
193 0 ▶ my $found = defined($windows_openssl_version)
Branch: 1 branch
BranchTrueFalseTotal
defined $windows_openssl_version ? : 0 0 0
194 ? "OpenSSL $windows_openssl_version"
195 : 'no usable OpenSSL development installation';
196  
197 0 die "Alien::ngtcp2 requires OpenSSL 1.1.1 or newer on Windows; "
198 . "found $found. Upgrade the Windows/Strawberry toolchain. "
199 . "Alien::ngtcp2 will not silently install a second TLS stack.\n";
200 }
201  
202 1 meta_prop->{my_crypto_backend} = $crypto_backend;
203 1 meta_prop->{my_crypto_package} = $crypto_package;
204 meta_prop->{my_picotls_source}
205 1 = File::Spec->rel2abs('vendor/picotls');
206 meta_prop->{my_windows_openssl_root}
207 1 = $windows_openssl_root;
208 meta_prop->{my_system_openssl_available}
209 1 ▶ = $system_openssl_available ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$system_openssl_available ? : 0 1 1
210  
211 1 plugin 'PkgConfig' => (
212 pkg_name => [
213 'libngtcp2',
214 $crypto_package,
215 ],
216 atleast_version => $minimum_version,
217 );
218  
219 # Keep the ngtcp2/Picotls pair deterministic. A system crypto helper does not
220 # report which Picotls revision it was built against, so always build the
221 # tested pair bundled by this distribution.
222 0 ▶probe sub { 'share' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
223  
224 1 ▶share {
Subroutine __ANON__: called CC=3 SCAR=22.7
225 1 requires 'Alien::cmake3' => '0.10';
226  
227 1 ▶ if ($^O ne 'MSWin32' && !$system_openssl_available) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O ne "MSWin32" and not $system_openssl_available) 1 0 1
Condition33%1/3
$^O ne "MSWin32" and not $system_openssl_available
!ll&&!rl&&r
001
MC/DC0%0/2
$^O ne "MSWin32" and not $system_openssl_available
$^O ne "MSWin32" not $system_openssl_available
Truth table33%1/3
A and not(B)
A= $^O ne "MSWin32"B= not $system_openssl_available
ABresult
0X0
100
111
228 1 requires 'Alien::OpenSSL' => '0.15';
229 }
230  
231 1 start_url 'https://github.com/ngtcp2/ngtcp2/releases/download/v1.25.0/ngtcp2-1.25.0.tar.gz';
232  
233 1 plugin 'Digest' => [
234 SHA256 => '1c0843076528a87b65e9a9d455100941f4cb65d44f96c5da6ae56df146043955',
235 ];
236 1 plugin 'Download';
237 1 plugin 'Extract' => 'tar.gz';
238  
239 0 ▶ build sub {
Subroutine __ANON__: not called CC=15 SCAR=54.8
240 0 my ($build) = @_;
241  
242 0 require Alien::cmake3;
243  
244 0 my $prefix = $build->install_prop->{prefix};
245 0 my $cmake = Alien::cmake3->exe;
246 0 ▶ my $path_sep = $Config{path_sep} || ':';
Condition0%0/2
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'} || ':'
l!l
00
MC/DC0%0/1
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'} || ':'
$Alien::Build::Auto::X0::Alienfile::Config{'path_sep'}
Truth table0%0/2
A
A= $Alien::Build::Auto::X0::Alienfile::Config{'path_sep'}
Aresult
11
00
247  
248 local $ENV{PATH} = join(
249 $path_sep,
250 Alien::cmake3->bin_dir,
251 0 ▶ $ENV{PATH} || (),
Condition0%0/3
$ENV{'PATH'} || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{'PATH'} || ()
$ENV{'PATH'} ()
Truth table0%0/3
A || B
A= $ENV{'PATH'}B= ()
ABresult
1X1
011
000
252 );
253  
254 0 my @generator_args = _cmake_generator_args();
255  
256 my $picotls_source
257 0 = $build->meta_prop->{my_picotls_source};
258 0 my $picotls_build = File::Spec->catdir(
259 File::Spec->curdir,
260 '.alien-picotls-build',
261 );
262  
263 0 my (@openssl_root, $openssl_cflags, $openssl_libs);
264  
265 0 ▶ if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 0 0
266 my $root
267 0 = $build->meta_prop->{my_windows_openssl_root};
268  
269 0 ▶ die "No usable Windows OpenSSL development tree was found\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $root and length $root 0 0 0
Condition0%0/3
defined $root and length $root
!ll&&!rl&&r
000
MC/DC0%0/2
defined $root and length $root
defined $root length $root
Truth table0%0/3
A and B
A= defined $rootB= length $root
ABresult
0X0
100
111
270 if !defined($root) || !length($root);
271  
272 0 my $include = _cmake_path(
273 File::Spec->catdir(
274 $root,
275 'include',
276 )
277 );
278 0 my $lib = _cmake_path(
279 File::Spec->catdir(
280 $root,
281 'lib',
282 )
283 );
284 0 $root = _cmake_path($root);
285  
286 0 push @openssl_root,
287 "-DOPENSSL_ROOT_DIR=$root";
288  
289 0 $openssl_cflags = qq{-I"$include"};
290 0 $openssl_libs = join ' ',
291 qq{-L"$lib"},
292 qw(
293 -lssl
294 -lcrypto
295 -lws2_32
296 -lgdi32
297 -ladvapi32
298 -lcrypt32
299 -luser32
300 -lz
301 );
302 }
303 else {
304 0 ▶ if ($build->meta_prop->{my_system_openssl_available}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($build->meta_prop->{'my_system_openssl_available'}) { } 0 0 0
305 0 my $command = _pkg_config_command();
306  
307 0 ▶ $openssl_cflags = _pkg_config_output(
Condition0%0/2
_pkg_config_output($command, '--cflags', 'openssl') || ''
l!l
00
MC/DC0%0/1
_pkg_config_output($command, '--cflags', 'openssl') || ''
_pkg_config_output($command, '--cflags', 'openssl')
Truth table0%0/2
A
A= _pkg_config_output($command, '--cflags', 'openssl')
Aresult
11
00
308 $command,
309 '--cflags',
310 'openssl',
311 ) || '';
312 0 ▶ $openssl_libs = _pkg_config_output(
Condition0%0/2
_pkg_config_output($command, '--libs', 'openssl') || ''
l!l
00
MC/DC0%0/1
_pkg_config_output($command, '--libs', 'openssl') || ''
_pkg_config_output($command, '--libs', 'openssl')
Truth table0%0/2
A
A= _pkg_config_output($command, '--libs', 'openssl')
Aresult
11
00
313 $command,
314 '--libs',
315 'openssl',
316 ) || '';
317  
318 0 my $openssl_prefix = _pkg_config_output(
319 $command,
320 '--variable=prefix',
321 'openssl',
322 );
323  
324 0 ▶ push @openssl_root,
Branch: 1 branch
BranchTrueFalseTotal
if defined $openssl_prefix and length $openssl_prefix 0 0 0
Condition0%0/3
defined $openssl_prefix and length $openssl_prefix
!ll&&!rl&&r
000
MC/DC0%0/2
defined $openssl_prefix and length $openssl_prefix
defined $openssl_prefix length $openssl_prefix
Truth table0%0/3
A and B
A= defined $openssl_prefixB= length $openssl_prefix
ABresult
0X0
100
111
325 "-DOPENSSL_ROOT_DIR=$openssl_prefix"
326 if defined($openssl_prefix)
327 && length($openssl_prefix);
328 }
329 else {
330 0 require Alien::OpenSSL;
331  
332 0 ▶ if (Alien::OpenSSL->install_type eq 'share') {
Branch: 1 branch
BranchTrueFalseTotal
if ("Alien::OpenSSL"->install_type eq "share") 0 0 0
333 0 push @openssl_root,
334 '-DOPENSSL_ROOT_DIR='
335 . Alien::OpenSSL->dist_dir;
336 }
337  
338 0 $openssl_cflags = Alien::OpenSSL->cflags;
339 0 $openssl_libs = Alien::OpenSSL->libs;
340 }
341 }
342  
343 0 $build->system(
344 $cmake,
345 '-S', $picotls_source,
346 '-B', $picotls_build,
347 @generator_args,
348 "-DCMAKE_INSTALL_PREFIX=$prefix",
349 '-DCMAKE_BUILD_TYPE=Release',
350 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
351 @openssl_root,
352 );
353 0 $build->system(
354 $cmake,
355 '--build', $picotls_build,
356 '--config', 'Release',
357 );
358 0 $build->system(
359 $cmake,
360 '--build', $picotls_build,
361 '--target', 'install',
362 '--config', 'Release',
363 );
364  
365 0 my @picotls_openssl_candidates = (
366 File::Spec->catfile(
367 $prefix, 'lib', 'libpicotls-openssl.a',
368 ),
369 File::Spec->catfile(
370 $prefix, 'lib', 'picotls-openssl.lib',
371 ),
372 );
373 0 my @picotls_core_candidates = (
374 File::Spec->catfile(
375 $prefix, 'lib', 'libpicotls-core.a',
376 ),
377 File::Spec->catfile(
378 $prefix, 'lib', 'picotls-core.lib',
379 ),
380 );
381  
382 my ($picotls_openssl)
383 0 = grep { -f $_ } @picotls_openssl_candidates;
384 my ($picotls_core)
385 0 = grep { -f $_ } @picotls_core_candidates;
386  
387 0 ▶ die "Picotls OpenSSL static library was not installed\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $picotls_openssl 0 0 0
388 if !defined $picotls_openssl;
389 0 ▶ die "Picotls core static library was not installed\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $picotls_core 0 0 0
390 if !defined $picotls_core;
391  
392 0 my $picotls_include = _cmake_path(
393 File::Spec->catdir(
394 $prefix,
395 'include',
396 )
397 );
398 0 my $picotls_openssl_cmake
399 = _cmake_path($picotls_openssl);
400 0 my $picotls_core_cmake
401 = _cmake_path($picotls_core);
402 0 my @picotls_link_extra;
403 0 ▶ if ($^O eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 0 0
404 0 @picotls_link_extra = qw(
405 ws2_32
406 gdi32
407 advapi32
408 crypt32
409 user32
410 z
411 );
412 }
413  
414 0 my $picotls_libraries = join ';',
415 $picotls_openssl_cmake,
416 $picotls_core_cmake,
417 @picotls_link_extra;
418  
419 $build->runtime_prop->{my_picotls_libs}
420 0 = join ' ',
421 _cmake_path($picotls_openssl),
422 _cmake_path($picotls_core);
423 $build->runtime_prop->{my_openssl_cflags}
424 0 = $openssl_cflags;
425 $build->runtime_prop->{my_openssl_libs}
426 0 = $openssl_libs;
427  
428 0 my $ngtcp2_build = File::Spec->catdir(
429 File::Spec->curdir,
430 '.alien-ngtcp2-build',
431 );
432  
433 0 $build->system(
434 $cmake,
435 '-S', File::Spec->curdir,
436 '-B', $ngtcp2_build,
437 @generator_args,
438 "-DCMAKE_INSTALL_PREFIX=$prefix",
439 '-DCMAKE_BUILD_TYPE=Release',
440 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
441 '-DENABLE_LIB_ONLY=ON',
442 '-DENABLE_SHARED_LIB=OFF',
443 '-DENABLE_STATIC_LIB=ON',
444 '-DENABLE_OPENSSL=OFF',
445 '-DENABLE_GNUTLS=OFF',
446 '-DENABLE_BORINGSSL=OFF',
447 '-DENABLE_PICOTLS=ON',
448 '-DENABLE_WOLFSSL=OFF',
449 '-DBUILD_TESTING=OFF',
450 "-DPICOTLS_INCLUDE_DIR=$picotls_include",
451 "-DPICOTLS_LIBRARIES=$picotls_libraries",
452 @openssl_root,
453 );
454 0 $build->system(
455 $cmake,
456 '--build', $ngtcp2_build,
457 '--config', 'Release',
458 );
459 0 $build->system(
460 $cmake,
461 '--build', $ngtcp2_build,
462 '--target', 'install',
463 '--config', 'Release',
464 );
465  
466 0 return 1;
467 1 };
468  
469 0 ▶ after 'gather' => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
470 0 my ($build) = @_;
471  
472 my $compiler_type
473 0 ▶ = $build->meta_prop->{platform}->{compiler_type} || '';
Condition0%0/2
$build->meta_prop->{'platform'}{'compiler_type'} || ''
l!l
00
MC/DC0%0/1
$build->meta_prop->{'platform'}{'compiler_type'} || ''
$build->meta_prop->{'platform'}{'compiler_type'}
Truth table0%0/2
A
A= $build->meta_prop->{'platform'}{'compiler_type'}
Aresult
11
00
474 0 ▶ my $define = $compiler_type eq 'microsoft'
Branch: 1 branch
BranchTrueFalseTotal
$compiler_type eq 'microsoft' ? : 0 0 0
475 ? '/DNGTCP2_STATICLIB'
476 : '-DNGTCP2_STATICLIB';
477  
478 0 for my $key (qw(cflags cflags_static)) {
479 0 ▶ my $value = $build->runtime_prop->{$key} || '';
Condition0%0/2
$build->runtime_prop->{$key} || ''
l!l
00
MC/DC0%0/1
$build->runtime_prop->{$key} || ''
$build->runtime_prop->{$key}
Truth table0%0/2
A
A= $build->runtime_prop->{$key}
Aresult
11
00
480 $build->runtime_prop->{$key}
481 0 = join ' ', grep { length } $value, $define;
482 }
483 1 };
484 1 };
485  
486 0 ▶after 'gather' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
487 0 my ($build) = @_;
488  
489 $build->runtime_prop->{my_crypto_backend}
490 0 = $crypto_backend;
491 $build->runtime_prop->{my_crypto_package}
492 0 = $crypto_package;
493 1 };
↑ Summary blib/lib/Alien/ngtcp2/Install/Files.pm »