line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::PkgConfig::Negotiate; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
190288
|
use strict; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
177
|
|
4
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
207
|
|
5
|
6
|
|
|
6
|
|
124
|
use 5.008004; |
|
6
|
|
|
|
|
22
|
|
6
|
6
|
|
|
6
|
|
758
|
use Alien::Build::Plugin; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
41
|
|
7
|
6
|
|
|
6
|
|
2044
|
use Alien::Build::Plugin::PkgConfig::PP; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
93
|
|
8
|
6
|
|
|
6
|
|
1809
|
use Alien::Build::Plugin::PkgConfig::LibPkgConf; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
44
|
|
9
|
6
|
|
|
6
|
|
1823
|
use Alien::Build::Plugin::PkgConfig::CommandLine; |
|
6
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
39
|
|
10
|
6
|
|
|
6
|
|
391
|
use Alien::Build::Util qw( _perl_config ); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
311
|
|
11
|
6
|
|
|
6
|
|
35
|
use Carp (); |
|
6
|
|
|
|
|
25
|
|
|
6
|
|
|
|
|
2554
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Package configuration negotiation plugin |
14
|
|
|
|
|
|
|
our $VERSION = '2.45'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has '+pkg_name' => sub { |
18
|
|
|
|
|
|
|
Carp::croak "pkg_name is a required property"; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has atleast_version => undef; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has exact_version => undef; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has max_version => undef; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has minimum_version => undef; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub pick |
35
|
|
|
|
|
|
|
{ |
36
|
28
|
|
|
28
|
1
|
40753
|
my($class) = @_; |
37
|
|
|
|
|
|
|
|
38
|
28
|
100
|
|
|
|
89
|
return $ENV{ALIEN_BUILD_PKG_CONFIG} if $ENV{ALIEN_BUILD_PKG_CONFIG}; |
39
|
|
|
|
|
|
|
|
40
|
21
|
100
|
|
|
|
106
|
if(Alien::Build::Plugin::PkgConfig::LibPkgConf->available) |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
|
|
11
|
return 'PkgConfig::LibPkgConf'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
20
|
100
|
|
|
|
553
|
if(Alien::Build::Plugin::PkgConfig::CommandLine->available) |
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
|
|
66
|
|
|
3671
|
my $is_solaris64 = (_perl_config('osname') eq 'solaris' && _perl_config('ptrsize') == 8); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# PkgConfig.pm is more reliable on windows |
54
|
5
|
|
|
|
|
44
|
my $is_windows = _perl_config('osname') eq 'MSWin32'; |
55
|
|
|
|
|
|
|
|
56
|
5
|
100
|
100
|
|
|
35
|
if(!$is_solaris64 && !$is_windows) |
57
|
|
|
|
|
|
|
{ |
58
|
3
|
|
|
|
|
21
|
return 'PkgConfig::CommandLine'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
17
|
50
|
|
|
|
6626
|
if(Alien::Build::Plugin::PkgConfig::PP->available) |
63
|
|
|
|
|
|
|
{ |
64
|
17
|
|
|
|
|
157
|
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
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
79
|
16
|
|
|
16
|
1
|
49
|
my($self, $meta) = @_; |
80
|
|
|
|
|
|
|
|
81
|
16
|
|
|
|
|
41
|
my $plugin = $self->pick; |
82
|
16
|
|
|
|
|
114
|
Alien::Build->log("Using PkgConfig plugin: $plugin"); |
83
|
|
|
|
|
|
|
|
84
|
16
|
100
|
|
|
|
1704
|
if(ref($self->pkg_name) eq 'ARRAY') |
85
|
|
|
|
|
|
|
{ |
86
|
1
|
|
|
|
|
5
|
$meta->add_requires('configure', 'Alien::Build::Plugin::PkgConfig::Negotiate' => '0.79'); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
16
|
100
|
100
|
|
|
44
|
if($self->atleast_version || $self->exact_version || $self->max_version) |
|
|
|
100
|
|
|
|
|
90
|
|
|
|
|
|
|
{ |
91
|
3
|
|
|
|
|
11
|
$meta->add_requires('configure', 'Alien::Build::Plugin::PkgConfig::Negotiate' => '1.53'); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
16
|
|
|
|
|
64
|
my @args; |
95
|
16
|
|
|
|
|
39
|
push @args, pkg_name => $self->pkg_name; |
96
|
16
|
|
|
|
|
35
|
push @args, register_prereqs => 0; |
97
|
|
|
|
|
|
|
|
98
|
16
|
|
|
|
|
33
|
foreach my $method (map { "${_}_version" } qw( minimum atleast exact max )) |
|
64
|
|
|
|
|
142
|
|
99
|
|
|
|
|
|
|
{ |
100
|
64
|
100
|
|
|
|
145
|
push @args, $method => $self->$method if defined $self->$method; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
16
|
|
|
|
|
110
|
$meta->apply_plugin($plugin, @args); |
104
|
|
|
|
|
|
|
|
105
|
16
|
|
|
|
|
72
|
$self; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |