cross-plat-dev-utils/build_target.pl
changeset 6 787612182dd0
parent 2 39c28ec933dd
child 10 b2a53d442fd6
equal deleted inserted replaced
5:301c3edbdaa1 6:787612182dd0
    13 # If not found will try in ./group.
    13 # If not found will try in ./group.
    14 # $1 is the build dir for the desired target relative to $EPOCROOT/build/
    14 # $1 is the build dir for the desired target relative to $EPOCROOT/build/
    15 # $@ is shifted to get optional additional arguments to the sbs command
    15 # $@ is shifted to get optional additional arguments to the sbs command
    16 
    16 
    17 use strict;
    17 use strict;
    18 use set_epocroot;
    18 use places;
    19 use File::Spec;
    19 use File::Spec;
    20 use Cwd; 
    20 use Cwd; 
    21 
    21 
    22 if (@ARGV) {
    22 if (@ARGV) {
    23     if (grep(/$ARGV[0]/,("-h","--help"))) {
    23     if (grep(/$ARGV[0]/,("-h","--help"))) {
    28         print "Looks for BLD.INF or bld.inf in the component directory\n";
    28         print "Looks for BLD.INF or bld.inf in the component directory\n";
    29         print "In not found will try in ./group\n";                        
    29         print "In not found will try in ./group\n";                        
    30         exit 0;
    30         exit 0;
    31     }         
    31     }         
    32 }
    32 }
    33 set_epocroot();
    33 my $epocroot = get_epocroot();
    34 my $epocroot = $ENV{'EPOCROOT'};
    34 my $sbs_home = get_sbs_home();
    35 my $sbs_home = $ENV{'SBS_HOME'};
       
    36 unless($sbs_home) {
       
    37     $sbs_home = File::Spec->catfile("$epocroot","build","sbsv2","raptor");
       
    38     $ENV{'SBS_HOME'} = $sbs_home;
       
    39 }
       
    40 my $build_dir = shift;
    35 my $build_dir = shift;
    41 $build_dir = File::Spec->catfile("$epocroot","build","$build_dir");
    36 $build_dir = File::Spec->catfile(get_pkg_dir(),"$build_dir");
    42 if (! -d $build_dir) {
    37 if (! -d $build_dir) {
    43     die "*** Error: \"$build_dir\" not found ***\n";
    38     die "*** Error: \"$build_dir\" not found ***\n";
    44 }
    39 }
    45 chdir "$build_dir" or die $!;
    40 chdir "$build_dir" or die $!;
    46 if (! -f "BLD.INF" and ! -f "bld.inf") {
    41 if (! -f "BLD.INF" and ! -f "bld.inf") {
    55 	$bld_inf = "bld.inf";
    50 	$bld_inf = "bld.inf";
    56 }
    51 }
    57 if (! -f $bld_inf) {
    52 if (! -f $bld_inf) {
    58 	die "*** Error: No bld.inf in \"$build_dir\" ***";
    53 	die "*** Error: No bld.inf in \"$build_dir\" ***";
    59 }
    54 }
    60 my $log_stem = File::Spec->catfile("$epocroot","epoc32","build","Makefile");
    55 my $log_stem = File::Spec->catfile(get_epoc32_dir(),"build","Makefile");
    61 my $log_pattern = "$log_stem\.\*\.log"; 
    56 my $log_pattern = "$log_stem\.\*\.log"; 
    62 my $raptor = File::Spec->catfile("$sbs_home","bin","sbs");
    57 my $raptor = File::Spec->catfile(get_sbs_home(),"bin","sbs");
    63 my $cmd = "$raptor -c tools2 -b $bld_inf @ARGV";
    58 my $cmd = "$raptor -c tools2 -b $bld_inf @ARGV";
    64 print ">>> Executing: $cmd\n";
    59 print ">>> Executing: $cmd\n";
    65 my $rc = system($cmd) >> 8;
    60 my $rc = system($cmd) >> 8;
    66 my @build_logs = glob($log_pattern);
    61 my @build_logs = glob($log_pattern);
    67 open BLDLOG, "<$build_logs[-1]" or die $!;
    62 open BLDLOG, "<$build_logs[-1]" or die $!;