blib/lib/Alien/Build/Plugin/Build/MSYS.pm

filter: Statementstmt 69.2% 27 / 39 Branchbran 40.0% 4 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 100% 1 / 1 totaltotal 66.6% 40 / 60 CC 7 SCAR 16.1
CC
7
Cov
63%
init
10.9
_win_and_needs_msys
5.2
__ANON__
2.0
CRAP 5.0
« blib/lib/Alien/Build/Plugin/Core/Gather.pm ↑ Summary blib/lib/Alien/Build/Plugin/PkgConfig/Negotiate.pm »
1 package Alien::Build::Plugin::Build::MSYS;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Alien::Build::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use File::Which ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Env qw( @PATH );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: MSYS plugin for Alien::Build
11 4 our $VERSION = '2.88'; # VERSION
12  
13  
14 4 has msys_version => '0.07';
15  
16 sub init
17 9 ▶{
Subroutine init: called CC=5 SCAR=23.9
Pod documented
18 9 my($self, $meta) = @_;
19  
20 9 ▶ if($self->msys_version ne '0.07')
Branch: 1 branch
BranchTrueFalseTotal
if ($self->msys_version ne "0.07") 0 9 9
21 {
22 0 $meta->add_requires('configure' => 'Alien::Build::Plugin::Build::MSYS' => '0.84');
23 }
24  
25 9 ▶ if(_win_and_needs_msys($meta))
Branch: 1 branch
BranchTrueFalseTotal
if (_win_and_needs_msys($meta)) 0 9 9
26 {
27 0 $meta->add_requires('share' => 'Alien::MSYS' => $self->msys_version);
28  
29 $meta->around_hook(
30 0 ▶ $_ => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 0 my $orig = shift;
32 0 my $build = shift;
33  
34 0 local $ENV{PATH} = $ENV{PATH};
35 0 unshift @PATH, Alien::MSYS::msys_path();
36  
37 0 $orig->($build, @_);
38 },
39 0 ) for qw( build build_ffi test_share test_ffi );
40 }
41  
42  
43 9 ▶ if($^O eq 'MSWin32')
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 9 9
44 {
45 # Most likely if we are trying to build something unix-y and
46 # we are using MSYS, then we want to use the make that comes
47 # with MSYS.
48 $meta->interpolator->replace_helper(
49 0 ▶ make => sub { 'make' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
50 0 );
51  
52 }
53  
54 9 $self;
55 }
56  
57 sub _win_and_needs_msys
58 9 ▶{
Subroutine _win_and_needs_msys: called CC=3 SCAR=16.5
59 9 my($meta) = @_;
60 # check to see if we are running on windows.
61 # if we are running on windows, check to see if
62 # it is MSYS2, then we can just use that. Otherwise
63 # we are probably on Strawberry, or (less likely)
64 # VC Perl, in which case we will still need Alien::MSYS
65 9 ▶ return 0 unless $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
unless $^O eq "MSWin32" 9 0 9
66 0 ▶ return 0 if $meta->prop->{platform}->{system_type} eq 'windows-mingw';
Branch: 1 branch
BranchTrueFalseTotal
if $meta->prop->{"platform"}{"system_type"} eq "windows-mingw" 0 0 0
67 0 return 1;
68 }
69  
70 4 1;
71  
72 __END__
« blib/lib/Alien/Build/Plugin/Core/Gather.pm ↑ Summary blib/lib/Alien/Build/Plugin/PkgConfig/Negotiate.pm »