imgtools/buildrom/tools/buildrom.pm
changeset 651 0d0d83e3702d
parent 647 53d1ab72f5bc
--- a/imgtools/buildrom/tools/buildrom.pm	Fri Oct 08 21:02:28 2010 +0100
+++ b/imgtools/buildrom/tools/buildrom.pm	Fri Oct 22 12:33:01 2010 +0100
@@ -267,6 +267,7 @@
 my $sourceline;
 #my $line;
 my %romfiles;
+my %ibyfiles; # record the iby file for each ROM file
 
 # To handle BINARY_SELECTION_ORDER macro.
 my $firstDIR;
@@ -768,6 +769,7 @@
 	{
 		# Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file.
 		my @hrhMacros = &get_variantmacrolist;	
+		die("No system-wide #defines??!") if (scalar @hrhMacros == 0);	
 		if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros)
 		{
 			$enforceFeatureManager = 1;
@@ -1649,9 +1651,19 @@
  			{
  				if(AddDllDataInfo($new_line))
  				{
- 					$line = "REM $line";
+ 					# wasn't a valid line, so comment it out
+					$line = "REM $line";
+ 				}
+ 				else
+ 				{
+ 					# valid patchdata command, retain it for final processing (during reformat_line!)
+ 					# In expectation that it will be OK later, emit the "REM processed" marker here
+ 					push @obydata, "REM processed $line";
+ 					push @obydata, reassert_sourceline();
  				}
  			}
+ 			push @obydata, "$line";
+ 			next;
 		}
 
 		if($line =~ /^\s*FEATURE\s*(.*)/i || $line =~ /^\s*EXCLUDE_FEATURE\s*(.*)/i)
@@ -1814,7 +1826,7 @@
 		if ($line=~/^\s*ROMBUILD_OPTION\s+(\S+)\s*/i)
 		{
 			$rombuildOptions{$1} = 1;
-			push @obydata, "REM handled $line";
+			push @obydata, "REM processed $line";
 			next;
 		}
 		
@@ -1823,7 +1835,7 @@
 			if(!($spiset)) {
 				$createspi=1;
 			}
-			push @obydata, "REM handled $line";
+			push @obydata, "REM processed $line";
 			next;
 		}
 		
@@ -2320,7 +2332,7 @@
 			# push this line into the currently selected partition
 			my $partition=$currentpartition[-1];
 			push @$partition, $modifiedLine;
-			$line="REM handled $line";
+			next; 
 		}
 		elsif ($line =~ /^\s*SPI_POSITION/i)
 		{
@@ -2467,6 +2479,7 @@
 		      $errors++ if ($strict);
 		    }
 
+		    push @newobydata, "REM expanded $line";
 		    if ($spidatahide)
 		    {
 			push @newobydata, "hide=$fileRomDir\/$pluginFileName\n";
@@ -2957,6 +2970,7 @@
 	# Parse the feature database XML file
 	if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict))
 	{
+	  print STDERR "Failed to parse feature database XML file $featureXml\n";
 		$featureXml = undef;
 		exit(1) if($strict);
 	}
@@ -3117,6 +3131,7 @@
 				my $targetfeaturefile = $thisdir.$featurefilearray[$i][$j]{cfgfile};
 				if (!(&featuresutil::createFeatureFile($i,$j,$targetfeaturefile,\@featureslist,$featuremanager))) 
 				{
+					print STDERR "Failed to create Feature file $targetfeaturefile\n";
 					$featurefilearray[$i][$j]{cfgfile}= undef;
 					exit(1) if($strict);					
 				}
@@ -3731,7 +3746,7 @@
 		my $scalarSize;
 		
 		if(!defined $DllDataMap{$patchdlldatamap_key}->{dstpath}){
-			print_source_error(" File $romfilename has not been included into ROM image");
+			print_source_error(" Bad patchdata statement: $romfilename has not been included into ROM image");
 			$errors++ if($strict);
 			$line = "REM $line\n";
 			return $line;
@@ -3892,7 +3907,7 @@
 			&& $romfile !~ /^sys\/bin/i)
 		{
 			# for multilinguify 'alias'es (generally resource files) 'MustBeSysBin' should not be enforced.
-			if(defined($multiLinguifyAlias{$pcfile})) {
+			if($romfile =~ /\.rsc$/i || defined($multiLinguifyAlias{$pcfile})) {
 				return $line;  
 			}
 
@@ -3931,6 +3946,7 @@
 		}
 	}
 	$romfiles{$romfile} = $variant.$pcfile;
+	$ibyfiles{$romfile} = $sourcefile;
 	return "$type$variant=$pcfile \t\"$romfile\"$tail\n";
 }
 
@@ -4327,10 +4343,11 @@
 			}
 	
 			my @sources = split /\n/,$romfiles{$file};
-			printf DIRFILE "%-40s\t%s\n", $file, shift @sources;
+			my @ibyfiles = split /\n/,$ibyfiles{$file};
+			printf DIRFILE "%-40s\t%s\t%s\n", $file, shift @sources, shift @ibyfiles;
 			while (@sources)
 			{
-				printf DIRFILE "%39s+\t%s\n", "", shift @sources;
+				printf DIRFILE "%39s+\t%s\t%s\n", "", shift @sources, shift @ibyfiles;
 			}
 		}
 		close DIRFILE;
@@ -4734,7 +4751,7 @@
 			$newVal = $1;
 		}
 		else{
- 			print "ERROR: Invalid patchable value at \"$line\"\n";
+ 			print_source_error("ERROR: Invalid patchable value : $line");
  			$errors++ if($strict);
  			return 1;
 		}