| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::PkgConfig::MakeStatic; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1327
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
57
|
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
41
|
|
|
5
|
2
|
|
|
2
|
|
28
|
use 5.008004; |
|
|
2
|
|
|
|
|
8
|
|
|
6
|
2
|
|
|
2
|
|
379
|
use Alien::Build::Plugin; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
13
|
|
|
7
|
2
|
|
|
2
|
|
13
|
use Path::Tiny (); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1281
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Convert .pc files into static |
|
10
|
|
|
|
|
|
|
our $VERSION = '2.45'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has path => undef; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _convert |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
2
|
|
|
2
|
|
3
|
my($self, $build, $path) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
2
|
50
|
|
|
|
7
|
die "unable to read $path" unless -r $path; |
|
20
|
2
|
50
|
|
|
|
52
|
die "unable to write $path" unless -w $path; |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
37
|
$build->log("converting $path to static"); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my %h = map { |
|
25
|
2
|
|
|
|
|
13
|
my($key, $value) = /^(.*?):(.*?)$/; |
|
|
6
|
|
|
|
|
428
|
|
|
26
|
6
|
|
|
|
|
22
|
$value =~ s{^\s+}{}; |
|
27
|
6
|
|
|
|
|
15
|
$value =~ s{\s+$}{}; |
|
28
|
6
|
|
|
|
|
21
|
($key => $value); |
|
29
|
|
|
|
|
|
|
} grep /^(?:Libs|Cflags)(?:\.private)?:/, $path->lines; |
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
100
|
|
|
|
11
|
$h{Cflags} = '' unless defined $h{Cflags}; |
|
32
|
2
|
50
|
|
|
|
5
|
$h{Libs} = '' unless defined $h{Libs}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
2
|
100
|
|
|
|
13
|
$h{Cflags} .= ' ' . $h{"Cflags.private"} if defined $h{"Cflags.private"}; |
|
35
|
2
|
50
|
|
|
|
8
|
$h{Libs} .= ' ' . $h{"Libs.private"} if defined $h{"Libs.private"}; |
|
36
|
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
19
|
$h{"Cflags.private"} = ''; |
|
38
|
2
|
|
|
|
|
5
|
$h{"Libs.private"} = ''; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$path->edit_lines(sub { |
|
41
|
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
8
|
|
839
|
if(/^(.*?):/) |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
6
|
|
|
|
|
14
|
my $key = $1; |
|
45
|
6
|
50
|
|
|
|
13
|
if(defined $h{$key}) |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
6
|
|
|
|
|
30
|
s/^(.*?):.*$/$1: $h{$key} /; |
|
48
|
6
|
|
|
|
|
14
|
delete $h{$key}; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
20
|
}); |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
304
|
$path->append("$_: $h{$_}\n") foreach keys %h; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _recurse |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
3
|
|
|
3
|
|
89
|
my($self, $build, $dir) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
7
|
foreach my $child ($dir->children) |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
4
|
100
|
|
|
|
651
|
if(-d $child) |
|
|
|
50
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
|
65
|
2
|
|
|
|
|
43
|
$self->_recurse($build, $child); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
elsif($child->basename =~ /\.pc$/) |
|
68
|
|
|
|
|
|
|
{ |
|
69
|
2
|
|
|
|
|
96
|
$self->_convert($build, $child); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub init |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
1
|
|
|
1
|
1
|
3
|
my($self, $meta) = @_; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
4
|
$meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.35'); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$meta->before_hook( |
|
81
|
|
|
|
|
|
|
gather_share => sub { |
|
82
|
1
|
|
|
1
|
|
2
|
my($build) = @_; |
|
83
|
|
|
|
|
|
|
|
|
84
|
1
|
50
|
|
|
|
6
|
if($self->path) |
|
85
|
|
|
|
|
|
|
{ |
|
86
|
0
|
|
|
|
|
0
|
$self->_convert($build, Path::Tiny->new($self->path)->absolute); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
else |
|
89
|
|
|
|
|
|
|
{ |
|
90
|
1
|
|
|
|
|
4
|
$self->_recurse($build, Path::Tiny->new(".")->absolute); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
}, |
|
94
|
1
|
|
|
|
|
6
|
); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |