« blib/lib/Alien/Build/Plugin/Build/MSYS.pm
↑ Summary
blib/lib/Alien/Build/Plugin/Extract/ArchiveTar.pm »
| 1 | package Alien::Build::Plugin::PkgConfig::Negotiate; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use 5.008004; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Alien::Build::Plugin; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Alien::Build::Plugin::PkgConfig::PP; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Alien::Build::Plugin::PkgConfig::LibPkgConf; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Alien::Build::Plugin::PkgConfig::CommandLine; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Alien::Build::Util qw( _perl_config ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # ABSTRACT: Package configuration negotiation plugin | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | has '+pkg_name' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | Carp::croak "pkg_name is a required property"; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | has atleast_version => undef; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | has exact_version => undef; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | has max_version => undef; | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | has minimum_version => undef; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | sub pick | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 27 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pick: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 27 | my($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 27 | ▶ | return $ENV{ALIEN_BUILD_PKG_CONFIG} if $ENV{ALIEN_BUILD_PKG_CONFIG}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 20 | ▶ | if(Alien::Build::Plugin::PkgConfig::LibPkgConf->available) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | return 'PkgConfig::LibPkgConf'; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 19 | ▶ | if(Alien::Build::Plugin::PkgConfig::CommandLine->available) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # TODO: determine environment or flags necessary for using pkg-config | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # on solaris 64 bit. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # Some advice on pkg-config and 64 bit Solaris | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # https://docs.oracle.com/cd/E53394_01/html/E61689/gplhi.html | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | ▶ | my $is_solaris64 = (_perl_config('osname') eq 'solaris' && _perl_config('ptrsize') == 8); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
_perl_config('osname') eq 'solaris' && _perl_config('ptrsize') == 8
MC/DC50%1/2
_perl_config('osname') eq 'solaris' && _perl_config('ptrsize') == 8
_perl_config('osname') eq 'solaris'
_perl_config('ptrsize') == 8
Truth table66%2/3
A && B
A= _perl_config('osname') eq 'solaris'B= _perl_config('ptrsize') == 8
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | # PkgConfig.pm is more reliable on windows | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 5 | my $is_windows = _perl_config('osname') eq 'MSWin32'; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 5 | ▶ | if(!$is_solaris64 && !$is_windows) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$is_solaris64 or $is_windows
MC/DC100%2/2
$is_solaris64 or $is_windows
$is_solaris64
$is_windows
Truth table100%3/3
A or B
A= $is_solaris64B= $is_windows
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | return 'PkgConfig::CommandLine'; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 16 | ▶ | if(Alien::Build::Plugin::PkgConfig::PP->available) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 16 | return 'PkgConfig::PP'; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | else | ||||||||||||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # this is a fata error. because we check for a pkg-config implementation | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # at configure time, we expect at least one of these to work. (and we | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # fallback on installing PkgConfig.pm as a prereq if nothing else is avail). | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # we therefore expect at least one of these to work, if not, then the configuration | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # of the system has shifted from underneath us. | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | Carp::croak("Could not find an appropriate pkg-config or pkgconf implementation, please install PkgConfig.pm, PkgConfig::LibPkgConf, pkg-config or pkgconf"); | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 16 | my($self, $meta) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 16 | my $plugin = $self->pick; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 16 | Alien::Build->log("Using PkgConfig plugin: $plugin"); | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 16 | ▶ | if(ref($self->pkg_name) eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | $meta->add_requires('configure', 'Alien::Build::Plugin::PkgConfig::Negotiate' => '0.79'); | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | ▶ | if($self->atleast_version || $self->exact_version || $self->max_version) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->atleast_version or $self->exact_version or $self->max_version
$self->atleast_version or $self->exact_version
MC/DC100%3/3
$self->atleast_version or $self->exact_version or $self->max_version
$self->atleast_version
$self->exact_version
$self->max_version
Truth table100%4/4
A or B or C
A= $self->atleast_versionB= $self->exact_versionC= $self->max_version
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | $meta->add_requires('configure', 'Alien::Build::Plugin::PkgConfig::Negotiate' => '1.53'); | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 16 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 16 | push @args, pkg_name => $self->pkg_name; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 16 | push @args, register_prereqs => 0; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 16 | foreach my $method (map { "${_}_version" } qw( minimum atleast exact max )) | |||||||||||||||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 64 | ▶ | push @args, $method => $self->$method if defined $self->$method; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 16 | $meta->apply_plugin($plugin, @args); | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 16 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | __END__ | ||||||||||||||||||||||||||||||||||||||||||