| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::pkgconf; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
608123
|
use strict; |
|
|
3
|
|
|
|
|
21
|
|
|
|
3
|
|
|
|
|
74
|
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
58
|
|
|
5
|
3
|
|
|
3
|
|
1701
|
use JSON::PP (); |
|
|
3
|
|
|
|
|
34436
|
|
|
|
3
|
|
|
|
|
79
|
|
|
6
|
3
|
|
|
3
|
|
22
|
use File::Spec; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
56
|
|
|
7
|
3
|
|
|
3
|
|
1485
|
use File::ShareDir (); |
|
|
3
|
|
|
|
|
65344
|
|
|
|
3
|
|
|
|
|
1261
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Alien::pkgconf - Discover or download and install pkgconf + libpkgconf |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Alien::pkgconf; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $cflags = Alien::pkgconf->cflags; |
|
20
|
|
|
|
|
|
|
my $libs = Alien::pkgconf->libs; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This module provides you with the information that you need to invoke |
|
25
|
|
|
|
|
|
|
C or link against C. It isn't intended to be |
|
26
|
|
|
|
|
|
|
used directly, but rather to provide the necessary package by a CPAN |
|
27
|
|
|
|
|
|
|
module that needs C, such as L. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _dist_dir |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
6
|
|
|
6
|
|
6248
|
File::Spec->catdir(File::ShareDir::dist_dir('Alien-pkgconf'), @_); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _dist_file |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
2
|
|
|
2
|
|
11
|
File::Spec->catfile(File::ShareDir::dist_dir('Alien-pkgconf'), @_); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $config; |
|
42
|
|
|
|
|
|
|
sub _config |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
9
|
|
66
|
9
|
|
695
|
$config ||= do { |
|
45
|
2
|
|
|
|
|
9
|
my $filename = _dist_file('status.json'); |
|
46
|
2
|
|
|
|
|
236
|
my $fh; |
|
47
|
2
|
|
|
|
|
76
|
open $fh, '<', $filename; |
|
48
|
2
|
|
|
|
|
7
|
my $json = JSON::PP::decode_json(do { local $/; <$fh> }); |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
76
|
|
|
49
|
2
|
|
|
|
|
4279
|
close $fh; |
|
50
|
2
|
|
|
|
|
32
|
$json; |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 cflags |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $cflags = Alien::pkgconf->cflags; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The compiler flags for compiling against C. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub cflags |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
1
|
|
|
1
|
1
|
7954
|
my($class) = @_; |
|
67
|
|
|
|
|
|
|
$class->install_type eq 'share' |
|
68
|
|
|
|
|
|
|
# may induce duplicates :/ |
|
69
|
1
|
|
|
|
|
5
|
? "-I@{[ _dist_dir 'include', 'pkgconf' ]} @{[ _config->{cflags} ]}" |
|
|
1
|
|
|
|
|
119
|
|
|
70
|
1
|
50
|
|
|
|
54
|
: _config->{cflags}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 libs |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $libs = Alien::pkgconf->libs; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The linker flags for linking against C. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub libs |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
2
|
|
|
2
|
1
|
429188
|
my($class) = @_; |
|
84
|
|
|
|
|
|
|
$class->install_type eq 'share' |
|
85
|
|
|
|
|
|
|
# may induce duplicates :/ |
|
86
|
2
|
|
|
|
|
28
|
? "-L@{[ _dist_dir 'lib' ]} @{[ _config->{libs} ]}" |
|
|
2
|
|
|
|
|
360
|
|
|
87
|
2
|
50
|
|
|
|
30
|
: _config->{libs}; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 dynamic_libs |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my($dll) = Alien::pkgconf->dynamic_libs; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The C<.so>, C<.dll> or C<.dynlib> shared or dynamic library |
|
95
|
|
|
|
|
|
|
which can be used via FFI. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub dynamic_libs |
|
100
|
|
|
|
|
|
|
{ |
|
101
|
0
|
|
|
0
|
1
|
0
|
my($class) = @_; |
|
102
|
|
|
|
|
|
|
$class->install_type eq 'share' |
|
103
|
|
|
|
|
|
|
? (_dist_file('dll', _config->{dll})) |
|
104
|
0
|
0
|
|
|
|
0
|
: (_config->{dll}); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 version |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $version = Alien::pkgconf->version; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The C version. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub version |
|
116
|
|
|
|
|
|
|
{ |
|
117
|
0
|
|
|
0
|
1
|
0
|
_config->{version}; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 bin_dir |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my($dir) = Alien::pkgconf->bin_dir; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The directory where you can find C. If it is not |
|
125
|
|
|
|
|
|
|
already in the C. Adding this to C should make |
|
126
|
|
|
|
|
|
|
tools that require C work. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub bin_dir |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
2
|
|
|
2
|
1
|
701
|
my($class) = @_; |
|
133
|
2
|
50
|
|
|
|
9
|
$class->install_type eq 'share' |
|
134
|
|
|
|
|
|
|
? (_dist_dir 'bin') |
|
135
|
|
|
|
|
|
|
: (); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 install_type |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $type = Alien::pkgconf->install_type; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The type of install, should be either C or C. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub install_type |
|
147
|
|
|
|
|
|
|
{ |
|
148
|
5
|
|
|
5
|
1
|
35
|
_config->{install_type}; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 HELPERS |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 pkgconf |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
%{pkgconf} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The name of the C binary. This is usually just C. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub alien_helper { |
|
162
|
|
|
|
|
|
|
return { |
|
163
|
1
|
|
|
1
|
|
22
|
pkgconf => sub { 'pkgconf' }, |
|
164
|
|
|
|
|
|
|
} |
|
165
|
1
|
|
|
1
|
0
|
74
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over 4 |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item L |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 PLATFORM NOTES |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 Solaris |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
You may need to have the GNU version of nm installed, which comes |
|
182
|
|
|
|
|
|
|
with GNU binutils. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 ACKNOWLEDGMENTS |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Thanks to the C developers for their efforts: |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
L |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 AUTHOR |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Graham Ollis |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Contributors: |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Thibault Duponchelle (tib) |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This software is copyright (c) 2016 Graham Ollis. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This is free software; you may redistribute it and/or modify it under |
|
203
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
|
206
|
|
|
|
|
|
|
|