227 |
|
# Make sure that we have this tool in the list of selected tools (just in case this tool was |
228 |
|
# set up by hand afterwards): |
229 |
|
$self->addtoselected($toolname); |
230 |
+ |
|
231 |
+ |
# Check to see if this tool is a compiler. If so, store it. |
232 |
+ |
# Also store the language that this compiler supprots, and a |
233 |
+ |
# compiler name (e.g. gcc323) which, in conjunction with a stem |
234 |
+ |
# architecture name like slc3_ia32_, can be used to build a complete arch string: |
235 |
+ |
if ($store->scram_compiler() == 1) |
236 |
+ |
{ |
237 |
+ |
my @supported_language = $store->flags("SCRAM_LANGUAGE_TYPE"); |
238 |
+ |
my @compilername = $store->flags("SCRAM_COMPILER_NAME"); |
239 |
+ |
$self->scram_compiler($supported_language[0],$toolname,$compilername[0]); |
240 |
+ |
} |
241 |
+ |
|
242 |
|
# Store the ToolData object in the cache: |
243 |
|
$self->storeincache($toolparser->toolname(),$store); |
244 |
|
return $self; |
250 |
|
my ($arealocation, $toolname, $toolversion, $toolurl) = @_; |
251 |
|
my ($urlcache, $url, $filename, $tfname); |
252 |
|
my $toolfile; |
253 |
< |
|
253 |
> |
|
254 |
|
$toolname =~ tr[A-Z][a-z]; |
255 |
|
$toolversion ||= $self->defaultversion($toolname); |
256 |
|
$urlcache=URL::URLcache->new($arealocation."/.SCRAM/cache"); # Download tool cache |
257 |
< |
|
257 |
> |
|
258 |
|
# Check for the downloaded tools cache: |
259 |
|
if (defined($urlcache)) |
260 |
|
{ |
261 |
|
$self->{urlhandler}=URL::URLhandler->new($urlcache); |
262 |
|
} |
263 |
< |
|
263 |
> |
|
264 |
|
$url = $self->toolurls()->{$toolname}; |
265 |
|
$filename = $self->{toolfiledir}."/".$toolname; |
266 |
|
|
284 |
|
{ |
285 |
|
use File::Copy; |
286 |
|
copy($urlv, $filename); |
287 |
+ |
my $mode = 0644; chmod $mode, $filename; |
288 |
|
$toolfile=$filename; |
289 |
|
} |
290 |
|
else |
332 |
|
# Copy the downloaded tool file to InstalledTools directory: |
333 |
|
if ( ! -f $filename ) |
334 |
|
{ |
335 |
< |
$self->verbose("Attempting Download of $url"); |
336 |
< |
# Get file from download cache: |
337 |
< |
($url,$filename)=$self->{urlhandler}->get($url); |
338 |
< |
use File::Copy; |
339 |
< |
$tfname=$self->{toolfiledir}."/".$toolname; |
340 |
< |
copy($filename, $tfname); |
341 |
< |
$toolfile=$tfname; |
335 |
> |
# If the URL is empty, the chances are that this tool was not downloaded to .SCRAM/InstalledTools. |
336 |
> |
# We signal an error and exit: |
337 |
> |
if ($url eq '') |
338 |
> |
{ |
339 |
> |
$::scram->scramerror("$toolname was selected in project requirements but is not in the configuration!"); |
340 |
> |
} |
341 |
> |
else |
342 |
> |
{ |
343 |
> |
# Otherwise, we try to download it: |
344 |
> |
$self->verbose("Attempting Download of $url"); |
345 |
> |
# Get file from download cache: |
346 |
> |
($url,$filename)=$self->{urlhandler}->get($url); |
347 |
> |
use File::Copy; |
348 |
> |
$tfname=$self->{toolfiledir}."/".$toolname; |
349 |
> |
copy($filename, $tfname); |
350 |
> |
my $mode = 0644; chmod $mode, $tfname; |
351 |
> |
$toolfile=$tfname; |
352 |
> |
} |
353 |
|
} |
354 |
|
else |
355 |
|
{ |
538 |
|
return $scram_projects; |
539 |
|
} |
540 |
|
|
541 |
+ |
sub scram_compiler() |
542 |
+ |
{ |
543 |
+ |
my $self=shift; |
544 |
+ |
my ($langtype, $toolname, $compilername)=@_; |
545 |
+ |
|
546 |
+ |
if ($langtype) |
547 |
+ |
{ |
548 |
+ |
# Store the compiler info according to supported |
549 |
+ |
# language types. |
550 |
+ |
# |
551 |
+ |
# ---------------------- e.g C++ cxxcompiler gcc323 |
552 |
+ |
$self->{SCRAM_COMPILER}->{$langtype}=[ $toolname, $compilername ]; |
553 |
+ |
} |
554 |
+ |
else |
555 |
+ |
{ |
556 |
+ |
return $self->{SCRAM_COMPILER}; |
557 |
+ |
} |
558 |
+ |
} |
559 |
+ |
|
560 |
|
1; |