alienfile

filter: Statementstmt 35.2% 12 / 34 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 31.2% 15 / 48 CC 9 SCAR 42.2
CC
9
Cov
27%
__ANON__
90.0
__ANON__
1.7
BEGIN
1.0
CRAP 67.8
↑ Summary blib/lib/Alien/pugixml/Install/Files.pm »
1 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 # Use a system pugixml when one is installed and recent enough; otherwise build
5 # from source. 1.8 is the floor XML::PugiXML needs (it references the output
6 # flag format_no_empty_element_tags, added in pugixml 1.8). Older or missing
7 # system libraries fall through to the source build below, which installs the
8 # current release.
9 1 plugin 'PkgConfig' => (
10 pkg_name => 'pugixml',
11 atleast_version => '1.8',
12 );
13  
14 1 ▶share {
Subroutine __ANON__: called CC=1 SCAR=5.3
15 1 requires 'ExtUtils::CBuilder' => '0.280226';
16  
17 1 plugin 'Download' => (
18 url => 'https://github.com/zeux/pugixml/releases/download/v1.16/pugixml-1.16.tar.gz',
19 version => qr/pugixml-([0-9.]+)\.tar\.gz$/,
20 );
21  
22 1 plugin 'Extract' => 'tar.gz';
23  
24 0 ▶ build sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
25 0 my ($build) = @_;
26 0 require ExtUtils::CBuilder;
27 0 require Path::Tiny;
28  
29 # The -std pugixml.cpp is compiled with decides which overloads the library
30 # has (C++11 move, C++17 string_view), so take the newest that works.
31 0 my $cb = ExtUtils::CBuilder->new;
32 0 my $obj;
33 0 for my $std ('-std=c++17', '-std=c++11', '') {
34 0 ▶ $obj = eval {
Branch: 1 branch
BranchTrueFalseTotal
$obj = eval { do { $cb->compile("C++", 1, "source", "src/pugixml.cpp", "extra_compiler_flags", $std) } } and last 0 0 0
35 0 $cb->compile(
36 'C++' => 1,
37 source => 'src/pugixml.cpp',
38 extra_compiler_flags => $std,
39 );
40 } and last;
41 }
42 0 ▶ die "failed to compile src/pugixml.cpp\n" unless $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless $obj 0 0 0
43  
44 0 my $lib = "libpugixml$Config{_a}";
45 0 ▶ $build->system((split ' ', $Config{ar}), 'crs', $lib, $obj) == 0
Branch: 1 branch
BranchTrueFalseTotal
$build->system(split(' ', $Alien::Build::Auto::X0::Alienfile::Config{"ar"}, 0), "crs", $lib, $obj) == 0 or die "failed to create $lib\n" 0 0 0
46 or die "failed to create $lib\n";
47  
48 0 ▶ my ($v) = Path::Tiny->new('src/pugixml.hpp')->slurp
Branch: 1 branch
BranchTrueFalseTotal
my($v) = "Path::Tiny"->new("src/pugixml.hpp")->slurp =~ /^\s*#\s*define\s+PUGIXML_VERSION\s+(\d+)/m or die "PUGIXML_VERSION not found in src/pugixml.hpp\n" 0 0 0
49 =~ /^\s*#\s*define\s+PUGIXML_VERSION\s+(\d+)/m
50 or die "PUGIXML_VERSION not found in src/pugixml.hpp\n";
51 0 my $version = sprintf '%d.%d', $v / 1000, $v % 1000 / 10;
52 0 ▶ $version .= '.' . $v % 10 if $v % 10;
Branch: 1 branch
BranchTrueFalseTotal
if $v % 10 0 0 0
53  
54 0 my $stage = Path::Tiny->new($build->install_prop->{prefix});
55 0 my $include = $stage->child('include');
56 0 my $libdir = $stage->child('lib');
57 0 $_->mkpath for $include, $libdir->child('pkgconfig');
58 Path::Tiny->new("src/$_")->copy($include->child($_))
59 0 for qw( pugixml.hpp pugiconfig.hpp );
60 0 Path::Tiny->new($lib)->copy($libdir->child($lib));
61  
62 0 my $prefix = $build->runtime_prop->{prefix};
63 0 $libdir->child('pkgconfig', 'pugixml.pc')->spew(<<"PC");
64 prefix=$prefix
65 includedir=\${prefix}/include
66 libdir=\${prefix}/lib
67  
68 Name: pugixml
69 Description: Light-weight, simple and fast XML parser for C++ with XPath support.
70 URL: https://pugixml.org/
71 Version: $version
72 Cflags: -I\${includedir}
73 Libs: -L\${libdir} -lpugixml
74 PC
75 1 };
76 1 };
↑ Summary blib/lib/Alien/pugixml/Install/Files.pm »