diff -r 7c11c3d8d025 -r 44b0e894b7ab deprecated/buildtools/buildsystemtools/GenBuild.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deprecated/buildtools/buildsystemtools/GenBuild.pm Wed Oct 27 19:35:19 2010 +0800 @@ -0,0 +1,850 @@ +# Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +package GenBuild; + +use strict; +use Carp; +use IO::File; + +# Global Variables + +my @components; +my $iIDCount; +my $iStageCount; +my %arm_assplist; +my $savespace=""; +my $keepgoing=""; +my $build_tools=0; +my $build_cwtools=0; +my $build_winc=0; +my $build_thumb=0; +my $build_armi=0; +my $build_arm4=0; +my $build_arm4t=0; +my $build_armv5=0; +my $build_arm3=0; +my $epoc_only=0; +my $build_winscw=0; +my $build_wins=0; +my $build_bootstrap; +my $basename; +my $iSourceDir; +my $build_UREL=0; +my $build_UDEB=0; +my $build_urel_udeb=""; +my $build_test=0; + +my ($XMLFileH, $gLogFileH); + +my ($gHiResTimer) = 0; #Flag - true (1) if HiRes Timer module available + +# Check if HiRes Timer is available +if (eval "require Time::HiRes;") { + $gHiResTimer = 1; +} else { + print "Cannot load HiResTimer Module\n"; +} + +sub Start +{ + my ($iDataSource, $iDataOutput, $iLogFile, $iSourceDir, $iReallyClean, $iClean) = @_; + + # Copied from genbuild.pl + + # Check for EPOCROOT + # It's not used directly by GENBUILD, but this is a good early stage at which + # to discover that it hasn't been set... + + my $epocroot = $ENV{EPOCROOT}; + die "ERROR: Must set the EPOCROOT environment variable\n" if (!defined($epocroot)); + $epocroot =~ s-/-\\-go; # for those working with UNIX shells + die "ERROR: EPOCROOT must not include a drive letter\n" if ($epocroot =~ /^.:/); + die "ERROR: EPOCROOT must be an absolute path without a drive letter\n" if ($epocroot !~ /^\\/); + die "ERROR: EPOCROOT must not be a UNC path\n" if ($epocroot =~ /^\\\\/); + die "ERROR: EPOCROOT must end with a backslash\n" if ($epocroot !~ /\\$/); + die "ERROR: EPOCROOT must specify an existing directory\n" if (!-d $epocroot); + + # $iSourceDir must en in a \ + # Add a \ if not present + if ($iSourceDir !~ /\\$/) + { + $iSourceDir .= "\\"; + } + + for(my $j = 0; $j < scalar(@$iDataSource); $j++) + { + $GenBuild::basename .= " " if ($j > 0); + my ($iFile) = @$iDataSource[$j] =~ m#.*([\\\/]|^)(.*?)\..*$#; + $GenBuild::basename .= @$iDataSource[$j]; + } + + #Set the global iSourceDir + $GenBuild::iSourceDir = $iSourceDir; + + # Open Log file + $GenBuild::gLogFileH = IO::File->new("> $iLogFile") + or croak "Couldn't open $iLogFile for writing: $!\n"; + + print $GenBuild::gLogFileH "===-------------------------------------------------\n"; + print $GenBuild::gLogFileH "=== Genxml\n"; + print $GenBuild::gLogFileH "===-------------------------------------------------\n"; + print $GenBuild::gLogFileH "=== Genxml started ".localtime()."\n"; + + for(my $j = 0; $j < scalar(@$iDataSource); $j++) + { + # Open DataSource + my ($iFile) = @$iDataSource[$j]; + open FILE, "< $iFile" or die "Can't read $iFile\n"; + + print $GenBuild::gLogFileH "=== Genxml == $iFile\n"; + + print $GenBuild::gLogFileH "-- Genxml\n"; + # Add the per command start timestamp + print $GenBuild::gLogFileH "++ Started at ".localtime()."\n"; + # Add the per command start HiRes timestamp if available + if ($gHiResTimer == 1) + { + print $GenBuild::gLogFileH "+++ HiRes Start ".Time::HiRes::time()."\n"; + } else { + # Add the HiRes timer missing statement + print $GenBuild::gLogFileH "+++ HiRes Time Unavailable\n"; + } + + # Process the Txt file in the same manner as the old genbuild + # Note: + # Additional options 'udeb', 'urel' and 'test' were added in response + # to a specific request, but are not otherwise supported by Symbian. + while () + { + s/\s*#.*$//; + s/^\s*//; + my $line = lc $_; + if ($line =~ /^$/) + { + next; + } + + if ($line =~ /