line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# App::hopen::T::Gnu::C::LinkCmd - link object files using the GNU toolset |
2
|
|
|
|
|
|
|
package App::hopen::T::Gnu::C::LinkCmd; |
3
|
1
|
|
|
1
|
|
8
|
use Data::Hopen; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
4
|
use Data::Hopen::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000012'; # TRIAL |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1378
|
use parent 'App::hopen::G::Cmd'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
66
|
use Class::Tiny qw(dest linker); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
370
|
use App::hopen::BuildSystemGlobals; # For $DestDir. |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
13
|
|
|
|
|
|
|
# TODO make the dirs available to nodes through the context. |
14
|
1
|
|
|
1
|
|
7
|
use App::hopen::Util::BasedPath; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
15
|
|
|
|
|
|
|
#use Config; |
16
|
1
|
|
|
1
|
|
5
|
use Data::Hopen qw(getparameters); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
17
|
|
|
|
|
|
|
#use Data::Hopen::G::GraphBuilder; |
18
|
1
|
|
|
1
|
|
7
|
use Data::Hopen::Util::Filename; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
19
|
|
|
|
|
|
|
#use Deep::Hash::Utils qw(deepvalue); |
20
|
|
|
|
|
|
|
#use File::Which (); |
21
|
1
|
|
|
1
|
|
5
|
use Path::Class; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
329
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#my $FN = Data::Hopen::Util::Filename->new; # for brevity |
24
|
|
|
|
|
|
|
#our $_CC; # Cached compiler name |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Docs {{{1 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
App::hopen::T::Gnu::C::LinkCmd - link object files using the GNU toolset |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
In a hopen file: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $cmd = App::hopen::T::Gnu::C::LinkCmd->new( |
37
|
|
|
|
|
|
|
linker => 'gcc', |
38
|
|
|
|
|
|
|
dest => 'foo.exe', |
39
|
|
|
|
|
|
|
name => 'some linker node', # optional |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The inputs come from earlier in the build graph. |
43
|
|
|
|
|
|
|
TODO support specifying linker arguments. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 linker |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
The linker to use. TODO is this a full path or just a name? |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 dest |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The destination file to produce, as an L<App::hopen::Util::BasedPath> instance. |
54
|
|
|
|
|
|
|
TODO? accept string or L<Path::Class::File> instance? |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 MEMBER FUNCTIONS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# }}}1 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 _run |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Create the link command line. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _run { |
69
|
2
|
|
|
2
|
|
683
|
my ($self, %args) = getparameters('self', [qw(phase visitor ; *)], @_); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Currently we only do things at gen time. |
72
|
2
|
50
|
|
|
|
167
|
return $self->passthrough(-nocontext=>1) if $args{phase} ne 'Gen'; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Pull the inputs |
75
|
2
|
|
|
|
|
11
|
my $lrObjFiles = $self->input_assets; |
76
|
2
|
|
|
0
|
|
16
|
hlog { 'found object files', Dumper($lrObjFiles) } 2; |
|
0
|
|
|
|
|
0
|
|
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
|
|
63
|
my $exe = App::hopen::Asset->new( |
79
|
|
|
|
|
|
|
target => $self->dest, |
80
|
|
|
|
|
|
|
made_by => $self, |
81
|
|
|
|
|
|
|
); |
82
|
2
|
|
|
|
|
64
|
$args{visitor}->asset($exe, |
83
|
|
|
|
|
|
|
-how => $self->linker . ' -o #out #all', |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
9
|
foreach my $obj (@$lrObjFiles) { |
87
|
2
|
50
|
|
|
|
9
|
die "Cannot link non-file $obj" unless $obj->isdisk; |
88
|
2
|
|
|
|
|
10
|
$args{visitor}->connect($obj, $exe); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
2
|
|
|
|
|
3338
|
$self->make($exe); |
92
|
2
|
|
|
|
|
7
|
return {}; |
93
|
|
|
|
|
|
|
} #_run() |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
# vi: set fdm=marker: # |