1 |
williamc |
1.1 |
#
|
2 |
|
|
# Build.pm
|
3 |
|
|
#
|
4 |
|
|
# Originally Written by Christopher Williams
|
5 |
|
|
#
|
6 |
|
|
# Description
|
7 |
|
|
#
|
8 |
|
|
# Interface
|
9 |
|
|
# ---------
|
10 |
|
|
# new(ConfigArea) : A new Build object
|
11 |
|
|
# build(dir,[@targets]) : Build relevant target for a given directory
|
12 |
|
|
# dir relative to top. Returns a BuildReport
|
13 |
|
|
|
14 |
|
|
package BuildSystem::Build;
|
15 |
|
|
use BuildSystem::BuildReport;
|
16 |
|
|
use Utilities::Verbose;
|
17 |
|
|
require 5.004;
|
18 |
|
|
@ISA=qw(Utilities::Verbose);
|
19 |
|
|
|
20 |
|
|
sub new {
|
21 |
|
|
my $class=shift;
|
22 |
|
|
my $self={};
|
23 |
williamc |
1.2 |
bless $self, $class;
|
24 |
williamc |
1.1 |
$self->{area}=shift;
|
25 |
williamc |
1.2 |
$self->{area}->copyenv(\%ENV);
|
26 |
|
|
$ENV{LOCALTOP}=$self->{area}->location();
|
27 |
|
|
$self->verbose("LOCALTOP=".$ENV{LOCALTOP});
|
28 |
williamc |
1.1 |
return $self;
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
sub build {
|
32 |
|
|
my $self=shift;
|
33 |
|
|
my $dir=shift;
|
34 |
|
|
|
35 |
|
|
# -- set up a report
|
36 |
|
|
my $report=BuildSystem::BuildReport->new();
|
37 |
williamc |
1.2 |
$report->status(1); # set to fail
|
38 |
williamc |
1.1 |
|
39 |
|
|
# -- interface with old system
|
40 |
|
|
my $fulldir=$self->{area}->location()."/".$dir;
|
41 |
|
|
if ( ! -d $fulldir ) {
|
42 |
|
|
$report->error("$fulldir does not exist");
|
43 |
|
|
}
|
44 |
|
|
else {
|
45 |
|
|
chdir $fulldir;
|
46 |
|
|
my $bs=BuildSystem::BuildSetup->new($self->{area});
|
47 |
williamc |
1.2 |
$bs->verbosity(1);
|
48 |
|
|
$self->verbose("Calling build module with $dir, @_");
|
49 |
williamc |
1.1 |
$rv=$bs->BuildSetup($dir,@_);
|
50 |
williamc |
1.2 |
$report->status($rv);
|
51 |
williamc |
1.1 |
}
|
52 |
|
|
return $report;
|
53 |
|
|
}
|