example/gmake.alienfile

filter: Statementstmt 70.8% 17 / 24 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 61.7% 21 / 34 CC 2 SCAR 9.2
CC
2
Cov
65%
__ANON__
6.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.5
« blib/lib/Alien/Build/Plugin/Core/Legacy.pm ↑ Summary blib/lib/Alien/Build/Plugin.pm »
1 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Capture::Tiny qw( capture );
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶configure {
Subroutine __ANON__: called CC=1 SCAR=0.0
5 # Because we use Capture::Tiny in
6 # the alienfile itself, we need to register it
7 # as a configure time require (that is it needs
8 # to be installed before we even attempt to load
9 # this alienfile).
10 1 requires 'Capture::Tiny';
11 1 };
12  
13 # probe for GNU Make by trying the usual names for
14 # it. Because 'make' could be some other make, we
15 # try running it with --version and see if it looks
16 # like the GNU version.
17 plugin 'Probe::CommandLine' => (
18 command => $_,
19 args => ['--version'],
20 match => qr/GNU Make/,
21 1 ) for qw( gmake make );
22  
23 1 ▶share {
Subroutine __ANON__: called CC=1 SCAR=0.2
24  
25 # items in the share block relate to building the package
26 # from source. It is called share because it will be
27 # installed into a dist level share directory in your
28 # perl lib.
29  
30 # The Download negotiator picks the best method for
31 # downloading the package. It uses the version
32 # regex to parse out the version number from the
33 # tarball so that it can pick the most recent
34 # version.
35 1 start_url 'http://ftp.gnu.org/gnu/make';
36 1 plugin 'Download' => (
37 version => qr/^make-([0-9\.]+)\.tar\.gz$/,
38 );
39  
40 # The Extract negotiator picks the best method for
41 # extracting from the tarball. We give it a hint
42 # here that we expect the tarball to be .gz compressed
43 # in case it needs to load extra modules to
44 # decompress.
45 1 plugin 'Extract' => 'tar.gz';
46  
47  
48 # The Autoconf plugin builds using the standard
49 # configure and make tools. It uses a DESTDIR
50 # ( https://www.gnu.org/prep/standards/html_node/DESTDIR.html )
51 # to ensure that the prefix during the build
52 # (ie when you install the Alien::xz module)
53 # matches the prefix during runtime
54 # (ie when you use it from XZ::XS).
55 1 plugin 'Build::Autoconf';
56  
57 # unlike the xz alienfile, we need to explicitly specify
58 # the commands used to build. For this package it is
59 # because we need to specify --program-prefix=g so that
60 # the gmake executable will be 'gmake' and will not conflict
61 # with the system provided 'make' which may not be compatible.
62 build [
63 '%{configure} --program-prefix=g --disable-shared',
64 '%{make}',
65 '%{make} install',
66 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
67 0 my($build) = @_;
68 0 $build->runtime_prop->{command} = 'gmake';
69 },
70 1 ];
71  
72 # This package doesn't build a dynamic library, but if
73 # it did this would make sure that it wasn't used with XS.
74 # (See Alien::Build::Manual::AlienAuthor for details).
75 1 plugin 'Gather::IsolateDynamic';
76  
77 1 };
78  
79 # For either a 'share' or 'system' install we try to get
80 # the version number from make --version output. But if
81 # for whatever reason we are not able to parse it out, it
82 # is more important to just have gmake, so we will set
83 # version to unknown.
84 0 ▶gather sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
85 0 my($build) = @_;
86 0 ▶ my($stdout) = capture {
Subroutine __ANON__: not called CC=1 SCAR=6.9
87 0 system($build->runtime_prop->{command}, '--version');
88 0 };
89 0 my($version) = $stdout =~ /GNU Make ([0-9\.]+)/;
90 0 ▶ $build->runtime_prop->{version} = $version || 'unknown';
Condition0%0/2
$version || 'unknown'
l!l
00
MC/DC0%0/1
$version || 'unknown'
$version
Truth table0%0/2
A
A= $version
Aresult
11
00
91 1 };
92  
« blib/lib/Alien/Build/Plugin/Core/Legacy.pm ↑ Summary blib/lib/Alien/Build/Plugin.pm »