line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::PkgConfig::MakeStatic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1469
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
47
|
|
5
|
2
|
|
|
2
|
|
37
|
use 5.008004; |
|
2
|
|
|
|
|
7
|
|
6
|
2
|
|
|
2
|
|
355
|
use Alien::Build::Plugin; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
7
|
2
|
|
|
2
|
|
9
|
use Path::Tiny (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1245
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Convert .pc files into static |
10
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has path => undef; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _convert |
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
2
|
|
5
|
my($self, $build, $path) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
50
|
|
|
|
6
|
die "unable to read $path" unless -r $path; |
20
|
2
|
50
|
|
|
|
38
|
die "unable to write $path" unless -w $path; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
34
|
$build->log("converting $path to static"); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my %h = map { |
25
|
2
|
|
|
|
|
13
|
my($key, $value) = /^(.*?):(.*?)$/; |
|
6
|
|
|
|
|
784
|
|
26
|
6
|
|
|
|
|
22
|
$value =~ s{^\s+}{}; |
27
|
6
|
|
|
|
|
15
|
$value =~ s{\s+$}{}; |
28
|
6
|
|
|
|
|
23
|
($key => $value); |
29
|
|
|
|
|
|
|
} grep /^(?:Libs|Cflags)(?:\.private)?:/, $path->lines; |
30
|
|
|
|
|
|
|
|
31
|
2
|
100
|
|
|
|
12
|
$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
|
|
|
|
9
|
$h{Libs} .= ' ' . $h{"Libs.private"} if defined $h{"Libs.private"}; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
3
|
$h{"Cflags.private"} = ''; |
38
|
2
|
|
|
|
|
4
|
$h{"Libs.private"} = ''; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$path->edit_lines(sub { |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
8
|
|
767
|
if(/^(.*?):/) |
43
|
|
|
|
|
|
|
{ |
44
|
6
|
|
|
|
|
14
|
my $key = $1; |
45
|
6
|
50
|
|
|
|
15
|
if(defined $h{$key}) |
46
|
|
|
|
|
|
|
{ |
47
|
6
|
|
|
|
|
31
|
s/^(.*?):.*$/$1: $h{$key} /; |
48
|
6
|
|
|
|
|
15
|
delete $h{$key}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
20
|
}); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
325
|
$path->append("$_: $h{$_}\n") foreach keys %h; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _recurse |
58
|
|
|
|
|
|
|
{ |
59
|
3
|
|
|
3
|
|
119
|
my($self, $build, $dir) = @_; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
8
|
foreach my $child ($dir->children) |
62
|
|
|
|
|
|
|
{ |
63
|
4
|
100
|
|
|
|
677
|
if(-d $child) |
|
|
50
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
65
|
2
|
|
|
|
|
38
|
$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
|
4
|
my($self, $meta) = @_; |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
6
|
$meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.35'); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$meta->before_hook( |
81
|
|
|
|
|
|
|
gather_share => sub { |
82
|
1
|
|
|
1
|
|
3
|
my($build) = @_; |
83
|
|
|
|
|
|
|
|
84
|
1
|
50
|
|
|
|
5
|
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
|
|
|
|
|
9
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |