1 |
< |
# BuildFile |
1 |
> |
#____________________________________________________________________ |
2 |
> |
# File: BuildFile.pm |
3 |
> |
#____________________________________________________________________ |
4 |
> |
# |
5 |
> |
# Author: Shaun Ashby <Shaun.Ashby@cern.ch> |
6 |
> |
# Copyright: 2003 (C) Shaun Ashby |
7 |
|
# |
8 |
< |
# Interface |
4 |
< |
# --------- |
5 |
< |
# new(ConfigArea,Builder) |
6 |
< |
# ParseBuildFile($base,$path,$file) |
7 |
< |
# ParseBuildFileExport(filename) |
8 |
< |
# BlockParse(Block) : perform a parse to modify the block |
9 |
< |
# BlockClassPath() : Return the class path |
10 |
< |
# ignore() : return 1 if directory should be ignored 0 otherwise |
11 |
< |
# classname() : get/set the associated class |
12 |
< |
# buildfile() : get/set BuildFile location |
13 |
< |
# makefile() : get the generated makefile |
14 |
< |
|
8 |
> |
#-------------------------------------------------------------------- |
9 |
|
package BuildSystem::BuildFile; |
16 |
– |
use ActiveDoc::SimpleDoc; |
17 |
– |
use BuildSystem::ToolBox; |
10 |
|
require 5.004; |
11 |
+ |
use Exporter; |
12 |
+ |
use ActiveDoc::SimpleDoc; |
13 |
|
|
14 |
< |
BEGIN { |
15 |
< |
$buildfile="BuildFile"; |
22 |
< |
} |
23 |
< |
|
24 |
< |
sub new { |
25 |
< |
my $class=shift; |
26 |
< |
my $self={}; |
27 |
< |
bless $self, $class; |
28 |
< |
$self->{area}=shift; |
29 |
< |
$self->{Builder}=shift; |
30 |
< |
$self->{toolbox}=$self->{area}->toolbox(); |
31 |
< |
$self->{localtop}=$self->{area}->location(); |
32 |
< |
# -- set RELEASTOP |
33 |
< |
my $rarea=$self->{area}->linkarea(); |
34 |
< |
if ( ! defined $rarea ) { |
35 |
< |
$self->{releasetop}=$self->{localtop}; |
36 |
< |
} |
37 |
< |
else { |
38 |
< |
$self->{releasetop}=$rarea->location(); |
39 |
< |
} |
40 |
< |
$self->{releasetop}=$self->{area}->location(); |
41 |
< |
$self->{Arch}=1; |
42 |
< |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
43 |
< |
return $self; |
44 |
< |
} |
45 |
< |
|
46 |
< |
sub buildfile { |
47 |
< |
my $self=shift; |
48 |
< |
if ( @_ ) { |
49 |
< |
$self->{buildfile}=shift; |
50 |
< |
} |
51 |
< |
return $self->{buildfile}; |
52 |
< |
} |
53 |
< |
|
54 |
< |
sub makefile { |
55 |
< |
my $self=shift; |
56 |
< |
if ( @_ ) { |
57 |
< |
$self->{makefile}=shift; |
58 |
< |
} |
59 |
< |
return $self->{makefile}; |
60 |
< |
} |
61 |
< |
|
62 |
< |
sub BlockParse { |
63 |
< |
my $self=shift; |
64 |
< |
$self->{block}=shift; |
65 |
< |
|
66 |
< |
# -- set up the block parse |
67 |
< |
my $switch=$self->_initswitcher(); |
68 |
< |
my $parse="block"; |
69 |
< |
$switch->newparse($parse); |
70 |
< |
$switch->addignoretags($parse); |
71 |
< |
$switch->addtag($parse,"BuildParam", \&BuildBlock_start, $self); |
72 |
< |
$switch->filetoparse($self->buildfile()); |
73 |
< |
|
74 |
< |
# -- parse away |
75 |
< |
$self->{switch}=$switch; |
76 |
< |
$switch->parse("block"); |
77 |
< |
} |
78 |
< |
|
79 |
< |
sub Parsetofh { |
80 |
< |
my $self=shift; |
81 |
< |
my $fh=shift; |
82 |
< |
$self->{buildblock}=shift; |
83 |
< |
|
84 |
< |
# -- set up for parse |
85 |
< |
@{$self->{filehandlestack}}=($fh); |
86 |
< |
$self->{switch}->filetoparse($self->buildfile()); |
87 |
< |
*GNUmakefile=$fh; |
88 |
< |
|
89 |
< |
# -- generate makefile |
90 |
< |
$self->{switch}->parse("makebuild"); # sort out supported tags |
91 |
< |
|
92 |
< |
# -- Clean up |
93 |
< |
close GNUmakefile; |
94 |
< |
} |
95 |
< |
|
96 |
< |
sub ignore { |
97 |
< |
my $self=shift; |
98 |
< |
return (defined $self->{ignore})?$self->{ignore}:0; |
99 |
< |
} |
100 |
< |
|
101 |
< |
sub _initswitcher { |
102 |
< |
my $self=shift; |
103 |
< |
my $switch=ActiveDoc::SimpleDoc->new(); |
104 |
< |
my $parse="makebuild"; |
105 |
< |
$switch->newparse($parse); |
106 |
< |
$switch->addignoretags($parse); |
107 |
< |
$self->_commontags($switch,$parse); |
108 |
< |
#$switch->addtag($parse,"Build", \&Build_start, $self); |
109 |
< |
$switch->addtag($parse,"none", |
110 |
< |
\&OutToMakefile,$self, |
111 |
< |
\&OutToMakefile, $self, |
112 |
< |
"", $self); |
113 |
< |
$switch->addtag($parse,"Bin", |
114 |
< |
\&Bin_start,$self, |
115 |
< |
\&OutToScreen, $self, |
116 |
< |
"", $self); |
117 |
< |
$switch->addtag($parse,"ProductStore", |
118 |
< |
\&Store_start,$self, |
119 |
< |
"", $self, |
120 |
< |
"", $self); |
121 |
< |
$switch->addtag($parse,"LibType", |
122 |
< |
\&LibType_Start,$self, |
123 |
< |
\&LibType_text, $self, |
124 |
< |
\&LibType_end,$self); |
125 |
< |
$switch->addtag($parse,"ConfigurationClass", |
126 |
< |
\&Class_StartTag,$self, |
127 |
< |
\&OutToMakefile, $self, |
128 |
< |
"", $self); |
129 |
< |
$switch->addtag($parse,"ClassPath", |
130 |
< |
\&setBlockClassPath,$self, |
131 |
< |
\&OutToMakefile, $self, |
132 |
< |
"", $self); |
133 |
< |
$switch->addtag($parse,"AssociateGroup", |
134 |
< |
"",$self, |
135 |
< |
\&AssociateGroup,$self, |
136 |
< |
"", $self); |
137 |
< |
$switch->addtag($parse,"Environment", |
138 |
< |
\&Environment_start,$self, |
139 |
< |
\&OutToMakefile, $self, |
140 |
< |
\&Environment_end,$self); |
141 |
< |
$switch->addtag($parse,"Export", |
142 |
< |
\&export_start,$self, |
143 |
< |
\&OutToMakefile, $self, |
144 |
< |
\&export_end,$self); |
145 |
< |
return $switch; |
146 |
< |
} |
147 |
< |
|
148 |
< |
sub _commontags { |
149 |
< |
my $self=shift; |
150 |
< |
my $switch=shift; |
151 |
< |
my $parse=shift; |
152 |
< |
|
153 |
< |
$switch->grouptag("Export",$parse); |
154 |
< |
$switch->addtag($parse,"Use",\&Use_start,$self, |
155 |
< |
\&OutToMakefile, $self, |
156 |
< |
"", $self); |
157 |
< |
$switch->addtag($parse,"Group",\&Group_start,$self, |
158 |
< |
\&OutToMakefile, $self, |
159 |
< |
"", $self); |
160 |
< |
$switch->grouptag("Group",$parse); |
161 |
< |
$switch->addtag($parse,"External", |
162 |
< |
\&External_StartTag,$self, |
163 |
< |
\&OutToMakefile, $self, |
164 |
< |
"", $self); |
165 |
< |
$switch->addtag($parse,"lib", |
166 |
< |
\&lib_start,$self, |
167 |
< |
\&OutToMakefile, $self, |
168 |
< |
"", $self); |
169 |
< |
$switch->addtag($parse,"Architecture", |
170 |
< |
\&Arch_Start,$self, |
171 |
< |
\&OutToMakefile, $self, |
172 |
< |
\&Arch_End,$self); |
173 |
< |
$switch->addtag($parse,"INCLUDE_PATH", |
174 |
< |
\&IncludePath_Start,$self, |
175 |
< |
\&OutToMakefile, $self, |
176 |
< |
"",$self); |
177 |
< |
return $switch; |
178 |
< |
} |
179 |
< |
|
180 |
< |
sub GenerateMakefile { |
181 |
< |
my $self=shift; |
182 |
< |
my $infile=shift; |
183 |
< |
my $outfile=shift; |
184 |
< |
|
185 |
< |
$self->{switch}=$self->_initswitcher(); |
186 |
< |
$self->{switch}->filetoparse($infile); |
187 |
< |
|
188 |
< |
# open a temporary gnumakefile to store output. |
189 |
< |
my $fh=FileHandle->new(); |
190 |
< |
open ( $fh, ">$outfile") or die "Unable to open $outfile for output ". |
191 |
< |
"$!\n"; |
192 |
< |
@{$self->{filehandlestack}}=($fh); |
193 |
< |
|
194 |
< |
# -- make an alias |
195 |
< |
*GNUmakefile=$fh; |
196 |
< |
if ( -e $ENV{LatestBuildFile} ) { |
197 |
< |
print GNUmakefile "include $ENV{LatestBuildFile}\n"; |
198 |
< |
} |
199 |
< |
$self->{switch}->parse("makebuild"); # sort out supported tags |
200 |
< |
close GNUmakefile; |
201 |
< |
return $outfile; |
202 |
< |
} |
203 |
< |
|
204 |
< |
sub ParseBuildFile { |
205 |
< |
my $self=shift; |
206 |
< |
my $base=shift; |
207 |
< |
my $path=shift; |
208 |
< |
my $filename=shift @_; |
209 |
< |
my $fullfilename; |
210 |
< |
if ( $filename!~/^\// ) { |
211 |
< |
$fullfilename="$base/$path/$filename"; |
212 |
< |
} |
213 |
< |
else { |
214 |
< |
$fullfilename=$filename; |
215 |
< |
} |
216 |
< |
$self->{path}=$path; |
217 |
< |
#print "Processing $fullfilename\n"; |
218 |
< |
$numbins=0; |
219 |
< |
$self->{envnum}=0; |
220 |
< |
$self->{envlevel}=0; |
221 |
< |
$self->{makefile}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
222 |
< |
"BuildFile.mk"; |
223 |
< |
$self->{currentenv}=$self->{makefile}; |
224 |
< |
$self->{switch}=$self->_initswitcher(); |
225 |
< |
$self->{switch}->filetoparse($fullfilename); |
226 |
< |
|
227 |
< |
# $self->{switch}->{Strict_no_cr}='no'; |
228 |
< |
#open a temporary gnumakefile to store output. |
229 |
< |
use Utilities::AddDir; |
230 |
< |
AddDir::adddir("$self->{localtop}/$ENV{INTwork}/$self->{path}"); |
231 |
< |
$ENV{LatestBuildFile}=$self->GenerateMakefile($fullfilename, |
232 |
< |
$self->{localtop}."/".$ENV{INTwork}."/".$self->{path}."/BuildFile.mk"); |
233 |
< |
} |
234 |
< |
|
235 |
< |
sub classname { |
236 |
< |
my $self=shift; |
237 |
< |
if ( @_ ) { |
238 |
< |
$self->{classname}=shift; |
239 |
< |
} |
240 |
< |
return $self->{classname}; |
241 |
< |
} |
242 |
< |
|
243 |
< |
sub ParseBuildFile_Export { |
244 |
< |
my $self=shift; |
245 |
< |
my $filename=shift; |
246 |
< |
my $bf=BuildSystem::BuildFile->new($self->{area},$self->{Builder}); |
247 |
< |
if ( defined $self->{remoteproject} ) { |
248 |
< |
$bf->{remoteproject}=$self->{remoteproject}; |
249 |
< |
} |
250 |
< |
$bf->_parseexport($filename); |
251 |
< |
undef $bf; |
252 |
< |
} |
253 |
< |
|
254 |
< |
sub _location { |
255 |
< |
my $self=shift; |
256 |
< |
use File::Basename; |
257 |
< |
|
258 |
< |
return dirname($self->{switch}->filetoparse()); |
259 |
< |
} |
260 |
< |
|
261 |
< |
sub _parseexport { |
262 |
< |
my $self=shift; |
263 |
< |
my $filename=shift; |
264 |
< |
|
265 |
< |
my $switchex=ActiveDoc::SimpleDoc->new(); |
266 |
< |
$switchex->filetoparse($filename); |
267 |
< |
$switchex->newparse("export"); |
268 |
< |
$switchex->addignoretags("export"); |
269 |
< |
$switchex->addtag("export","Export", |
270 |
< |
\&export_start_export,$self, |
271 |
< |
\&OutToMakefile, $self, |
272 |
< |
\&export_end_export,$self); |
273 |
< |
$self->_commontags($switchex,"export"); |
274 |
< |
$switchex->allowgroup("__export","export"); |
275 |
< |
# $switchex->{Strict_no_cr}='no'; |
276 |
< |
$self->{switch}=$switchex; |
277 |
< |
$switchex->parse("export"); # sort out supported tags |
278 |
< |
} |
279 |
< |
|
280 |
< |
sub _pushremoteproject { |
281 |
< |
my $self=shift; |
282 |
< |
my $path=shift; |
283 |
< |
|
284 |
< |
if ( defined $self->{remoteproject} ) { |
285 |
< |
push @{$self->{rpstack}}, $self->{remoteproject}; |
286 |
< |
} |
287 |
< |
$self->{remoteproject}=$path; |
288 |
< |
} |
289 |
< |
|
290 |
< |
sub _popremoteproject { |
291 |
< |
my $self=shift; |
292 |
< |
if ( $#{$self->{rpstack}} >=0 ) { |
293 |
< |
$self->{remoteproject}=pop @{$self->{rpstack}}; |
294 |
< |
} |
295 |
< |
else { |
296 |
< |
undef $self->{remoteproject}; |
297 |
< |
} |
298 |
< |
} |
299 |
< |
|
300 |
< |
sub _toolmapper { |
301 |
< |
my $self=shift; |
302 |
< |
if ( ! defined $self->{mapper} ) { |
303 |
< |
require BuildSystem::ToolMapper; |
304 |
< |
$self->{mapper}=BuildSystem::ToolMapper->new(); |
305 |
< |
} |
306 |
< |
return $self->{mapper}; |
307 |
< |
} |
308 |
< |
|
309 |
< |
|
310 |
< |
# ---- Tag routines |
311 |
< |
|
312 |
< |
#-- Override a class type with the <ConfigurationClass type=xxx> tag |
313 |
< |
# the type tag will pick up a pre-defined class type from project space. |
314 |
< |
|
315 |
< |
sub Class_StartTag { |
316 |
< |
my $self=shift; |
317 |
< |
my $name=shift; |
318 |
< |
my $hashref=shift; |
319 |
< |
|
320 |
< |
if ( $self->{Arch} ) { |
321 |
< |
if ( defined $$hashref{'type'} ) { |
322 |
< |
$self->classname($$hashref{'type'}); |
323 |
< |
} |
324 |
< |
} |
325 |
< |
} |
326 |
< |
|
327 |
< |
sub IncludePath_Start { |
328 |
< |
my $self=shift; |
329 |
< |
my $name=shift; |
330 |
< |
my $hashref=shift; |
331 |
< |
|
332 |
< |
$self->{switch}->checktag( $name, $hashref, 'path'); |
333 |
< |
if ( $self->{Arch} ) { |
334 |
< |
print GNUmakefile "INCLUDE+=".$self->_location()."/". |
335 |
< |
$$hashref{'path'}."\n"; |
336 |
< |
} |
337 |
< |
} |
338 |
< |
|
339 |
< |
# |
340 |
< |
# --- <Build class=> tag |
341 |
< |
# |
342 |
< |
|
14 |
> |
@ISA=qw(Exporter); |
15 |
> |
@EXPORT_OK=qw( ); |
16 |
|
# |
17 |
< |
# Parameter collection |
18 |
< |
# |
19 |
< |
sub BuildBlock_start { |
20 |
< |
my $self=shift; |
21 |
< |
my $name=shift; |
22 |
< |
my $hashref=shift; |
23 |
< |
|
24 |
< |
|
25 |
< |
my $blockobjid=$self->__blockobjid($hashref); |
26 |
< |
|
27 |
< |
if ( $self->{Arch} ) { |
28 |
< |
|
29 |
< |
# -- get any objects that match |
30 |
< |
my $inheritobj=$self->{block}->getobj($blockobjid); |
31 |
< |
|
32 |
< |
# -- create an object with inherited properties |
33 |
< |
my $obj; |
34 |
< |
if ( ! defined $inheritobj ) { |
35 |
< |
# -- check we have a lookup for the class type |
36 |
< |
my $mapper=$self->_toolmapper(); |
37 |
< |
if ( ! $mapper->exists($$hashref{'class'}) ) { |
38 |
< |
$self->{switch}->parseerror("Unknown class : ". |
39 |
< |
$$hashref{'class'}); |
40 |
< |
} |
41 |
< |
$obj=BuildSystem::BuildClass->new(); |
42 |
< |
} |
43 |
< |
else { |
44 |
< |
# -- inherit the properties from class with the same id class |
45 |
< |
$obj=$inheritobj->child(); |
46 |
< |
} |
47 |
< |
|
48 |
< |
# -- add changes from our tag |
49 |
< |
$obj->paramupdate($hashref); |
50 |
< |
|
51 |
< |
# -- store the new object in the block |
52 |
< |
$self->{block}->setobj($obj,$blockobjid); |
53 |
< |
} |
54 |
< |
} |
55 |
< |
|
56 |
< |
sub BuilderClass_buildmakefile { |
57 |
< |
my $self=shift; |
58 |
< |
my $name=shift; |
59 |
< |
my $hashref=shift; |
60 |
< |
|
61 |
< |
my $blockobjid=$self->__blockobjid($hashref); |
62 |
< |
|
63 |
< |
if ( $self->{Arch} ) { |
64 |
< |
# -- get the matching block object |
65 |
< |
my $blockobj=$self->{buildblock}->getobj($blockobjid); |
66 |
< |
|
67 |
< |
# -- top level buildfile |
68 |
< |
my $fh=$self->{filehandlestack}[0]; |
69 |
< |
|
70 |
< |
# -- var initialisation |
71 |
< |
my @deftypes=(); |
72 |
< |
my $buildname=""; |
73 |
< |
my @types=$self->_toolmapper()->types($$hashref{'class'}); |
74 |
< |
|
75 |
< |
# -- error checking |
76 |
< |
if ( ! defined $blockobj->param("default") ) { |
77 |
< |
$self->error("No default build parameter defined for ". |
78 |
< |
$$hashref{'class'}." ".$$hashref{'id'}); |
79 |
< |
} |
80 |
< |
if ( ! defined $blockobj->param("name") ) { |
81 |
< |
$self->error("\"name\" parameter defined for ". |
82 |
< |
$$hashref{'class'}." ".$$hashref{'id'}); |
83 |
< |
} |
84 |
< |
|
85 |
< |
|
86 |
< |
foreach $param ( $blockobj->paramlist() ) { |
87 |
< |
# -- check for params that need special handling |
88 |
< |
if ( $param eq "default" ) { |
89 |
< |
@deftypes=split /,/, $param; |
90 |
< |
} |
91 |
< |
elsif ( $param eq "name" ) { |
92 |
< |
$buildname=$blockobj->param($param); |
93 |
< |
} |
94 |
< |
else { |
95 |
< |
# -- simple transfer of block object parameters to makefile |
96 |
< |
print $fh $param.":=".$blockobj->param($param)."\n"; |
97 |
< |
} |
98 |
< |
} |
99 |
< |
|
100 |
< |
# -- construct the targets in the top makefile |
101 |
< |
$self->_generatedefaulttargets($fh,$$hashref{'class'},@deftypes); |
102 |
< |
$self->_generatetypetargets($fh,$$hashref{'class'},$buildname,@types); |
103 |
< |
} |
104 |
< |
} |
105 |
< |
|
106 |
< |
sub _blockobjid { |
107 |
< |
my $self=shift; |
108 |
< |
my $hashref=shift; |
109 |
< |
|
110 |
< |
$self->{switch}->checktag($name,$hashref,'class'); |
111 |
< |
$self->{switch}->checktag($name,$hashref,'id'); |
112 |
< |
my $blockobjid="bc_".$$hashref{'class'},"_".$$hashref{'id'}; |
113 |
< |
|
114 |
< |
return $blockobjid; |
115 |
< |
} |
116 |
< |
|
117 |
< |
sub Build_start { |
118 |
< |
my $self=shift; |
119 |
< |
my $name=shift; |
120 |
< |
my $hashref=shift; |
121 |
< |
|
122 |
< |
$self->{switch}->checktag($name,$hashref,'class'); |
123 |
< |
$self->{switch}->checktag($name,$hashref,'id'); |
124 |
< |
if ( $self->{Arch} ) { |
125 |
< |
|
126 |
< |
# -- determine the build products name |
127 |
< |
my $name; |
128 |
< |
if ( exists $$hashref{'name'} ) { |
129 |
< |
$name=$$hashref{'name'}; |
130 |
< |
} |
131 |
< |
else { |
132 |
< |
$self->{switch}->parseerror("No name specified for build product"); |
133 |
< |
#$name="\$(buildname)"; |
134 |
< |
} |
135 |
< |
|
136 |
< |
# -- check we have a lookup for the class type |
137 |
< |
my $mapper=$self->_toolmapper(); |
138 |
< |
if ( ! $mapper->exists($$hashref{'class'}) ) { |
139 |
< |
$self->{switch}->parseerror("Unknown class : ".$$hashref{'class'}); |
140 |
< |
} |
141 |
< |
else { |
142 |
< |
my @types=$self->_toolmapper()->types($$hashref{'class'}); |
143 |
< |
my @deftypes=$self->_toolmapper()->defaulttypes($$hashref{'class'}); |
144 |
< |
|
145 |
< |
my $fh=$self->{filehandlestack}[0]; |
146 |
< |
my @targets=(); |
147 |
< |
|
148 |
< |
# -- generate generic targets |
149 |
< |
print $fh "ifndef _BuildLink_\n"; |
150 |
< |
print $fh "# -- Generic targets\n"; |
151 |
< |
push @targets, $$hashref{'class'}; |
152 |
< |
foreach $dtype ( @deftypes ) { |
153 |
< |
print $fh $$hashref{'class'}."::".$$hashref{'class'}."_". |
154 |
< |
$dtype."\n"; |
155 |
< |
} |
156 |
< |
print $fh "\n"; |
157 |
< |
|
158 |
< |
# -- generate targets for each type |
159 |
< |
foreach $type ( @types ) { |
160 |
< |
|
161 |
< |
# -- generic name for each type |
489 |
< |
my $pattern=$$hashref{'class'}."_".$type; |
490 |
< |
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
491 |
< |
print $fh "# ------ $pattern rules ---------------\n"; |
492 |
< |
print $fh $$hashref{'class'}."_".$type."::".$$hashref{'class'}. |
493 |
< |
"_".$type."_$name\n\n"; |
494 |
< |
|
495 |
< |
# -- create a new directory for each type |
496 |
< |
push @targets, $pattern; |
497 |
< |
my $dirname=$$hashref{'class'}."_".$type."_".$name; |
498 |
< |
my $here="$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/".$dirname; |
499 |
< |
my $makefile=$here."/BuildFile.mk"; |
500 |
< |
# AddDir::adddir($here); |
501 |
< |
|
502 |
< |
# -- create link targets to the directory |
503 |
< |
push @targets, $dirname; |
504 |
< |
print $fh "# -- Link Targets to $type directories\n"; |
505 |
< |
print $fh "$dirname: make_$dirname\n"; |
506 |
< |
print $fh "\t\@cd $here; \\\n"; |
507 |
< |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile _BuildLink_=1". |
508 |
< |
" workdir=$here ". |
509 |
< |
" -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \n\n"; |
510 |
< |
|
511 |
< |
# -- write target to make makefile for each directory |
512 |
< |
print $fh "# -- Build target directories\n"; |
513 |
< |
print $fh "make_$dirname:\n"; |
514 |
< |
print $fh "\tif [ ! -e \"$makefile\" ]; then \\\n"; |
515 |
< |
print $fh "\t if [ ! -d \"$here\" ]; then \\\n"; |
516 |
< |
print $fh "\t mkdir $here; \\\n"; |
517 |
< |
print $fh "\t fi;\\\n"; |
518 |
< |
print $fh "\t cd $dirname; \\\n"; |
519 |
< |
print $fh "\t echo include ".$self->{currentenv}." > ". |
520 |
< |
"$makefile; \\\n"; |
521 |
< |
print $fh "\t echo VPATH+=$ENV{LOCALTOP}/".$self->{path}. |
522 |
< |
" >> $makefile; \\\n"; |
523 |
< |
print $fh "\t echo buildname=$name >> $makefile;\\\n"; |
524 |
< |
print $fh "\t echo ".$dirname.":".$pattern." >> $makefile;\\\n"; |
525 |
< |
if ( defined (my @file=$mapper->rulesfile($$hashref{'class'})) ) { |
526 |
< |
foreach $f ( @file ) { |
527 |
< |
print $fh "\t echo -include $f >> $makefile; \\\n"; |
528 |
< |
} |
529 |
< |
} |
530 |
< |
print $fh "\tfi\n"; |
531 |
< |
print $fh "\n"; |
532 |
< |
# print $typefile "$name :\n"; |
533 |
< |
# print $typefile "\t\$(_quietbuild_)"; |
534 |
< |
# print $typefile $mapper->template($$hashref{'class'},$type)."\n"; |
535 |
< |
# print $typefile "\t\$(_quietstamp_)"; |
536 |
< |
# print $typefile "\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$@.ds \$@ \$^\n"; |
537 |
< |
|
538 |
< |
# -- cleaning targets |
539 |
< |
push @targets, "clean_$dirname"; |
540 |
< |
print $fh "# -- cleaning targets\n"; |
541 |
< |
print $fh "clean::clean_$dirname\n"; |
542 |
< |
print $fh "clean_".$dirname."::\n"; |
543 |
< |
print $fh "\t\@echo cleaning $dirname\n"; |
544 |
< |
print $fh "\t\@if [ -d $here ]; then \\\n"; |
545 |
< |
print $fh "\tcd $here; \\\n"; |
546 |
< |
print $fh "\t\$(MAKE) LatestBuildFile=$makefile workdir=". |
547 |
< |
$here." _BuildLink_=1 -f ". |
548 |
< |
"\$(TOOL_HOME)/basics.mk clean; \\\n"; |
549 |
< |
print $fh "\tfi\n\n"; |
550 |
< |
|
551 |
< |
|
552 |
< |
} |
553 |
< |
# -- help targets |
554 |
< |
print $fh "helpheader::\n"; |
555 |
< |
print $fh "\t\@echo Targets available:\n"; |
556 |
< |
print $fh "\t\@echo ------------------\n\n"; |
557 |
< |
print $fh "help::helpheader\n"; |
558 |
< |
foreach $target ( @targets ) { |
559 |
< |
print $fh "help::\n"; |
560 |
< |
print $fh "\t\@echo $target\n" |
561 |
< |
} |
562 |
< |
print $fh "endif\n"; |
563 |
< |
} # end else |
564 |
< |
} |
565 |
< |
} |
566 |
< |
|
567 |
< |
sub Bin_start { |
568 |
< |
my $self=shift; |
569 |
< |
my $name=shift; |
570 |
< |
my $hashref=shift; |
571 |
< |
|
572 |
< |
my $fileclass; |
573 |
< |
my @tools; |
574 |
< |
my $tool; |
575 |
< |
my $filename; |
576 |
< |
my $objectname; |
577 |
< |
|
578 |
< |
$self->{switch}->checktag($name,$hashref,'file'); |
579 |
< |
if ( $self->{Arch} ) { |
580 |
< |
if ( ! defined $$hashref{name} ) { |
581 |
< |
($$hashref{name}=$$hashref{file})=~s/\..*//; |
582 |
< |
} |
583 |
< |
($filename=$$hashref{file})=~s/\..*//; |
584 |
< |
|
585 |
< |
# Create a new directory for each binary target |
586 |
< |
my $dirname="bin_".$$hashref{name}; |
587 |
< |
AddDir::adddir("$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname"); |
588 |
< |
open (binGNUmakefile, |
589 |
< |
">$ENV{LOCALTOP}/$ENV{INTwork}/".$self->{path}."/$dirname/BuildFile.mk") or die "Unable to make $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/". |
590 |
< |
"BuildFile.mk $!\n"; |
591 |
< |
|
592 |
< |
# Create the link targets |
593 |
< |
$numbins++; |
594 |
< |
my $fh=$self->{filehandlestack}[0]; |
595 |
< |
print $fh <<ENDTEXT; |
596 |
< |
|
597 |
< |
# Link Targets to binary directories |
598 |
< |
ifdef BINMODE |
599 |
< |
# We dont want to build a library here |
600 |
< |
override files:= |
601 |
< |
endif |
602 |
< |
ifndef BINMODE |
603 |
< |
|
604 |
< |
define stepdown_$$hashref{'name'} |
605 |
< |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
606 |
< |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
607 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\@; \\ |
608 |
< |
fi |
609 |
< |
endef |
610 |
< |
|
611 |
< |
define stepdown2_$$hashref{'name'} |
612 |
< |
if [ -d "$ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname" ]; then \\ |
613 |
< |
cd $ENV{LOCALTOP}/$ENV{INTwork}/$self->{path}/$dirname; \\ |
614 |
< |
\$(MAKE) BINMODE=true LatestBuildFile=$ENV{LOCALTOP}/$ENV{INTwork}/$self{path}/$dirname/BuildFile.mk workdir=\$(workdir)/$dirname -f \$(TOOL_HOME)/basics.mk datestamp \$\*; \\ |
615 |
< |
fi |
616 |
< |
|
617 |
< |
endef |
618 |
< |
|
619 |
< |
bin_$$hashref{'name'}_%:: dummy |
620 |
< |
\@\$(stepdown2_$$hashref{'name'}) |
621 |
< |
|
622 |
< |
$$hashref{'name'}_%:: dummy |
623 |
< |
\@\$(stepdown_$$hashref{'name'}) |
624 |
< |
|
625 |
< |
help bin bin_debug bin_debug_local bin_insure bin_Insure clean $$hashref{'name'}:: dummy |
626 |
< |
\@\$(stepdown_$$hashref{'name'}) |
627 |
< |
|
628 |
< |
binfiles+=$$hashref{'file'} |
629 |
< |
locbinfiles+=$dirname/$$hashref{'file'} |
630 |
< |
endif |
631 |
< |
|
632 |
< |
|
633 |
< |
ENDTEXT |
634 |
< |
|
635 |
< |
|
636 |
< |
# the binary specifics makefile |
637 |
< |
print binGNUmakefile "include ".$self->{currentenv}."\n"; |
638 |
< |
print binGNUmakefile "VPATH+=$ENV{LOCALTOP}/$self{path}\n"; |
639 |
< |
|
640 |
< |
# alias for bin_Insure |
641 |
< |
print binGNUmakefile <<ENDTEXT; |
642 |
< |
|
643 |
< |
bin_insure:bin_Insure |
644 |
< |
ifdef MAKETARGET_bin_insure |
645 |
< |
MAKETARGET_$$hashref{name}_Insure=1 |
646 |
< |
endif |
647 |
< |
|
648 |
< |
# debuggging target |
649 |
< |
$$hashref{'name'}_echo_% :: echo_% |
650 |
< |
|
651 |
< |
# help targets |
652 |
< |
help:: |
653 |
< |
\t\@echo Targets For $$hashref{'name'} |
654 |
< |
\t\@echo ------------------------------------- |
655 |
< |
\t\@echo $$hashref{'name'} - default build |
656 |
< |
\t\@echo bin_$$hashref{'name'}_clean - executable specific cleaning |
657 |
< |
ENDTEXT |
658 |
< |
|
659 |
< |
# Make generic rules for each type |
660 |
< |
$targettypes={ |
661 |
< |
"bin" => 'o', |
662 |
< |
"bin_debug" => 'd', |
663 |
< |
"bin_debug_local" => 'l_d', |
664 |
< |
"bin_Insure" => 'Insure' |
665 |
< |
}; |
666 |
< |
# |
667 |
< |
foreach $target ( keys %$targettypes ) { |
668 |
< |
print binGNUmakefile <<ENDTEXT; |
669 |
< |
|
670 |
< |
# Type $target specifics |
671 |
< |
ifdef MAKETARGET_$target |
672 |
< |
MAKETARGET_$$hashref{name}_$$targettypes{$target}=1 |
673 |
< |
endif |
674 |
< |
$target ::$$hashref{name}_$$targettypes{$target} |
675 |
< |
|
676 |
< |
bintargets+=$$hashref{name}_$$targettypes{$target} |
677 |
< |
help:: |
678 |
< |
\t\@echo $$hashref{name}_$$targettypes{$target} |
679 |
< |
clean:: |
680 |
< |
\t\@if [ -f \$(binarystore)/$$hashref{name}_$$targettypes{$target} ]; then \\ |
681 |
< |
\techo Removing \$(binarystore)/$$hashref{name}; \\ |
682 |
< |
\trm \$(binarystore)/$$hashref{name}_$$targettypes{$target}; \\ |
683 |
< |
\tfi |
684 |
< |
|
685 |
< |
ENDTEXT |
686 |
< |
($objectname=$$hashref{file})=~s/\..*/_$$targettypes{$target}\.o/; |
687 |
< |
${"objectname_$$targettypes{$target}"}=$objectname; |
688 |
< |
print binGNUmakefile "$objectname:$$hashref{name}.dep\n"; |
689 |
< |
} # end loop |
690 |
< |
|
691 |
< |
print binGNUmakefile "$$hashref{name}_Insure.exe:.psrc\n"; |
692 |
< |
print binGNUmakefile "$$hashref{name}_d.exe:$objectname_d\n"; |
693 |
< |
print binGNUmakefile "\t\$(CClinkCmdDebug)\n"; |
694 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
695 |
< |
print binGNUmakefile "$$hashref{name}_l_d.exe:$objectname_d\n"; |
696 |
< |
print binGNUmakefile "\t\$(CClinkCmdDebugLocal)\n"; |
697 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
698 |
< |
print binGNUmakefile "$$hashref{name}_Insure.exe:$objectname_Insure\n"; |
699 |
< |
print binGNUmakefile "\t\$(CClinkCmdInsure)\n"; |
700 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
701 |
< |
print binGNUmakefile "$$hashref{name}_o.exe:$objectname_o\n"; |
702 |
< |
print binGNUmakefile "\t\$(CClinkCmd)\n"; |
703 |
< |
print binGNUmakefile "\t\@\$(SCRAMPERL) \$(SCRAM_HOME)/src/scramdatestamp \$\@\.ds \$\@ \$\^\n"; |
704 |
< |
print binGNUmakefile "$$hashref{name}.dep:$$hashref{file}\n"; |
705 |
< |
print binGNUmakefile "-include $$hashref{name}.dep\n"; |
706 |
< |
print binGNUmakefile <<ENDTEXT; |
707 |
< |
clean:: |
708 |
< |
\t\@if [ -f \$(binarystore)/$$hashref{name} ]; then \\ |
709 |
< |
\techo Removing \$(binarystore)/$$hashref{name}; \\ |
710 |
< |
\trm \$(binarystore)/$$hashref{name}; \\ |
711 |
< |
\tfi |
712 |
< |
|
713 |
< |
$$hashref{name}_d.exe:\$(libslocal_d) |
714 |
< |
$$hashref{name}_o.exe:\$(libslocal) |
715 |
< |
ifdef MCCABE_DATA_DIR |
716 |
< |
$$hashref{name}_mccabe.exe: \$(libslocal_d) \$(MCCABE_DATA_DIR)/mccabeinstr/instplus.cpp |
717 |
< |
endif |
718 |
< |
$$hashref{name}_Insure.exe:\$(libslocal_I) |
719 |
< |
$$hashref{name}_d:$$hashref{name}_d.exe |
720 |
< |
\@cp $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
721 |
< |
$$hashref{name}_l_d:$$hashref{name}_l_d.exe |
722 |
< |
\@cp $$hashref{name}_l_d.exe \$(binarystore)/$$hashref{name} |
723 |
< |
$$hashref{name}_Insure:$$hashref{name}_Insure.exe |
724 |
< |
\@cp $$hashref{name}_Insure.exe \$(binarystore)/$$hashref{name}_Insure |
725 |
< |
$$hashref{name}:$$hashref{name}_d.exe |
726 |
< |
\@mv $$hashref{name}_d.exe \$(binarystore)/$$hashref{name} |
727 |
< |
$$hashref{name}_o:$$hashref{name}_o.exe |
728 |
< |
\@mv $$hashref{name}_o.exe \$(binarystore)/$$hashref{name} |
729 |
< |
binfiles+=$$hashref{file} |
730 |
< |
ENDTEXT |
731 |
< |
} |
732 |
< |
close binGNUmakefile; |
733 |
< |
} |
734 |
< |
|
735 |
< |
sub External_StartTag { |
736 |
< |
my $self=shift; |
737 |
< |
my $name=shift; |
738 |
< |
my $hashref=shift; |
739 |
< |
|
740 |
< |
my $tool; |
741 |
< |
if ( $self->{Arch} ) { |
742 |
< |
$self->{switch}->checktag($name,$hashref,'ref'); |
743 |
< |
|
744 |
< |
# -- oo toolbox stuff |
745 |
< |
# - get the appropriate tool object |
746 |
< |
$$hashref{'ref'}=~tr[A-Z][a-z]; |
747 |
< |
if ( ! exists $$hashref{'version'} ) { |
748 |
< |
$tool=$self->{toolbox}->gettool($$hashref{'ref'}); |
749 |
< |
} |
750 |
< |
else { |
751 |
< |
$tool=$self->{toolbox}->gettool($$hashref{'ref'},$$hashref{'version'}); |
752 |
< |
} |
753 |
< |
if ( ! defined $tool ) { |
754 |
< |
$self->{switch}->parseerror("Unknown Tool Specified (" |
755 |
< |
.$$hashref{'ref'}.")"); |
756 |
< |
} |
757 |
< |
|
758 |
< |
# -- old fashioned GNUmakefile stuff |
759 |
< |
print GNUmakefile $$hashref{'ref'}; |
760 |
< |
if ( defined $$hashref{'version'} ) { |
761 |
< |
print GNUmakefile "_V_".$$hashref{'version'}; |
762 |
< |
} |
763 |
< |
print GNUmakefile "=true\n"; |
764 |
< |
|
765 |
< |
# -- Sub system also specified? |
766 |
< |
if ( exists $$hashref{'use'} ) { |
767 |
< |
# -- look for a buildfile |
768 |
< |
my @paths=$tool->getfeature("INCLUDE"); |
769 |
< |
my $file=""; |
770 |
< |
my ($path,$testfile); |
771 |
< |
foreach $path ( @paths ) { |
772 |
< |
$testfile=$path."/".$$hashref{'use'}."/BuildFile" ; |
773 |
< |
if ( -f $testfile ) { |
774 |
< |
$file=$testfile; |
775 |
< |
$self->_pushremoteproject($path); |
776 |
< |
} |
777 |
< |
} |
778 |
< |
if ( $file eq "" ) { |
779 |
< |
$self->{switch}->parseerror("Unable to find SubSystem $testfile"); |
780 |
< |
} |
781 |
< |
$self->ParseBuildFile_Export($file); |
782 |
< |
$self->_popremoteproject(); |
17 |
> |
sub new() |
18 |
> |
############################################################### |
19 |
> |
# new # |
20 |
> |
############################################################### |
21 |
> |
# modified : Wed Dec 3 19:03:22 2003 / SFA # |
22 |
> |
# params : # |
23 |
> |
# : # |
24 |
> |
# function : # |
25 |
> |
# : # |
26 |
> |
############################################################### |
27 |
> |
{ |
28 |
> |
my $proto=shift; |
29 |
> |
my $class=ref($proto) || $proto; |
30 |
> |
$self={}; |
31 |
> |
bless $self,$class; |
32 |
> |
$self->{DEPENDENCIES} = {}; |
33 |
> |
$self->{content} = {}; |
34 |
> |
$self->{scramdoc}=ActiveDoc::SimpleDoc->new(); |
35 |
> |
$self->{scramdoc}->newparse("builder",__PACKAGE__,'Subs',shift); |
36 |
> |
$self->{archs}=[]; |
37 |
> |
$self->{archflag}=1; |
38 |
> |
return $self; |
39 |
> |
} |
40 |
> |
|
41 |
> |
sub parse() |
42 |
> |
{ |
43 |
> |
my $self=shift; |
44 |
> |
my ($filename)=@_; |
45 |
> |
my $fhead='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><doc type="BuildSystem::BuildFile" version="1.0">'; |
46 |
> |
my $ftail='</doc>'; |
47 |
> |
$self->{scramdoc}->filetoparse($filename); |
48 |
> |
$self->{scramdoc}->parse("builder",$fhead,$ftail); |
49 |
> |
# We're done with the SimpleDoc object so delete it: |
50 |
> |
delete $self->{scramdoc}; |
51 |
> |
} |
52 |
> |
|
53 |
> |
sub classpath() |
54 |
> |
{ |
55 |
> |
my ($object,$name,%attributes)=@_; |
56 |
> |
# The getter part: |
57 |
> |
if (ref($object) eq __PACKAGE__) |
58 |
> |
{ |
59 |
> |
return $self->{content}->{CLASSPATH}; |
60 |
> |
} |
61 |
> |
if (!$self->{archflag}){return;} |
62 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{CLASSPATH}}, $attributes{'path'}) |
63 |
> |
: push(@{$self->{content}->{CLASSPATH}}, $attributes{'path'}); |
64 |
> |
} |
65 |
> |
|
66 |
> |
sub productstore() |
67 |
> |
{ |
68 |
> |
my ($object,$name,%attributes)=@_; |
69 |
> |
# The getter part: |
70 |
> |
if (ref($object) eq __PACKAGE__) |
71 |
> |
{ |
72 |
> |
# Return an array of ProductStore hashes: |
73 |
> |
return $self->{content}->{PRODUCTSTORE}; |
74 |
> |
} |
75 |
> |
if (!$self->{archflag}){return;} |
76 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{PRODUCTSTORE}}, \%attributes) |
77 |
> |
: push(@{$self->{content}->{PRODUCTSTORE}}, \%attributes) ; |
78 |
> |
} |
79 |
> |
|
80 |
> |
sub include() |
81 |
> |
{ |
82 |
> |
my $self=shift; |
83 |
> |
# Return an array of required includes: |
84 |
> |
return $self->{content}->{INCLUDE}; |
85 |
> |
} |
86 |
> |
|
87 |
> |
sub include_path() |
88 |
> |
{ |
89 |
> |
my ($object,$name,%attributes)=@_; |
90 |
> |
if (!$self->{archflag}){return;} |
91 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{INCLUDE}}, $attributes{'path'}) |
92 |
> |
: push(@{$self->{content}->{INCLUDE}}, $attributes{'path'}); |
93 |
> |
} |
94 |
> |
|
95 |
> |
sub use() |
96 |
> |
{ |
97 |
> |
my $object=shift; |
98 |
> |
# The getter part: |
99 |
> |
if (ref($object) eq __PACKAGE__) |
100 |
> |
{ |
101 |
> |
# Add or return uses (package deps): |
102 |
> |
@_ ? push(@{$self->{content}->{USE}},@_) |
103 |
> |
: @{$self->{content}->{USE}}; |
104 |
> |
} |
105 |
> |
else |
106 |
> |
{ |
107 |
> |
if (!$self->{archflag}){return;} |
108 |
> |
my ($name,%attributes)=@_; |
109 |
> |
$self->{DEPENDENCIES}->{$attributes{'name'}} = 1; |
110 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{USE}}, $attributes{'name'}) |
111 |
> |
: push(@{$self->{content}->{USE}}, $attributes{'name'}); |
112 |
> |
} |
113 |
> |
} |
114 |
> |
|
115 |
> |
sub architecture() |
116 |
> |
{ |
117 |
> |
my ($object,$name,%attributes)=@_; |
118 |
> |
my $flag=$self->{archflag}; |
119 |
> |
push @{$self->{archs}},$flag; |
120 |
> |
my $arch=$attributes{name}; |
121 |
> |
if (($flag) && ($ENV{SCRAM_ARCH}!~/$arch/)){$self->{archflag}=0;} |
122 |
> |
} |
123 |
> |
|
124 |
> |
sub architecture_() |
125 |
> |
{ |
126 |
> |
my ($object,$name,%attributes)=@_; |
127 |
> |
$self->{archflag}=pop @{$self->{archs}}; |
128 |
> |
} |
129 |
> |
|
130 |
> |
sub export() |
131 |
> |
{ |
132 |
> |
my ($object,$name,%attributes)=@_; |
133 |
> |
if (!$self->{archflag}){return;} |
134 |
> |
$self->pushlevel(); # Set nested to 1; |
135 |
> |
} |
136 |
> |
|
137 |
> |
sub export_() |
138 |
> |
{ |
139 |
> |
my ($object,$name,%attributes)=@_; |
140 |
> |
if (!$self->{archflag}){return;} |
141 |
> |
$self->{content}->{EXPORT} = $self->{tagcontent}; |
142 |
> |
$self->poplevel(); |
143 |
> |
} |
144 |
> |
|
145 |
> |
sub lib() |
146 |
> |
{ |
147 |
> |
my ($object,$name,%attributes)=@_; |
148 |
> |
# The getter part: |
149 |
> |
if (ref($object) eq __PACKAGE__) |
150 |
> |
{ |
151 |
> |
# Return an array of required libs: |
152 |
> |
return $self->{content}->{LIB}; |
153 |
> |
} |
154 |
> |
if (!$self->{archflag}){return;} |
155 |
> |
my $libname; |
156 |
> |
|
157 |
> |
if (exists($attributes{'position'})) |
158 |
> |
{ |
159 |
> |
if ($attributes{'position'} eq 'first') |
160 |
> |
{ |
161 |
> |
$libname = "F:".$attributes{'name'}; |
162 |
|
} |
163 |
< |
} |
164 |
< |
} |
165 |
< |
|
166 |
< |
sub Group_start { |
167 |
< |
my $self=shift; |
168 |
< |
my $name=shift; |
169 |
< |
my $hashref=shift; |
170 |
< |
|
171 |
< |
$self->{switch}->checktag($name, $hashref, 'name'); |
172 |
< |
if ( $self->{Arch} ) { |
173 |
< |
print GNUmakefile "GROUP_".$$hashref{'name'}; |
174 |
< |
if ( defined $$hashref{'version'} ) { |
175 |
< |
print GNUmakefile "_V_".$$hashref{'version'}; |
176 |
< |
} |
177 |
< |
print GNUmakefile "=true\n"; |
178 |
< |
} |
179 |
< |
} |
180 |
< |
|
181 |
< |
sub Use_start { |
182 |
< |
my $self=shift; |
183 |
< |
my $name=shift; |
184 |
< |
my $hashref=shift; |
185 |
< |
my $filename; |
186 |
< |
use Utilities::SCRAMUtils; |
187 |
< |
|
188 |
< |
$self->{switch}->checktag($name, $hashref, "name"); |
189 |
< |
if ( $self->{Arch} ) { |
190 |
< |
if ( exists $$hashref{'group'} ) { |
191 |
< |
print GNUmakefile "GROUP_".$$hashref{'group'}."=true\n"; |
192 |
< |
} |
193 |
< |
if ( ! defined $self->{remoteproject} ) { |
194 |
< |
$filename=SCRAMUtils::checkfile( |
195 |
< |
"/$ENV{INTsrc}/$$hashref{name}/BuildFile"); |
196 |
< |
# -- force a dependency check if local |
197 |
< |
if ( $filename=~/^$self->{localtop}/ ) { |
198 |
< |
$self->{Builder}->BuildDir($ENV{INTsrc}."/".$$hashref{'name'}); |
199 |
< |
} |
200 |
< |
} |
201 |
< |
else { |
202 |
< |
$filename=$self->{remoteproject}."/$$hashref{name}/BuildFile"; |
203 |
< |
print "trying $filename\n"; |
204 |
< |
if ( ! -f $filename ) { $filename=""; }; |
205 |
< |
} |
206 |
< |
if ( $filename ne "" ) { |
207 |
< |
$self->ParseBuildFile_Export( $filename ); |
208 |
< |
} |
209 |
< |
else { |
210 |
< |
$self->{switch}->parseerror("Unable to detect Appropriate ". |
211 |
< |
"decription file for <$name name=".$$hashref{name}.">"); |
212 |
< |
} |
213 |
< |
} |
214 |
< |
} |
215 |
< |
|
216 |
< |
# List association groups between <AssociateGroup> tags |
217 |
< |
# seperated by newlines or spaces |
218 |
< |
sub AssociateGroup { |
219 |
< |
my $self=shift; |
220 |
< |
my $name=shift; |
221 |
< |
my $string=shift; |
222 |
< |
my $word; |
223 |
< |
|
224 |
< |
if ( $self->{Arch} ) { |
225 |
< |
foreach $word ( (split /\s/, $string) ){ |
226 |
< |
chomp $word; |
227 |
< |
next if /^#/; |
228 |
< |
if ( $word=~/none/ ) { |
229 |
< |
$self->{ignore}=1; |
230 |
< |
} |
231 |
< |
} |
232 |
< |
} |
233 |
< |
} |
234 |
< |
|
235 |
< |
sub Arch_Start { |
236 |
< |
my $self=shift; |
858 |
< |
my $name=shift; |
859 |
< |
my $hashref=shift; |
860 |
< |
|
861 |
< |
$self->{switch}->checktag($name, $hashref,'name'); |
862 |
< |
( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1) |
863 |
< |
: ($self->{Arch}=0); |
864 |
< |
push @{$self->{ARCHBLOCK}}, $self->{Arch}; |
865 |
< |
} |
866 |
< |
|
867 |
< |
sub Arch_End { |
868 |
< |
my $self=shift; |
869 |
< |
my $name=shift; |
870 |
< |
|
871 |
< |
pop @{$self->{ARCHBLOCK}}; |
872 |
< |
$self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}]; |
873 |
< |
} |
874 |
< |
|
875 |
< |
# Split up the Class Block String into a useable array |
876 |
< |
sub _CutBlock { |
877 |
< |
my $self=shift; |
878 |
< |
my $string= shift @_; |
879 |
< |
@BlockClassA = split /\//, $string; |
880 |
< |
} |
881 |
< |
|
882 |
< |
sub OutToMakefile { |
883 |
< |
my $self=shift; |
884 |
< |
my $name=shift; |
885 |
< |
my @vars=@_; |
886 |
< |
|
887 |
< |
if ( $self->{Arch} ) { |
888 |
< |
print GNUmakefile @vars; |
889 |
< |
} |
890 |
< |
} |
891 |
< |
|
892 |
< |
sub OutToScreen { |
893 |
< |
my $name=shift; |
894 |
< |
my @vars=@_; |
895 |
< |
|
896 |
< |
if ( $self->{Arch} ) { |
897 |
< |
print @vars; |
898 |
< |
} |
899 |
< |
} |
900 |
< |
sub setBlockClassPath { |
901 |
< |
my $self=shift; |
902 |
< |
my $name=shift; |
903 |
< |
my $hashref=shift; |
904 |
< |
|
905 |
< |
$self->{switch}->checktag($name, $hashref, 'path'); |
906 |
< |
$self->{BlockClassPath}=$self->{BlockClassPath}.":".$$hashref{path}; |
907 |
< |
$self->_CutBlock($$hashref{path}); |
908 |
< |
} |
909 |
< |
|
910 |
< |
sub BlockClassPath { |
911 |
< |
my $self=shift; |
912 |
< |
return $self->{BlockClassPath}; |
913 |
< |
} |
914 |
< |
|
915 |
< |
sub export_start_export { |
916 |
< |
my $self=shift; |
917 |
< |
my $name=shift; |
918 |
< |
my $hashref=shift; |
919 |
< |
|
920 |
< |
$self->{switch}->opengroup("__export"); |
921 |
< |
} |
922 |
< |
|
923 |
< |
sub export_start { |
924 |
< |
my $self=shift; |
925 |
< |
my $name=shift; |
926 |
< |
my $hashref=shift; |
927 |
< |
|
928 |
< |
$self->{switch}->opengroup("__export"); |
929 |
< |
if ( exists $$hashref{autoexport} ) { |
930 |
< |
print GNUmakefile "scram_autoexport=".$$hashref{autoexport}."\n"; |
931 |
< |
if ( $$hashref{autoexport}=~/true/ ) { |
932 |
< |
$self->{switch}->allowgroup("__export","makebuild"); |
933 |
< |
} |
934 |
< |
else { |
935 |
< |
$self->{switch}->disallowgroup("__export","makebuild"); |
936 |
< |
} |
937 |
< |
} |
938 |
< |
# -- allow default setting from other makefiles |
939 |
< |
print GNUmakefile "ifeq (\$(scram_autoexport),true)\n"; |
940 |
< |
} |
941 |
< |
|
942 |
< |
sub export_end_export { |
943 |
< |
my $self=shift; |
944 |
< |
$self->{switch}->closegroup("__export"); |
945 |
< |
} |
946 |
< |
|
947 |
< |
sub export_end { |
948 |
< |
my $self=shift; |
949 |
< |
$self->{switch}->closegroup("__export"); |
950 |
< |
print GNUmakefile "endif\n"; |
951 |
< |
} |
952 |
< |
|
953 |
< |
# |
954 |
< |
# Standard lib tag |
955 |
< |
# |
956 |
< |
sub lib_start { |
957 |
< |
my $self=shift; |
958 |
< |
my $name=shift; |
959 |
< |
my $hashref=shift; |
960 |
< |
|
961 |
< |
$self->{switch}->checktag($name, $hashref, 'name'); |
962 |
< |
if ( $self->{Arch} ) { |
963 |
< |
print GNUmakefile "lib+=$$hashref{name}\n"; |
964 |
< |
} |
965 |
< |
} |
163 |
> |
else |
164 |
> |
{ |
165 |
> |
# There was a position entry but it didn't make sense: |
166 |
> |
$libname = $attributes{'name'}; |
167 |
> |
} |
168 |
> |
} |
169 |
> |
else |
170 |
> |
{ |
171 |
> |
$libname = $attributes{'name'}; |
172 |
> |
} |
173 |
> |
# We have a libname, add it to the list: |
174 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{LIB}}, $libname) |
175 |
> |
: push(@{$self->{content}->{LIB}}, $libname); |
176 |
> |
} |
177 |
> |
|
178 |
> |
sub makefile() |
179 |
> |
{ |
180 |
> |
my ($object,$name,%attributes)=@_; |
181 |
> |
# The getter part: |
182 |
> |
if (ref($object) eq __PACKAGE__) |
183 |
> |
{ |
184 |
> |
return $self->{content}->{MAKEFILE}; |
185 |
> |
} |
186 |
> |
} |
187 |
> |
|
188 |
> |
sub makefile_() |
189 |
> |
{ |
190 |
> |
my ($object,$name,$cdata)=@_; |
191 |
> |
if (!$self->{archflag}){return;} |
192 |
> |
$self->{nested} == 1 ? push(@{$self->{tagcontent}->{MAKEFILE}}, join("\n",@$cdata)) |
193 |
> |
: push(@{$self->{content}->{MAKEFILE}}, join("\n",@$cdata)); |
194 |
> |
} |
195 |
> |
|
196 |
> |
sub flags() |
197 |
> |
{ |
198 |
> |
my ($object,$name,%attributes)=@_; |
199 |
> |
# The getter part: |
200 |
> |
if (ref($object) eq __PACKAGE__) |
201 |
> |
{ |
202 |
> |
# Return an array of ProductStore hashes: |
203 |
> |
return $self->{content}->{FLAGS}; |
204 |
> |
} |
205 |
> |
if (!$self->{archflag}){return;} |
206 |
> |
# Extract the flag name and its value: |
207 |
> |
my ($flagname,$flagvaluestring) = each %attributes; |
208 |
> |
$flagname =~ tr/[a-z]/[A-Z]/; # Keep flag name uppercase |
209 |
> |
chomp($flagvaluestring); |
210 |
> |
my @flagvalues = ( $flagvaluestring ); |
211 |
> |
# Is current tag within another tag block? |
212 |
> |
if ($self->{nested} == 1) |
213 |
> |
{ |
214 |
> |
# Check to see if the current flag name is already stored in the hash. If so, |
215 |
> |
# just add the new values to the array of flag values: |
216 |
> |
if (exists ($self->{tagcontent}->{FLAGS}->{$flagname})) |
217 |
> |
{ |
218 |
> |
push(@{$self->{tagcontent}->{FLAGS}->{$flagname}},@flagvalues); |
219 |
> |
} |
220 |
> |
else |
221 |
> |
{ |
222 |
> |
$self->{tagcontent}->{FLAGS}->{$flagname} = [ @flagvalues ]; |
223 |
> |
} |
224 |
> |
} |
225 |
> |
else |
226 |
> |
{ |
227 |
> |
if (exists ($self->{content}->{FLAGS}->{$flagname})) |
228 |
> |
{ |
229 |
> |
push(@{$self->{content}->{FLAGS}->{$flagname}},@flagvalues); |
230 |
> |
} |
231 |
> |
else |
232 |
> |
{ |
233 |
> |
$self->{content}->{FLAGS}->{$flagname} = [ @flagvalues ]; |
234 |
> |
} |
235 |
> |
} |
236 |
> |
} |
237 |
|
|
238 |
< |
# |
239 |
< |
# libtype specification |
240 |
< |
# |
241 |
< |
sub LibType_Start { |
242 |
< |
my $self=shift; |
243 |
< |
my $name=shift; |
244 |
< |
my $hashref=shift; |
245 |
< |
|
246 |
< |
if ( $self->{Arch} ) { |
247 |
< |
if ( defined $self->{libtype_conext} ) { |
248 |
< |
$self->{switch}->parseerror("<$name> tag cannot be specified". |
249 |
< |
" without a </$name> tag to close previous context"); |
250 |
< |
} |
251 |
< |
else { |
252 |
< |
$self->{libtype_conext}=1; |
253 |
< |
$self->{switch}->checktag($name, $hashref, 'type'); |
254 |
< |
|
255 |
< |
print GNUmakefile "# Specify Library Type\n"; |
256 |
< |
print GNUmakefile "DefaultLibsOff=yes\n"; |
257 |
< |
if ( $$hashref{'type'}=~/^archive/i ) { |
258 |
< |
print GNUmakefile "LibArchive=true\n"; |
259 |
< |
} |
260 |
< |
elsif ($$hashref{'type'}=~/debug_archive/i ) { |
261 |
< |
print GNUmakefile "LibDebugArchive=true\n"; |
262 |
< |
} |
263 |
< |
elsif ($$hashref{'type'}=~/debug_shared/i ) { |
264 |
< |
print GNUmakefile "LibDebugShared=true\n"; |
265 |
< |
} |
266 |
< |
elsif ($$hashref{'type'}=~/shared/i ) { |
267 |
< |
print GNUmakefile 'LibShared=true'."\n"; |
268 |
< |
} |
269 |
< |
print GNUmakefile "\n"; |
270 |
< |
} |
271 |
< |
} |
272 |
< |
} |
273 |
< |
|
274 |
< |
sub LibType_text { |
275 |
< |
my $self=shift; |
276 |
< |
my $name=shift; |
277 |
< |
my $string=shift; |
278 |
< |
|
279 |
< |
if ( $self->{Arch} ) { |
280 |
< |
$string=~s/\n/ /g; |
281 |
< |
print GNUmakefile "libmsg::\n\t\@echo Library info: "; |
282 |
< |
print GNUmakefile $string; |
283 |
< |
print GNUmakefile "\n"; |
284 |
< |
} |
285 |
< |
} |
286 |
< |
|
287 |
< |
sub LibType_end { |
288 |
< |
my $self=shift; |
289 |
< |
my $name=shift; |
290 |
< |
|
291 |
< |
undef $self->{libtype_conext}; |
292 |
< |
} |
293 |
< |
|
294 |
< |
sub Environment_start { |
295 |
< |
my $self=shift; |
296 |
< |
my $name=shift; |
297 |
< |
my $hashref=shift; |
298 |
< |
|
299 |
< |
if ( $self->{Arch} ) { |
300 |
< |
$self->{envnum}++; |
301 |
< |
|
302 |
< |
# open a new Environment File |
303 |
< |
my $envfile=$self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_". |
304 |
< |
$self->{envnum}.".mk"; |
305 |
< |
use FileHandle; |
306 |
< |
my $fh=FileHandle->new(); |
307 |
< |
open ($fh,">$envfile") or die "Unable to open file $envfile \n$!\n"; |
308 |
< |
push @{$self->{filehandlestack}}, $fh; |
309 |
< |
*GNUmakefile=$fh; |
310 |
< |
|
311 |
< |
# include the approprate environment file |
312 |
< |
if ( $self->{envlevel} == 0 ) { |
313 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
314 |
< |
$self->{path}."/BuildFile.mk\n"; |
315 |
< |
} |
316 |
< |
else { |
317 |
< |
print GNUmakefile "include $self->{localtop}/$ENV{INTwork}/". |
318 |
< |
$self->{path}."/Env_".$self->{Envlevels}[$self->{envlevel}].".mk\n"; |
319 |
< |
} |
320 |
< |
$self->{envlevel}++; |
321 |
< |
$self->{Envlevels}[$self->{envlevel}]=$self->{envnum}; |
322 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/Env_$self->{envnum}.mk"; |
323 |
< |
} |
324 |
< |
} |
325 |
< |
|
326 |
< |
sub Environment_end { |
327 |
< |
my $self=shift; |
328 |
< |
my $fd; |
329 |
< |
|
330 |
< |
if ( $self->{Arch} ) { |
331 |
< |
$self->{envlevel}--; |
332 |
< |
if ( $self->{envlevel} < 0 ) { |
333 |
< |
print "Too many </Environent> Tags on $self->{switch}->line()\n"; |
334 |
< |
exit 1; |
335 |
< |
} |
336 |
< |
close GNUmakefile; |
337 |
< |
# restore the last filehandle |
338 |
< |
$fd=pop @{$self->{filehandlestack}}; |
339 |
< |
close $fd; |
340 |
< |
*GNUmakefile=$self->{filehandlestack}[$#{$self->{filehandlestack}}]; |
341 |
< |
if ( $self->{envlevel} < 1 ) { |
342 |
< |
$self->{currentenv}="$self->{localtop}/$ENV{INTwork}/$self->{path}/". |
343 |
< |
"BuildFile.mk"; |
344 |
< |
} |
345 |
< |
else { |
346 |
< |
$self->{currentenv}= |
347 |
< |
$self->{localtop}."/$ENV{INTwork}/$self->{path}/Env_". |
348 |
< |
$self->{Envlevels}[$self->{envlevel}]; |
349 |
< |
} |
350 |
< |
} |
351 |
< |
} |
352 |
< |
|
353 |
< |
sub Store_start { |
354 |
< |
my $self=shift; |
355 |
< |
my $name=shift; |
356 |
< |
my $hashref=shift; |
357 |
< |
|
358 |
< |
if ( $self->{Arch} ) { |
359 |
< |
$self->{switch}->checktag( $name, $hashref, 'name' ); |
360 |
< |
|
361 |
< |
# -- store creation |
362 |
< |
my $dir=$$hashref{'name'}; |
363 |
< |
AddDir::adddir($self->{localtop}."/".$dir); |
364 |
< |
if ( exists $$hashref{'type'} ) { |
365 |
< |
# -- architecture specific store |
366 |
< |
if ( $$hashref{'type'}=~/^arch/i ) { |
367 |
< |
$dir=$dir."/".$ENV{SCRAM_ARCH}; |
368 |
< |
AddDir::adddir($self->{localtop}."/".$dir); |
369 |
< |
} |
370 |
< |
else { |
371 |
< |
$self->parseerror("Unknown type in <$name> tag"); |
372 |
< |
} |
373 |
< |
} |
374 |
< |
|
375 |
< |
# -- set make variables for the store |
376 |
< |
print GNUmakefile "SCRAMSTORENAME_".$$hashref{'name'}.":=".$dir."\n"; |
377 |
< |
print GNUmakefile "SCRAMSTORE_".$$hashref{'name'}.":=". |
378 |
< |
$self->{localtop}."/".$dir."\n"; |
379 |
< |
print GNUmakefile "VPATH+=".$self->{localtop} |
380 |
< |
."/".$dir.":".$self->{releasetop}."/".$dir."\n"; |
381 |
< |
} |
382 |
< |
} |
238 |
> |
sub allflags() |
239 |
> |
{ |
240 |
> |
my $self=shift; |
241 |
> |
# Return hash data for flags: |
242 |
> |
return $self->{content}->{FLAGS}; |
243 |
> |
} |
244 |
> |
|
245 |
> |
sub bin() |
246 |
> |
{ |
247 |
> |
my ($object,$name,%attributes) = @_; |
248 |
> |
if (!$self->{archflag}){return;} |
249 |
> |
$self->pushlevel(\%attributes);# Set nested to 1; |
250 |
> |
} |
251 |
> |
|
252 |
> |
sub bin_() |
253 |
> |
{ |
254 |
> |
my ($object,$name,%attributes) = @_; |
255 |
> |
if (!$self->{archflag}){return;} |
256 |
> |
# Need unique name for the binary (always use name of product). Either use "name" |
257 |
> |
# given, or use "file" value minus the ending: |
258 |
> |
if (exists ($self->{id}->{'name'})) |
259 |
> |
{ |
260 |
> |
$name = $self->{id}->{'name'}; |
261 |
> |
} |
262 |
> |
else |
263 |
> |
{ |
264 |
> |
($name) = ($self->{id}->{'file'} =~ /(.*)?\..*$/); |
265 |
> |
} |
266 |
> |
|
267 |
> |
# Store the data: |
268 |
> |
$self->productcollector($name,'bin','BIN'); |
269 |
> |
$self->poplevel(); |
270 |
> |
} |
271 |
> |
|
272 |
> |
sub library() |
273 |
> |
{ |
274 |
> |
my ($object,$name,%attributes) = @_; |
275 |
> |
if (!$self->{archflag}){return;} |
276 |
> |
$self->pushlevel(\%attributes);# Set nested to 1; |
277 |
> |
} |
278 |
> |
|
279 |
> |
sub library_() |
280 |
> |
{ |
281 |
> |
my ($object,$name,%attributes) = @_; |
282 |
> |
if (!$self->{archflag}){return;} |
283 |
> |
# Need unique name for the library (always use name of product). Either use "name" |
284 |
> |
# given, or use "file" value minus the ending: |
285 |
> |
if (exists ($self->{id}->{'name'})) |
286 |
> |
{ |
287 |
> |
$name = $self->{id}->{'name'}; |
288 |
> |
} |
289 |
> |
else |
290 |
> |
{ |
291 |
> |
($name) = ($self->{id}->{'file'} =~ /(.*)?\..*$/); |
292 |
> |
} |
293 |
> |
|
294 |
> |
# Store the data: |
295 |
> |
$self->productcollector($name,'lib','LIBRARY'); |
296 |
> |
$self->poplevel(); |
297 |
> |
} |
298 |
> |
|
299 |
> |
sub productcollector() |
300 |
> |
{ |
301 |
> |
my $self=shift; |
302 |
> |
my ($name,$typeshort,$typefull)=@_; |
303 |
> |
# Create a new Product object for storage of data: |
304 |
> |
use BuildSystem::Product; |
305 |
> |
my $product = BuildSystem::Product->new(); |
306 |
> |
# Store the name: |
307 |
> |
$product->name($name); |
308 |
> |
$product->type($typeshort); |
309 |
> |
# Store the files. Take the BuildFile path as the initial path for |
310 |
> |
# expanding source file globs: |
311 |
> |
$product->_files($self->{id}->{'file'},[ $self->{scramdoc}->filetoparse() ]); |
312 |
> |
# Store the data content: |
313 |
> |
$product->_data($self->{tagcontent}); |
314 |
> |
# And store in a hash (all build products in same place): |
315 |
> |
$self->{content}->{BUILDPRODUCTS}->{$typefull}->{$name} = $product; |
316 |
> |
} |
317 |
> |
|
318 |
> |
sub pushlevel |
319 |
> |
{ |
320 |
> |
my $self = shift; |
321 |
> |
my ($info)=@_; |
322 |
> |
|
323 |
> |
$self->{id} = $info if (defined $info); |
324 |
> |
$self->{nested} = 1; |
325 |
> |
$self->{tagcontent}={}; |
326 |
> |
} |
327 |
> |
|
328 |
> |
sub poplevel |
329 |
> |
{ |
330 |
> |
my $self = shift; |
331 |
> |
delete $self->{id}; |
332 |
> |
delete $self->{nested}; |
333 |
> |
delete $self->{tagcontent}; |
334 |
> |
} |
335 |
> |
|
336 |
> |
sub dependencies() |
337 |
> |
{ |
338 |
> |
my $self=shift; |
339 |
> |
# Make a copy of the variable so that |
340 |
> |
# we don't have a DEPENDENCIES entry in RAWDATA: |
341 |
> |
my %DEPS=%{$self->{DEPENDENCIES}}; |
342 |
> |
delete $self->{DEPENDENCIES}; |
343 |
> |
return \%DEPS; |
344 |
> |
} |
345 |
> |
|
346 |
> |
sub skippeddirs() |
347 |
> |
{ |
348 |
> |
my $self=shift; |
349 |
> |
my ($here)=@_; |
350 |
> |
my $skipped; |
351 |
> |
|
352 |
> |
if ($self->{content}->{SKIPPEDDIRS}->[0] == 1) |
353 |
> |
{ |
354 |
> |
$skipped = [ @{$self->{content}->{SKIPPEDDIRS}} ]; |
355 |
> |
delete $self->{content}->{SKIPPEDDIRS}; |
356 |
> |
} |
357 |
> |
|
358 |
> |
delete $self->{content}->{SKIPPEDDIRS}; |
359 |
> |
return $skipped; |
360 |
> |
} |
361 |
> |
|
362 |
> |
sub hasexport() |
363 |
> |
{ |
364 |
> |
my $self=shift; |
365 |
> |
# Check to see if there is a valid export block: |
366 |
> |
my $nkeys = $self->exporteddatatypes(); |
367 |
> |
$nkeys > 0 ? return 1 : return 0; |
368 |
> |
} |
369 |
> |
|
370 |
> |
sub has() |
371 |
> |
{ |
372 |
> |
my $self=shift; |
373 |
> |
my ($datatype)=@_; |
374 |
> |
(exists ($self->{content}->{$datatype})) ? return 1 : return 0; |
375 |
> |
} |
376 |
> |
|
377 |
> |
sub exported() |
378 |
> |
{ |
379 |
> |
my $self=shift; |
380 |
> |
# Return a hash. Keys are type of data provided: |
381 |
> |
return ($self->{content}->{EXPORT}); |
382 |
> |
} |
383 |
> |
|
384 |
> |
sub exporteddatatypes() |
385 |
> |
{ |
386 |
> |
my $self=shift; |
387 |
> |
# Return exported data types: |
388 |
> |
return keys %{$self->{content}->{EXPORT}}; |
389 |
> |
} |
390 |
> |
|
391 |
> |
sub buildproducts() |
392 |
> |
{ |
393 |
> |
my $self=shift; |
394 |
> |
# Returns hash of build products and their data: |
395 |
> |
return $self->{content}->{BUILDPRODUCTS}; |
396 |
> |
} |
397 |
> |
|
398 |
> |
sub values() |
399 |
> |
{ |
400 |
> |
my $self=shift; |
401 |
> |
my ($type)=@_; |
402 |
> |
# Get a list of values from known types |
403 |
> |
return $self->{content}->{BUILDPRODUCTS}->{$type}; |
404 |
> |
} |
405 |
> |
|
406 |
> |
sub basic_tags() |
407 |
> |
{ |
408 |
> |
my $self=shift; |
409 |
> |
my $datatags=[]; |
410 |
> |
my $buildtags=[ qw(BIN LIBRARY BUILDPRODUCTS) ]; |
411 |
> |
my $skiptags=[ qw(ARCH EXPORT USE CLASSPATH) ]; |
412 |
> |
my $otherskiptags=[ qw( SKIPPEDDIRS ) ]; |
413 |
> |
my @all_skip_tags; |
414 |
> |
|
415 |
> |
push(@all_skip_tags,@$skiptags,@$buildtags,@$otherskiptags); |
416 |
> |
|
417 |
> |
foreach my $t (keys %{$self->{content}}) |
418 |
> |
{ |
419 |
> |
push(@$datatags,$t),if (! grep($t eq $_, @all_skip_tags)); |
420 |
> |
} |
421 |
> |
return @{$datatags}; |
422 |
> |
} |
423 |
> |
|
424 |
> |
sub clean() |
425 |
> |
{ |
426 |
> |
my $self=shift; |
427 |
> |
my (@tags) = @_; |
428 |
> |
|
429 |
> |
# Delete some useless entries: |
430 |
> |
delete $self->{simpledoc}; |
431 |
> |
delete $self->{id}; |
432 |
> |
delete $self->{tagcontent}; |
433 |
> |
delete $self->{nested}; |
434 |
> |
|
435 |
> |
delete $self->{DEPENDENCIES}; |
436 |
> |
|
437 |
> |
map |
438 |
> |
{ |
439 |
> |
delete $self->{content}->{$_} if (exists($self->{content}->{$_})); |
440 |
> |
} @tags; |
441 |
> |
|
442 |
> |
return $self; |
443 |
> |
} |
444 |
> |
|
445 |
> |
sub AUTOLOAD() |
446 |
> |
{ |
447 |
> |
my ($xmlparser,$name,%attributes)=@_; |
448 |
> |
return if $AUTOLOAD =~ /::DESTROY$/; |
449 |
> |
my $name=$AUTOLOAD; |
450 |
> |
$name =~ s/.*://; |
451 |
> |
} |
452 |
|
|
453 |
+ |
1; |