releasing/cbrtools/perl/mbld
author lorewang
Thu, 11 Nov 2010 12:38:08 +0800
changeset 678 f0d451bf8bcb
parent 602 3145852acc89
permissions -rw-r--r--
update version info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
#!perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use FindBin;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use lib "$FindBin::Bin";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use Cwd;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use Getopt::Long;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use Utils;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
$|++;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
# Globals
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
my @bldData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
my $descriptionFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
my $keepGoing = '';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $saveSpace = '';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $clean = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
my $outFile = "stdout.log";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
my $errorFile = "stderr.log";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
my $startTime;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
my $cwd;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
ParseDescriptionFile();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
Init();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
DoBuild();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
End();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
# Subs
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
  GetOptions('c+' => \$clean, 'h' => \$help, 'k' => \$keepGoing, 's' => \$saveSpace, 'v+' => \$verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    Usage(0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
  $descriptionFile = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  unless ($descriptionFile and $#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
  Utils::PrintDeathMessage($exitCode, "\nUsage: mbld [options] <build_description_file>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
-h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
-c  clean (-cc reallyclean)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
-k  keep going
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
-s  save space
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
-v  verbose output (-vv very verbose)\n");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
sub Init {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
  $startTime = time;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
  unlink $outFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
  unlink $errorFile;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
  $cwd = cwd();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
  $outFile = "$cwd\\$outFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  $errorFile = "$cwd\\$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
sub ParseDescriptionFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
  open(FILE, $descriptionFile) or die "Error: Unable to open \"$descriptionFile\" for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  my $line = -1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
  while (<FILE>) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
    ++$line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
    # Remove line feed, white space and comments.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
    chomp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
    s/^\s*$//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
    s/#.*//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
    if ($_ eq '') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
      # Nothing left.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    (my @words) = split /\s+/;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    if ($#words < 2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
      print "Warning: Not enough arguments on line $line\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
      next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
    my $bldEntry;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
    $bldEntry->{name} = shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    $bldEntry->{bldInf} = shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
    if ($words[0] eq 'test') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
      $bldEntry->{test} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
      shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
      if ($#words == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
	print "Warning: Not enough arguments on line $line\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
	next;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
    $bldEntry->{plat} = shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
    if ($#words >= 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
      if ($words[0] =~ /(udeb)|(urel)/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
	$bldEntry->{var} = shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
    if ($#words >= 0) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
      $bldEntry->{mmp} = shift @words;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
    push (@bldData, $bldEntry);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
  close FILE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
sub DoBuild {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
  if ($clean == 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
    DoPlatformVariantCommand('clean:       ', 'abld', 'clean');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
  elsif ($clean == 2) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
    DoPlatformVariantCommand('reallyclean: ', 'abld', 'reallyclean');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
  DoBldMake();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
  DoExport();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
  DoPlatformCommand('makefile:    ', 'abld', 'makefile');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
  DoPlatformCommand('library:     ', 'abld', 'library');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
  DoPlatformVariantCommand('resource:    ', 'abld', 'resource');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
  my $target = 'target';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
  if ($keepGoing) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
    $target .= " $keepGoing";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
  if ($saveSpace) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
    $target .= " $saveSpace";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
  DoPlatformVariantCommand('target:      ', 'abld', $target);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
  DoPlatformVariantCommand('final:       ', 'abld', 'final');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
  DoPlatformVariantCommand('check:       ', 'abld -check', 'build');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
sub DoBldMake {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
  my %built;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
  foreach my $bldEntry (@bldData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
    unless (exists $built{lc($bldEntry->{bldInf})}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
      DoPrint("bldfiles:     $bldEntry->{name} [bldmake bldfiles]");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
      chdir $bldEntry->{bldInf} or die "Error: Couldn't change working directory to \"$bldEntry->{bldInf}\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
      system "bldmake bldfiles >>$outFile 2>>$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
      chdir $cwd or die "Error: Couldn't change working directory to \"$cwd\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
      $built{lc($bldEntry->{bldInf})} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
sub DoExport {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
  my %built;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
  my %builtTest;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
  foreach my $bldEntry (@bldData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
    if (exists $bldEntry->{test}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
      unless (exists $builtTest{lc($bldEntry->{bldInf})}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
	DoPrint("export:       $bldEntry->{name} [abld test export]");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
	chdir $bldEntry->{bldInf} or die "Error: Couldn't change working directory to \"$bldEntry->{bldInf}\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
	system "abld test export >>$outFile 2>>$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
	chdir $cwd or die "Error: Couldn't change working directory to \"$cwd\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
	$builtTest{lc($bldEntry->{bldInf})} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
      unless (exists $built{lc($bldEntry->{bldInf})}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
	DoPrint("export:       $bldEntry->{name} [abld export]");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
	chdir $bldEntry->{bldInf} or die "Error: Couldn't change working directory to \"$bldEntry->{bldInf}\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
	system "abld export >>$outFile 2>>$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
	chdir $cwd or die "Error: Couldn't change working directory to \"$cwd\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
	$built{lc($bldEntry->{bldInf})} = 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
      }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
sub DoPlatformCommand {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
  my $prompt = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
  my $command1 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
  my $command2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
  foreach my $bldEntry (@bldData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    my $command = $command1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
    if (exists $bldEntry->{test}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
      $command .= ' test';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
    $command .= " $command2 $bldEntry->{plat}";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
    if (exists $bldEntry->{mmp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
      $command .= " $bldEntry->{mmp}";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
    DoPrint("$prompt $bldEntry->{name} [$command]");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
    chdir $bldEntry->{bldInf} or die "Error: Couldn't change working directory to \"$bldEntry->{bldInf}\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
    system "$command >>$outFile 2>>$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
    chdir $cwd or die "Error: Couldn't change working directory to \"$cwd\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
sub DoPlatformVariantCommand {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
  my $prompt = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
  my $command1 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
  my $command2 = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
  foreach my $bldEntry (@bldData) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
    my $command = $command1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
    if (exists $bldEntry->{test}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
      $command .= ' test';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
    $command .= " $command2 $bldEntry->{plat}";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
    if (exists $bldEntry->{var}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
      $command .= " $bldEntry->{var}";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
    if (exists $bldEntry->{mmp}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
      $command .= " $bldEntry->{mmp}";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
    DoPrint("$prompt $bldEntry->{name} [$command]");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
    chdir $bldEntry->{bldInf} or die "Error: Couldn't change working directory to \"$bldEntry->{bldInf}\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
    system "$command >>$outFile 2>>$errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
    chdir $cwd or die "Error: Couldn't change working directory to \"$cwd\": $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
sub DoPrint {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
  my $prompt = $_[0];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
  print "$prompt\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
  system "echo === $prompt >> $outFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
  system "echo === $prompt >> $errorFile";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
sub End {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
  my $finishTime = time;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
  my $total = $finishTime - $startTime;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
  my $seconds =  $total % 60;$total = ($total - $seconds) / 60;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
  my $minutes =  $total % 60;$total = ($total - $minutes) / 60;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
  my $hours =  $total % 24;$total = ($total - $hours)   / 24;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
  print "\nTotal build time: $hours:$minutes:$seconds\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
  chdir $cwd;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
MBld - Builds multiple components in one pass.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
  mbld [options] <build_description_file>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
  -h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
  -c  clean (-cc reallyclean)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
  -k  keep going
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
  -s  save space
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
  -v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
The build description file must be plain text with lines of the following format (one for each item that you want to be built):
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
 component_name  bld_inf_path  [test] platform [variant] [mmp_file]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
=over 4
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
=item component_name
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
A string that can be used to identify the component being built - can be anything you like provided it's a single word.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
=item bld_inf_path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
An absolute or relative path to where the componen't F<bld.inf> file can be found.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
=item test
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
An optional argument to allow test code to be built.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
=item platform
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
The build plaform required (e.g. C<WINS>, C<WINCW>, C<THUMB>, C<ARM4>, C<ARMI>, C<MISA> etc).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
=item variant
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
The build variant (either C<udeb> or C<urel>). If ommitted, both variants will be built.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
=item mmp_file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
A optional argument that allows specific projects (defined by an F<mmp> file) to be built. If ommitted all F<mmp> files will be used.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
=back
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
The build output is captured to a pair of log files; F<stdout.log> for C<STDOUT> and F<stderr.log> for C<STDERR>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
 Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
=cut