line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Build::SearchDep; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1586
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
64
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
44
|
use 5.008004; |
|
2
|
|
|
|
|
7
|
|
6
|
2
|
|
|
2
|
|
447
|
use Alien::Build::Plugin; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
19
|
|
7
|
2
|
|
|
2
|
|
602
|
use Text::ParseWords qw( shellwords ); |
|
2
|
|
|
|
|
1466
|
|
|
2
|
|
|
|
|
1984
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Add dependencies to library and header search path |
10
|
|
|
|
|
|
|
our $VERSION = '2.46'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has aliens => {}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has public_I => 0; |
17
|
|
|
|
|
|
|
has public_l => 0; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
0
|
1
|
|
my($self, $meta) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.35'); |
24
|
0
|
|
|
|
|
|
$meta->add_requires('share' => 'Env::ShellWords' => 0.01); |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
0
|
|
|
|
if($self->public_I || $self->public_l) |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
|
$meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.53'); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @aliens; |
32
|
0
|
0
|
|
|
|
|
if(ref($self->aliens) eq 'HASH') |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
|
@aliens = keys %{ $self->aliens }; |
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$meta->add_requires('share' => $_ => $self->aliens->{$_}) for @aliens; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
0
|
|
|
|
|
@aliens = ref $self->aliens ? @{ $self->aliens } : ($self->aliens); |
|
0
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$meta->add_requires('share' => $_ => 0) for @aliens; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$meta->around_hook( |
44
|
|
|
|
|
|
|
build => sub { |
45
|
0
|
|
|
0
|
|
|
my($orig, $build) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
local $ENV{CFLAGS} = $ENV{CFLAGS}; |
48
|
0
|
|
|
|
|
|
local $ENV{CXXFLAGS} = $ENV{CXXFLAGS}; |
49
|
0
|
|
|
|
|
|
local $ENV{LDFLAGS} = $ENV{LDFLAGS}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
tie my @CFLAGS, 'Env::ShellWords', 'CFLAGS'; |
52
|
0
|
|
|
|
|
|
tie my @CXXFLAGS, 'Env::ShellWords', 'CXXFLAGS'; |
53
|
0
|
|
|
|
|
|
tie my @LDFLAGS, 'Env::ShellWords', 'LDFLAGS'; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $cflags = $build->install_prop->{plugin_build_searchdep_cflags} = []; |
56
|
0
|
|
|
|
|
|
my $ldflags = $build->install_prop->{plugin_build_searchdep_ldflags} = []; |
57
|
0
|
|
|
|
|
|
my $libs = $build->install_prop->{plugin_build_searchdep_libs} = []; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach my $other (@aliens) |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
|
my $other_cflags; |
62
|
|
|
|
|
|
|
my $other_libs; |
63
|
0
|
0
|
|
|
|
|
if($other->install_type('share')) |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
|
|
|
$other_cflags = $other->cflags_static; |
66
|
0
|
|
|
|
|
|
$other_libs = $other->libs_static; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
|
|
|
$other_cflags = $other->cflags; |
71
|
0
|
|
|
|
|
|
$other_libs = $other->libs; |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
unshift @$cflags, grep /^-I/, shellwords($other_cflags); |
74
|
0
|
|
|
|
|
|
unshift @$ldflags, grep /^-L/, shellwords($other_libs); |
75
|
0
|
|
|
|
|
|
unshift @$libs, grep /^-l/, shellwords($other_libs); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
unshift @CFLAGS, @$cflags; |
79
|
0
|
|
|
|
|
|
unshift @CXXFLAGS, @$cflags; |
80
|
0
|
|
|
|
|
|
unshift @LDFLAGS, @$ldflags; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$orig->($build); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
}, |
85
|
0
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$meta->after_hook( |
88
|
|
|
|
|
|
|
gather_share => sub { |
89
|
0
|
|
|
0
|
|
|
my($build) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
$build->runtime_prop->{libs} = '' unless defined $build->runtime_prop->{libs}; |
92
|
0
|
0
|
|
|
|
|
$build->runtime_prop->{libs_static} = '' unless defined $build->runtime_prop->{libs_static}; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if($self->public_l) |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
|
|
|
$build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_libs} })) . ' ' . $build->runtime_prop->{$_} |
97
|
0
|
|
|
|
|
|
for qw( libs libs_static ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_ldflags} })) . ' ' . $build->runtime_prop->{$_} |
101
|
0
|
|
|
|
|
|
for qw( libs libs_static ); |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
if($self->public_I) |
104
|
|
|
|
|
|
|
{ |
105
|
0
|
0
|
|
|
|
|
$build->runtime_prop->{cflags} = '' unless defined $build->runtime_prop->{cflags}; |
106
|
0
|
0
|
|
|
|
|
$build->runtime_prop->{cflags_static} = '' unless defined $build->runtime_prop->{cflags_static}; |
107
|
0
|
|
|
|
|
|
$build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_cflags} })) . ' ' . $build->runtime_prop->{$_} |
108
|
0
|
|
|
|
|
|
for qw( cflags cflags_static ); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
}, |
111
|
0
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _space_escape |
115
|
|
|
|
|
|
|
{ |
116
|
|
|
|
|
|
|
map { |
117
|
0
|
|
|
0
|
|
|
my $str = $_; |
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
$str =~ s{(\s)}{\\$1}g; |
119
|
0
|
|
|
|
|
|
$str; |
120
|
|
|
|
|
|
|
} @_; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
__END__ |