|
1 #!/usr/bin/perl |
|
2 # Copyright (c) 2010 Symbian Foundation Ltd |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of the License "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution. |
|
10 |
|
11 # Script to build a given tools target with Raptor |
|
12 # Will look for BLD.INF or bld.inf in the current directory. |
|
13 # If not found will try in ./group. |
|
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 |
|
16 |
|
17 use strict; |
|
18 use set_epocroot; |
|
19 use File::Spec; |
|
20 use Cwd; |
|
21 |
|
22 if (@ARGV) { |
|
23 if (grep(/$ARGV[0]/,("-h","--help"))) { |
|
24 print "This script builds a target with Raptor\n"; |
|
25 print "Call with \$ARG[0] = the name of a component directory "; |
|
26 print "relative to EPOCROOT/build\n"; |
|
27 print "Subsequent arguments will be passed to Raptor\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"; |
|
30 exit 0; |
|
31 } |
|
32 } |
|
33 set_epocroot(); |
|
34 my $epocroot = $ENV{'EPOCROOT'}; |
|
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; |
|
41 $build_dir = File::Spec->catfile("$epocroot","build","$build_dir"); |
|
42 if (! -d $build_dir) { |
|
43 die "*** Error: \"$build_dir\" not found ***\n"; |
|
44 } |
|
45 chdir "$build_dir" or die $!; |
|
46 if (! -f "BLD.INF" and ! -f "bld.inf") { |
|
47 if ( -d "group") { |
|
48 chdir "group" or die $!; |
|
49 $build_dir = cwd; |
|
50 } |
|
51 } |
|
52 print ">>> Build dir is \"$build_dir\"\n"; |
|
53 my $bld_inf = "BLD.INF"; |
|
54 if (! -f $bld_inf) { |
|
55 $bld_inf = "bld.inf"; |
|
56 } |
|
57 if (! -f $bld_inf) { |
|
58 die "*** Error: No bld.inf in \"$build_dir\" ***"; |
|
59 } |
|
60 my $log_stem = File::Spec->catfile("$epocroot","epoc32","build","Makefile"); |
|
61 my $log_pattern = "$log_stem\.\*\.log"; |
|
62 my $raptor = File::Spec->catfile("$sbs_home","bin","sbs"); |
|
63 my $cmd = "$raptor -c tools2 -b $bld_inf @ARGV"; |
|
64 print ">>> Executing: $cmd\n"; |
|
65 my $rc = system($cmd) >> 8; |
|
66 my @build_logs = glob($log_pattern); |
|
67 open BLDLOG, "<$build_logs[-1]" or die $!; |
|
68 while(<BLDLOG>) { |
|
69 print $_; |
|
70 } |
|
71 close BLDLOG; |
|
72 exit $rc; |
|
73 |
|
74 |