example/openssl.alienfile

filter: Statementstmt 47.8% 11 / 23 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 45.1% 14 / 31 CC 4 SCAR 20.7
CC
4
Cov
41%
__ANON__
9.7
BEGIN
1.0
CRAP 7.9
« blib/lib/Alien/Build/Plugin/Build/CMake.pm ↑ Summary blib/lib/Alien/Base.pm »
1 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 plugin 'PkgConfig' => (
4 pkg_name => 'openssl',
5 );
6  
7 1 ▶share {
Subroutine __ANON__: called CC=4 SCAR=22.7
8  
9 # when building OpenSSL from source we have a few challenges.
10 # - AB uses Net::SSLeay (via HTTP::Tiny) by default when downloading https URLs
11 # - Net::SSLeay requires OpenSSL
12 # - We can download OpenSSL from FTP, but that is susceptible to man-in-the-middle attacks
13 # (and that is a bad look for a security product)
14  
15 # Solution:
16 # - try downloading with curl or wget via the 'bootstrap_ssl' option.
17 # - if that doesn't work, fallback on FTP
18 # - don't attempt FTP transfer if ALIEN_OPENSSL_FTP is set to 0
19  
20 1 start_url 'https://www.openssl.org/source/';
21 1 plugin Download => (
22 version => qr/^openssl-([0-9\.]+[a-z]*)\.tar\.gz$/,
23 bootstrap_ssl => 1,
24 );
25  
26 1 ▶ unless(meta->has_hook('fetch'))
Branch: 1 branch
BranchTrueFalseTotal
unless (meta()->has_hook("fetch")) 0 1 1
27 {
28 0 my $ftp_ok = $ENV{ALIEN_OPENSSL_FTP};
29 0 ▶ $ftp_ok = 1 unless defined $ftp_ok;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ftp_ok 0 0 0
30 0 ▶ if($ftp_ok)
Branch: 1 branch
BranchTrueFalseTotal
if ($ftp_ok) { } 0 0 0
31 {
32 0 log(" ************************************************* ");
33 0 log(" * WARNING downloading OpenSSL via FTP * ");
34 0 log(" ************************************************* ");
35 0 start_url 'ftp://ftp.openssl.org/source/';
36 0 plugin 'Fetch::NetFTP';
37 0 plugin 'Decode::DirListing';
38 }
39 else
40 {
41 0 log("Unable to download OpenSSL via https without OpenSSL!");
42 0 log("Recommend installing wget or curl to bootstrap Alien::OpenSSL");
43 0 die "unable to download OpenSSL via https";
44 }
45 }
46  
47 1 plugin 'Extract' => 'tar.gz';
48  
49 1 build [
50 '%{perl} Configure --prefix=%{.install.prefix} no-shared cc',
51 '%{make}',
52 '%{make} install',
53 ];
54  
55 # This package doesn't build a dynamic library by default, but if
56 # it did this would make sure that it wasn't used with XS.
57 # (See Alien::Build::Manual::AlienAuthor for details).
58 1 plugin 'Gather::IsolateDynamic';
59  
60 1 };
« blib/lib/Alien/Build/Plugin/Build/CMake.pm ↑ Summary blib/lib/Alien/Base.pm »