line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Base::Wrapper; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
169011
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
51
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
42
|
|
5
|
2
|
|
|
2
|
|
38
|
use 5.008001; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
7
|
use Config; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
70
|
|
7
|
2
|
|
|
2
|
|
823
|
use Text::ParseWords qw( shellwords ); |
|
2
|
|
|
|
|
2289
|
|
|
2
|
|
|
|
|
1414
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Compiler and linker wrapper for Alien |
10
|
|
|
|
|
|
|
our $VERSION = '0.05'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my @cflags_I; |
14
|
|
|
|
|
|
|
my @cflags_other; |
15
|
|
|
|
|
|
|
my @ldflags_L; |
16
|
|
|
|
|
|
|
my @ldflags_l; |
17
|
|
|
|
|
|
|
my @ldflags_other; |
18
|
|
|
|
|
|
|
my @mm; |
19
|
|
|
|
|
|
|
my @mb; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _reset |
22
|
|
|
|
|
|
|
{ |
23
|
4
|
|
|
4
|
|
14500
|
@cflags_I = (); |
24
|
4
|
|
|
|
|
9
|
@cflags_other = (); |
25
|
4
|
|
|
|
|
9
|
@ldflags_L = (); |
26
|
4
|
|
|
|
|
7
|
@ldflags_l = (); |
27
|
4
|
|
|
|
|
42
|
@ldflags_other = (); |
28
|
4
|
|
|
|
|
14
|
@mm = (); |
29
|
4
|
|
|
|
|
14
|
@mb = (); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub cc |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
my @command = ( |
36
|
4
|
|
|
4
|
1
|
387
|
shellwords($Config{cc}), |
37
|
|
|
|
|
|
|
@cflags_I, |
38
|
|
|
|
|
|
|
@cflags_other, |
39
|
|
|
|
|
|
|
@ARGV, |
40
|
|
|
|
|
|
|
); |
41
|
4
|
50
|
|
|
|
201
|
print "@command\n" unless $ENV{ALIEN_BASE_WRAPPER_QUIET}; |
42
|
4
|
|
|
|
|
13
|
exec @command; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ld |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
my @command = ( |
49
|
4
|
|
|
4
|
1
|
5029
|
shellwords($Config{ld}), |
50
|
|
|
|
|
|
|
@ldflags_L, |
51
|
|
|
|
|
|
|
@ldflags_other, |
52
|
|
|
|
|
|
|
@ARGV, |
53
|
|
|
|
|
|
|
@ldflags_l, |
54
|
|
|
|
|
|
|
); |
55
|
4
|
50
|
|
|
|
273
|
print "@command\n" unless $ENV{ALIEN_BASE_WRAPPER_QUIET}; |
56
|
4
|
|
|
|
|
14
|
exec @command; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub mm_args |
61
|
|
|
|
|
|
|
{ |
62
|
1
|
|
|
1
|
1
|
1784
|
@mm; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub mb_args |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
1
|
1
|
2779
|
@mb; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _join |
72
|
|
|
|
|
|
|
{ |
73
|
36
|
|
|
36
|
|
68
|
join ' ', map { s/(\s)/\\$1/g; $_ } @_; |
|
54
|
|
|
|
|
124
|
|
|
54
|
|
|
|
|
319
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub import |
77
|
|
|
|
|
|
|
{ |
78
|
6
|
|
|
6
|
|
193
|
my(undef, @aliens) = @_; |
79
|
|
|
|
|
|
|
|
80
|
6
|
|
|
|
|
17
|
my $export = 1; |
81
|
|
|
|
|
|
|
|
82
|
6
|
|
|
|
|
13
|
foreach my $alien (@aliens) |
83
|
|
|
|
|
|
|
{ |
84
|
7
|
50
|
|
|
|
121
|
if($alien eq '!export') |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
0
|
$export = 0; |
87
|
|
|
|
|
|
|
} |
88
|
7
|
100
|
|
|
|
30
|
$alien = "Alien::$alien" unless $alien =~ /::/; |
89
|
7
|
|
|
|
|
17
|
my $alien_pm = $alien . '.pm'; |
90
|
7
|
|
|
|
|
27
|
$alien_pm =~ s/::/\//g; |
91
|
7
|
50
|
33
|
|
|
16
|
require $alien_pm unless eval { $alien->can('cflags') } && eval { $alien->can('libs') }; |
|
7
|
|
|
|
|
74
|
|
|
7
|
|
|
|
|
43
|
|
92
|
7
|
|
|
|
|
14
|
my $cflags; |
93
|
|
|
|
|
|
|
my $libs; |
94
|
7
|
100
|
100
|
|
|
22
|
if($alien->install_type eq 'share' && $alien->can('cflags_static')) |
95
|
|
|
|
|
|
|
{ |
96
|
1
|
|
|
|
|
12
|
$cflags = $alien->cflags_static; |
97
|
1
|
|
|
|
|
7
|
$libs = $alien->libs_static; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else |
100
|
|
|
|
|
|
|
{ |
101
|
6
|
|
|
|
|
92
|
$cflags = $alien->cflags; |
102
|
6
|
|
|
|
|
24
|
$libs = $alien->libs; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
7
|
|
|
|
|
31
|
push @cflags_I, grep /^-I/, shellwords $cflags; |
106
|
7
|
|
|
|
|
614
|
push @cflags_other, grep !/^-I/, shellwords $cflags; |
107
|
|
|
|
|
|
|
|
108
|
7
|
|
|
|
|
375
|
push @ldflags_L, grep /^-L/, shellwords $libs; |
109
|
7
|
|
|
|
|
421
|
push @ldflags_l, grep /^-l/, shellwords $libs; |
110
|
7
|
|
|
|
|
418
|
push @ldflags_other, grep !/^-[Ll]/, shellwords $libs; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
6
|
|
|
|
|
327
|
my @cflags_define = grep /^-D/, @cflags_other; |
114
|
6
|
|
|
|
|
17
|
my @cflags_other2 = grep !/^-D/, @cflags_other; |
115
|
|
|
|
|
|
|
|
116
|
6
|
|
|
|
|
11
|
@mm = (); |
117
|
|
|
|
|
|
|
|
118
|
6
|
100
|
|
|
|
25
|
push @mm, INC => _join @cflags_I if @cflags_I; |
119
|
6
|
50
|
|
|
|
18
|
push @mm, CCFLAGS => _join(@cflags_other2) . " $Config{ccflags}" if @cflags_other2; |
120
|
6
|
100
|
|
|
|
22
|
push @mm, DEFINE => _join(@cflags_define) if @cflags_define; |
121
|
|
|
|
|
|
|
|
122
|
6
|
|
|
|
|
19
|
push @mm, LIBS => [@ldflags_l]; |
123
|
6
|
|
|
|
|
14
|
my @ldflags = (@ldflags_L, @ldflags_other); |
124
|
6
|
100
|
|
|
|
18
|
push @mm, LDDLFLAGS => _join(@ldflags) . " $Config{lddlflags}" if @ldflags; |
125
|
6
|
100
|
|
|
|
27
|
push @mm, LDFLAGS => _join(@ldflags) . " $Config{ldflags}" if @ldflags; |
126
|
|
|
|
|
|
|
|
127
|
6
|
|
|
|
|
18
|
@mb = (); |
128
|
|
|
|
|
|
|
|
129
|
6
|
|
|
|
|
18
|
push @mb, extra_compiler_flags => _join(@cflags_I, @cflags_other); |
130
|
6
|
|
|
|
|
18
|
push @mb, extra_linker_flags => _join(@ldflags_l); |
131
|
|
|
|
|
|
|
|
132
|
6
|
100
|
|
|
|
25
|
if(@ldflags) |
133
|
|
|
|
|
|
|
{ |
134
|
4
|
|
|
|
|
13
|
push @mb, config => { |
135
|
|
|
|
|
|
|
lddlflags => _join(@ldflags) . " $Config{lddlflags}", |
136
|
|
|
|
|
|
|
ldflags => _join(@ldflags) . " $Config{ldflags}", |
137
|
|
|
|
|
|
|
}, |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
6
|
50
|
|
|
|
24
|
if($export) |
141
|
|
|
|
|
|
|
{ |
142
|
6
|
|
|
|
|
17
|
my $caller = caller; |
143
|
2
|
|
|
2
|
|
15
|
no strict 'refs'; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
230
|
|
144
|
6
|
|
|
|
|
14
|
*{"${caller}::cc"} = \&cc; |
|
6
|
|
|
|
|
30
|
|
145
|
6
|
|
|
|
|
16
|
*{"${caller}::ld"} = \&ld; |
|
6
|
|
|
|
|
2450
|
|
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
__END__ |