changeset 590 | 360bd6b35136 |
parent 0 | 044383f39525 |
child 607 | 378360dbbdba |
588:c7c26511138f | 590:360bd6b35136 |
---|---|
1 # |
1 # |
2 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 # Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 # All rights reserved. |
3 # All rights reserved. |
4 # This component and the accompanying materials are made available |
4 # This component and the accompanying materials are made available |
5 # under the terms of the License "Eclipse Public License v1.0" |
5 # under the terms of the License "Eclipse Public License v1.0" |
6 # which accompanies this distribution, and is available |
6 # which accompanies this distribution, and is available |
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
56 featurefile_creation_phase |
56 featurefile_creation_phase |
57 processData |
57 processData |
58 create_smrimage |
58 create_smrimage |
59 ); |
59 ); |
60 |
60 |
61 my $useinterpretsis = 1; |
|
62 if ($^O !~ /^MSWin32$/i){ |
|
63 $useinterpretsis = 0; |
|
64 } |
|
61 my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. |
65 my $enforceFeatureManager = 0; # Flag to make Feature Manager mandatory if SYMBIAN_FEATURE_MANAGER macro is defined. |
62 |
66 |
63 my $BuildromMajorVersion = 3 ; |
67 my $BuildromMajorVersion = 3 ; |
64 my $BuildromMinorVersion = 17; |
68 my $BuildromMinorVersion = 24; |
65 my $BuildromPatchVersion = 0; |
69 my $BuildromPatchVersion = 0; |
70 |
|
66 |
71 |
67 sub print_usage |
72 sub print_usage |
68 { |
73 { |
69 |
74 |
70 # Option "-fm" will be supported instead of option "-f|fr" if SYMBIAN_FEATURE_MANAGER macro is defined. |
75 # Option "-fm" will be supported instead of option "-f|fr" if SYMBIAN_FEATURE_MANAGER macro is defined. |
92 and subsequently adjusted by statements in the ROM specification language. |
97 and subsequently adjusted by statements in the ROM specification language. |
93 The final specification is in the subset of the specification language |
98 The final specification is in the subset of the specification language |
94 which is understood directly by ROMBUILD. |
99 which is understood directly by ROMBUILD. |
95 |
100 |
96 Each obyfile parameter specifies a file via a search path: if the |
101 Each obyfile parameter specifies a file via a search path: if the |
97 filename is not matched then buildrom will look in \\epoc32\\rom\\include. |
102 filename is not matched then buildrom will look in \/epoc32\/rom\/include. |
98 |
103 |
99 Buildrom invokes ROMBUILD to generate the ROM image, and produces a |
104 Buildrom invokes ROMBUILD to generate the ROM image, and produces a |
100 number of related files such as the ROM symbol file. The name of the |
105 number of related files such as the ROM symbol file. The name of the |
101 image file is specified directly by the -o option, or determined by |
106 image file is specified directly by the -o option, or determined by |
102 scanning the final specification for the "romname" keyword. If there is |
107 scanning the final specification for the "romname" keyword. If there is |
120 -ccomprmethod -- compression method: none|inflate|bytepair |
125 -ccomprmethod -- compression method: none|inflate|bytepair |
121 -geninc -- generate INC file |
126 -geninc -- generate INC file |
122 -gendep -- generate dependence graph for rom image |
127 -gendep -- generate dependence graph for rom image |
123 -nosymbols -- disable creation of symbol file |
128 -nosymbols -- disable creation of symbol file |
124 -noimage -- disable creation of ROM/ROFS/DataDrive Image |
129 -noimage -- disable creation of ROM/ROFS/DataDrive Image |
125 -fastcompress -- compress files with faster bytepair and tradeoff of compress ratio |
|
126 -j<digit> -- do the main job with <digit> threads |
130 -j<digit> -- do the main job with <digit> threads |
131 -cache -- allow the ROFSBUILD to reuse/generate cached executable files |
|
132 -nocache -- force the ROFSBUILD not to reuse/generate cached executable files |
|
133 -cleancache -- permanently remove all cached executable files |
|
127 -loglevel<level> -- Level of information logging where loglevel is 0,1,2 |
134 -loglevel<level> -- Level of information logging where loglevel is 0,1,2 |
128 0 default level of information |
135 0 default level of information |
129 1 host/ROM filenames, file size and the hidden attribute along with level0 log |
136 1 host/ROM filenames, file size and the hidden attribute along with level0 log |
130 2 E32 file header attributes along with level1 log |
137 2 E32 file header attributes along with level1 log |
131 -z=xxx or -zdrivepath=xxx -- specify a location to create Z drive directory. |
138 -z=xxx or -zdrivepath=xxx -- specify a location to create Z drive directory. |
132 -d=xxx or -datadrivepath=xxx -- specify a location to create data drive directory. |
139 -d=xxx or -datadrivepath=xxx -- specify a location to create data drive directory. |
133 -k or -keepgoing -- enable keepgoing,continue to create the data drive image even |
140 -k or -keepgoing -- enable keepgoing,continue to create the data drive image even |
134 if the non-sis, sis or zdrive image file(s) are missing or corrupt. |
141 if the non-sis, sis or zdrive image file(s) are missing or corrupt; create rom/rofs |
142 image even some oby files missing and/or duplicated definitions in oby files . |
|
135 -r or -retainfolder -- enable retainfolder,would retain pre-existence of z & data drive folder. |
143 -r or -retainfolder -- enable retainfolder,would retain pre-existence of z & data drive folder. |
136 -zdriveimage=xxx -- specify Z drive image (ROM, CORE, ROFS or Ext-ROFS image). |
144 -zdriveimage=xxx -- specify Z drive image (ROM, CORE, ROFS or Ext-ROFS image). |
137 -pfile=xxx -- specify a parameter file for interpretsis to take additional parameters. |
145 -pfile=xxx -- specify a parameter file for interpretsis to take additional parameters. |
138 -argforinterpretsis=xxx -- specify command line argument(s) for interpretsis which will override the |
146 -argforinterpretsis=xxx -- specify command line argument(s) for interpretsis which will override the |
139 parameter file contents. |
147 parameter file contents. |
140 -l=xxx or -logimagecontents=xxx -- extract all stub-sis and SWI certificate store file(s) only |
148 -l=xxx or -logimagecontents=xxx -- extract all stub-sis and SWI certificate store file(s) only |
141 and log all the file(s) that are part of the Z drive image on to a log file. |
149 and log all the file(s) that are part of the Z drive image on to a log file. |
142 -I<directory> -- Use <directory> for the referenced IBY/OBY files |
150 -I<directory> -- Use <directory> for the referenced IBY/OBY files |
143 -argfile=xxx -- specify argument-file name containing list of command-line arguments to buildrom |
151 -argfile=xxx -- specify argument-file name containing list of command-line arguments to buildrom |
144 -lowmem -- use memory-mapped file for image build to reduce physical memory consumption |
152 -lowmem -- use memory-mapped file for image build to reduce physical memory consumption |
153 -chechcase -- check character case of path/name in oby/iby files, |
|
154 the result will be checkcase.log, this option is only valid on windows. |
|
155 -workdir=xxx -- specify a directory to contain generated files. |
|
145 |
156 |
146 Popular -D defines to use include |
157 Popular -D defines to use include |
147 |
158 |
148 -D_DEBUG -- select debug versions of some files |
159 -D_DEBUG -- select debug versions of some files |
149 -D_FULL_DEBUG -- select debug versions of all files |
160 -D_FULL_DEBUG -- select debug versions of all files |
150 -D_ARM4 -- specify the target platform |
161 -D_ARM4 -- specify the target platform |
151 |
162 |
152 -D_EABI=xxxx -- specify target for all files (e.g. ARMV5) |
163 -D_EABI=xxxx -- specify target for all files (e.g. armv5) |
153 -D_KABI=xxxx -- specify the target platform for the Kernel (e.g. ARMV5) |
164 -D_KABI=xxxx -- specify the target platform for the Kernel (e.g. armv5) |
154 |
165 |
155 Other defines may be useful for particular OBY files. |
166 Other defines may be useful for particular OBY files. |
156 |
167 |
157 USAGE_EOF |
168 USAGE_EOF |
158 } |
169 } |
159 |
170 |
160 use strict; |
171 use strict; |
161 my $PerlLibPath; # fully qualified pathname of the directory containing our Perl modules |
172 use romutl; |
162 # establish the path to the Perl libraries |
173 use romosvariant; |
163 $PerlLibPath = $FindBin::Bin; # X:/epoc32/tools |
174 |
164 $PerlLibPath =~ s/\//\\/g; # X:\epoc32\tools |
175 my $PerlEPOCPath = &get_epocroot()."epoc32\/tools\/"; # fully qualified pathname of the directory containing EPOC Perl modules |
165 $PerlLibPath .= "\\"; |
176 |
166 sub ExportDirs ($); |
177 sub ExportDirs ($); |
167 |
|
168 use BPABIutl; # for BPABIutl::BPABIutl_Plat_List |
|
169 |
178 |
170 my $xmlrequired = 0; # assume xml required is false. Used to determine if xml |
179 my $xmlrequired = 0; # assume xml required is false. Used to determine if xml |
171 # modules should be loaded. |
180 # modules should be loaded. |
172 |
181 |
173 use Modload; # To load modules dynamically |
182 use flexmodload; # To load modules dynamically |
174 |
183 |
175 # Work out the relative path to the epoc32 directory |
184 # Work out the relative path to the epoc32 directory |
176 use spitool qw(&createSpi); |
185 use spitool qw(&createSpi); |
177 use Cwd; |
186 use Cwd; |
178 use Pathutl; |
|
179 use E32Variant; |
|
180 use E32Plat; |
|
181 use Genutl; |
|
182 use BPABIutl; # for BPABIutl::BPABIutl_Plat_List |
|
183 use externaltools; #To invoke External Tools |
187 use externaltools; #To invoke External Tools |
188 use File::Basename; |
|
184 |
189 |
185 my @tempfiles; |
190 my @tempfiles; |
186 my $preserve = 0; #flag to indicate if temporary files should be preserved |
191 my $preserve = 0; #flag to indicate if temporary files should be preserved |
187 my $uppath="x"; # will be initialised when first needed |
192 my $uppath="x"; # will be initialised when first needed |
188 |
193 |
189 my $epocroot = $ENV{EPOCROOT}; |
194 my $epocroot = &get_epocroot; |
190 die "ERROR: Must set the EPOCROOT environment variable\n" if (!defined($epocroot)); |
|
191 $epocroot =~ s-/-\\-go; # for those working with UNIX shells |
|
192 die "ERROR: EPOCROOT must not include a drive letter\n" if ($epocroot =~ /^.:/); |
|
193 die "ERROR: EPOCROOT must be an absolute path without a drive letter\n" if ($epocroot !~ /^\\/); |
|
194 die "ERROR: EPOCROOT must not be a UNC path\n" if ($epocroot =~ /^\\\\/); |
|
195 die "ERROR: EPOCROOT must end with a backslash\n" if ($epocroot !~ /\\$/); |
|
196 die "ERROR: EPOCROOT must specify an existing directory\n" if (!-d $epocroot); |
|
197 |
|
198 my $epoc32 = relative_path("${epocroot}epoc32"); |
|
199 $epoc32 =~ s-\\-/-go; |
|
200 |
195 |
201 my @obyfiles; |
196 my @obyfiles; |
202 my $cppargs = "-nostdinc -undef"; |
197 my $cppargs = "-nostdinc -undef"; |
203 my $opt_v = 0; |
198 my $opt_v = 0; |
204 my $opt_o = ""; |
199 my $opt_o = ""; |
221 use constant ALLSECTIONS => 1; # Indicates both paged section and unpaged section will be compressed. |
216 use constant ALLSECTIONS => 1; # Indicates both paged section and unpaged section will be compressed. |
222 use constant PAGEDSECTION => 2; # Indicates only paged section will be compressed. |
217 use constant PAGEDSECTION => 2; # Indicates only paged section will be compressed. |
223 use constant UNPAGEDSECTION => 3; # Indicates only unpaged section will be compressed. |
218 use constant UNPAGEDSECTION => 3; # Indicates only unpaged section will be compressed. |
224 my $opt_compression_type = UNCOMPRESSED; # Leave the ROM image uncompressed by default. |
219 my $opt_compression_type = UNCOMPRESSED; # Leave the ROM image uncompressed by default. |
225 |
220 |
221 #Variables to store cache command line options |
|
222 my $opt_cache = 0; |
|
223 my $opt_nocache = 0; |
|
224 my $opt_cleancache = 0; |
|
225 |
|
226 my $thisdir=cwd; |
226 my $thisdir=cwd; |
227 $thisdir=~s-/-\\-go; # separator from Perl 5.005_02+ is forward slash |
227 $thisdir=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
228 $thisdir=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
228 $thisdir.= "\/" unless $thisdir =~ /\/$/; |
229 $thisdir=~s-^.:\\--o; # remove drive letter and leading backslash |
229 $thisdir=~s-^(.:)?\/--o; # remove drive letter and leading backslash |
230 |
230 |
231 my $rominclude = "$epoc32/rom/include"; |
231 my $rominclude = $epocroot."epoc32\/rom\/include\/"; |
232 $rominclude = &get_epocdrive().$rominclude unless $rominclude =~ /^.:/; |
|
233 $rominclude =~s-\\-\/-g; |
|
234 |
|
232 my %plugintypes; #hash of plugin types and their SPI files' destinations in ROM |
235 my %plugintypes; #hash of plugin types and their SPI files' destinations in ROM |
233 $plugintypes{"ECOM"} = "\\private\\10009d8f\\"; #ECOM SPI files' destination in ROM image |
236 $plugintypes{"ECOM"} = "\/private\/10009d8f\/"; #ECOM SPI files' destination in ROM image |
234 |
237 |
235 my @obydata; |
238 my @obydata; |
236 my @newobydata; |
239 my @newobydata; |
237 my %substitutionData; |
240 my %substitutionData; |
238 my @substitutionOrder; |
241 my @substitutionOrder; |
239 my %languageCodes; |
242 my %languageCodes; |
240 my $defaultLanguageCode; |
243 my $defaultLanguageCode; |
241 my %multiLinguifyAlias; # to by-pass the 'mustbesysbin' option for multilinguify 'alias'es. |
244 my %multiLinguifyAlias; # to by-pass the 'mustbesysbin' option for multilinguify 'alias'es. |
242 my $abiDowngrade; |
245 my $abiDowngrade = ""; |
243 my @binarySelectionOrder; |
246 my @binarySelectionOrder; |
244 my $fromDIR; |
247 my $fromDIR; |
245 my %rombuildOptions = ("-type-safe-link" => 1 ); |
248 my %rombuildOptions = ("-type-safe-link" => 1 ); |
246 my $enforceSysBin = 0; |
249 my $enforceSysBin = 0; |
247 |
250 |
250 my @romimage; |
253 my @romimage; |
251 my $rombasename; |
254 my $rombasename; |
252 |
255 |
253 my $sourcefile; |
256 my $sourcefile; |
254 my $sourceline; |
257 my $sourceline; |
255 my ($line); |
258 #my $line; |
256 my %romfiles; |
259 my %romfiles; |
257 |
260 |
258 # To handle BINARY_SELECTION_ORDER macro. |
261 # To handle BINARY_SELECTION_ORDER macro. |
259 my $firstDIR; |
262 my $firstDIR; |
260 my $binarySelectionOrderFlag = 0; |
263 my $binarySelectionOrderFlag = 0; |
274 my $geninc = ""; |
277 my $geninc = ""; |
275 my $gendep = ""; |
278 my $gendep = ""; |
276 my $nosymbols = ""; |
279 my $nosymbols = ""; |
277 my $noimage = ""; |
280 my $noimage = ""; |
278 my $customizedPlat = undef; |
281 my $customizedPlat = undef; |
279 my $opt_fastcompress = ""; |
|
280 my $opt_jobs= ""; |
282 my $opt_jobs= ""; |
281 |
283 |
282 #Summary of files(both executables and data files) currently includes |
284 #Summary of files(both executables and data files) currently includes |
283 # host and ROM file names, |
285 # host and ROM file names, |
284 # size of the file in ROM |
286 # size of the file in ROM |
289 |
291 |
290 # This option is used to pass -lowmem argument to rombuild/rofsbuild tools |
292 # This option is used to pass -lowmem argument to rombuild/rofsbuild tools |
291 my $lowMem=""; |
293 my $lowMem=""; |
292 |
294 |
293 # Feature Variation modules and data |
295 # Feature Variation modules and data |
294 use featurevariantparser; |
|
295 use featurevariantmap; |
|
296 my %featureVariant; |
296 my %featureVariant; |
297 |
297 |
298 # global variables specific to data drive image generation. |
298 # global variables specific to data drive image generation. |
299 use File::Path; # Module to provide functions to remove or create directories in a convenient way. |
299 use File::Path; # Module to provide functions to remove or create directories in a convenient way. |
300 use File::Copy; # Module to provide functions to copy file(s) from source to destination. |
300 use File::Copy; # Module to provide functions to copy file(s) from source to destination. |
336 my %smrPartitions; |
336 my %smrPartitions; |
337 my %smrNameInfo; |
337 my %smrNameInfo; |
338 my @obeyFileList; |
338 my @obeyFileList; |
339 my $smrNoImageName = 0; |
339 my $smrNoImageName = 0; |
340 my $onlysmrimage = 1; |
340 my $onlysmrimage = 1; |
341 my $checkcase = 0; |
|
342 my $checkcase_platform = ""; |
|
343 my $checkcase_test = 0; |
|
344 my $invokecmddir = ""; |
|
341 |
345 |
342 sub match_obyfile |
346 sub match_obyfile |
343 { |
347 { |
344 my ($obyfile) = @_; |
348 my ($obyfile) = @_; |
345 if (-f $obyfile) |
349 if (-f $obyfile) |
348 return 1; |
352 return 1; |
349 } |
353 } |
350 |
354 |
351 # search for the oby file in the list of include directories |
355 # search for the oby file in the list of include directories |
352 my @otherDirs = ($rominclude); |
356 my @otherDirs = ($rominclude); |
357 push (@otherDirs, $invokecmddir) if ($invokecmddir ne ""); |
|
353 |
358 |
354 if ($featureVariant{'VALID'}) |
359 if ($featureVariant{'VALID'}) |
355 { |
360 { |
356 my $dirRef = $featureVariant{'ROM_INCLUDES'}; |
361 my $dirRef = $featureVariant{'ROM_INCLUDES'}; |
357 |
362 |
358 @otherDirs = @$dirRef if ($dirRef); |
363 @otherDirs = @$dirRef if ($dirRef); |
359 } |
364 } |
360 foreach my $dir (@otherDirs) |
365 foreach my $dir (@otherDirs) |
361 { |
366 { |
367 print "$dir/$obyfile\n" if ($opt_v); |
|
362 if (-f "$dir/$obyfile") |
368 if (-f "$dir/$obyfile") |
363 { |
369 { |
364 push @obyfiles, "$dir/$obyfile"; |
370 push @obyfiles, "$dir/$obyfile"; |
365 return 1; |
371 return 1; |
366 } |
372 } |
430 if($retVal) |
436 if($retVal) |
431 { |
437 { |
432 &datadriveimage::reportError("* Warning could not delete $ZDirloc",$opt_k); |
438 &datadriveimage::reportError("* Warning could not delete $ZDirloc",$opt_k); |
433 } |
439 } |
434 # delete data drive directory if and only if preserve(-p) option is disabled. |
440 # delete data drive directory if and only if preserve(-p) option is disabled. |
435 my $retVal = &deleteDirectory($DataDriveDirloc,$opt_v)if(!($preserve)); |
441 $retVal = &deleteDirectory($DataDriveDirloc,$opt_v)if(!($preserve)); |
436 if($retVal) |
442 if($retVal) |
437 { |
443 { |
438 &datadriveimage::reportError("* Warning could not delete $DataDriveDirloc",$opt_k); |
444 &datadriveimage::reportError("* Warning could not delete $DataDriveDirloc",$opt_k); |
439 } |
445 } |
440 # reset image count to zero. |
446 # reset image count to zero. |
451 |
457 |
452 if (!$preserve) |
458 if (!$preserve) |
453 { |
459 { |
454 foreach my $tempfiles (@tempfiles) |
460 foreach my $tempfiles (@tempfiles) |
455 { |
461 { |
462 print "remove $tempfiles\n" if ($opt_v); |
|
456 unlink "$tempfiles"; |
463 unlink "$tempfiles"; |
457 } |
464 } |
458 } |
465 } |
459 if($rombasename) |
466 if($rombasename) |
460 { |
467 { |
496 if($retVal) |
503 if($retVal) |
497 { |
504 { |
498 exit(1) if(!$opt_k); |
505 exit(1) if(!$opt_k); |
499 } |
506 } |
500 # delete pre-existence of data drive folder, if and only if -r option is not enabled. |
507 # delete pre-existence of data drive folder, if and only if -r option is not enabled. |
501 my $retVal = &datadriveimage::deleteDirectory($DataDriveDirloc,$opt_v) if(!$opt_r); |
508 $retVal = &datadriveimage::deleteDirectory($DataDriveDirloc,$opt_v) if(!$opt_r); |
502 if($retVal) |
509 if($retVal) |
503 { |
510 { |
504 exit(1) if(!$opt_k); |
511 exit(1) if(!$opt_k); |
505 } |
512 } |
506 if($opt_logFile) |
513 if($opt_logFile) |
507 { |
514 { |
508 # clean any pre-existance of log file. |
515 # clean any pre-existance of log file. |
509 unlink($ZDirloc."\\".$imageEntryLogFile); |
516 unlink($ZDirloc."\/".$imageEntryLogFile); |
510 } |
517 } |
511 |
518 |
512 for (my $datadriveidx=0; $datadriveidx < $dataImageCount; $datadriveidx++) |
519 for (my $datadriveidx=0; $datadriveidx < $dataImageCount; $datadriveidx++) |
513 { |
520 { |
514 my $driveIndex = $dataIndexHash{$datadriveidx}; |
521 my $driveIndex = $dataIndexHash{$datadriveidx}; |
529 # check if more than one data drive image needs to be generated. |
536 # check if more than one data drive image needs to be generated. |
530 if( $dataImageCount > 1 ) |
537 if( $dataImageCount > 1 ) |
531 { |
538 { |
532 # if yes, then set the location of prototype data drive folder as |
539 # if yes, then set the location of prototype data drive folder as |
533 # DataDriveDirloc + datadrivename |
540 # DataDriveDirloc + datadrivename |
534 $proDataDriveDirloc = $DataDriveDirloc."\\".$datadrivename; |
541 $proDataDriveDirloc = $DataDriveDirloc."\/".$datadrivename; |
535 } |
542 } |
536 else |
543 else |
537 { |
544 { |
538 # else, then set the location of prototype data drive folder as DataDriveDirloc |
545 # else, then set the location of prototype data drive folder as DataDriveDirloc |
539 $proDataDriveDirloc = $DataDriveDirloc; |
546 $proDataDriveDirloc = $DataDriveDirloc; |
554 { |
561 { |
555 # find out size of the array |
562 # find out size of the array |
556 my $arraysize = scalar(@zDriveImageList); |
563 my $arraysize = scalar(@zDriveImageList); |
557 for( my $i=0; $i < $arraysize; $i++ ) |
564 for( my $i=0; $i < $arraysize; $i++ ) |
558 { |
565 { |
559 $zDriveSisFileLoc = $ZDirloc."\\".$datadrivename; |
566 $zDriveSisFileLoc = $ZDirloc."\/".$datadrivename; |
560 &datadriveimage::invokeReadImage(pop(@zDriveImageList),$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k); |
567 &datadriveimage::invokeReadImage(pop(@zDriveImageList),$zDriveSisFileLoc,$opt_v,$imageEntryLogFile,$opt_k); |
561 } |
568 } |
562 } |
569 } |
563 else |
570 else |
564 { |
571 { |
590 } |
597 } |
591 } |
598 } |
592 } |
599 } |
593 } |
600 } |
594 # invoke INTERPRETSIS tool with z drive folder location. |
601 # invoke INTERPRETSIS tool with z drive folder location. |
595 &datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList)if($sisfilepresent); |
602 if ($useinterpretsis) |
603 { |
|
604 &datadriveimage::invokeInterpretsis( \@sisfilelist,$proDataDriveDirloc,$opt_v,$zDriveSisFileLoc,$paraFile,$opt_k,\@interpretsisOptList)if($sisfilepresent); |
|
605 }else |
|
606 { |
|
607 print "Warning: interpretsis is not ready on linux.\n"; |
|
608 } |
|
596 } |
609 } |
597 |
610 |
598 # create an oby file by traversing through upated prototype data drive directory. |
611 # create an oby file by traversing through upated prototype data drive directory. |
599 &datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist, |
612 &datadriveimage::dumpDatadriveObydata( $proDataDriveDirloc,$datadriveobyfile,$size,\@nonsisFilelist, |
600 \@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v ); |
613 \@renameList,\@aliaslist,\@hideList,\@sisobydata,\@datadrivedata,$opt_k,$opt_v ); |
727 } |
740 } |
728 |
741 |
729 if (!defined $paramFileFlag) |
742 if (!defined $paramFileFlag) |
730 { |
743 { |
731 # Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file. |
744 # Enforce Feature Manager if macro SYMBIAN_FEATURE_MANAGER is defined in the HRH file. |
732 my @hrhMacros = &Variant_GetMacroList; |
745 my @hrhMacros = &get_variantmacrolist; |
733 if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros) |
746 if (grep /^SYMBIAN_FEATURE_MANAGER\s*$/, @hrhMacros) |
734 { |
747 { |
735 $enforceFeatureManager = 1; |
748 $enforceFeatureManager = 1; |
736 } |
749 } |
737 |
750 |
742 { |
755 { |
743 ¶meterFileProcessor($1); |
756 ¶meterFileProcessor($1); |
744 } |
757 } |
745 } |
758 } |
746 } |
759 } |
747 |
760 # first searching argList for keepgoing option |
761 foreach my $arg (@argList) { |
|
762 if ( $arg =~ /^-k$/i || $arg =~ /^-keepgoing$/i ) |
|
763 { |
|
764 $opt_k = 1; |
|
765 next; |
|
766 }elsif ($arg =~ /^-workdir=(.*)/) |
|
767 { |
|
768 my $workdir=$1; |
|
769 if( $workdir =~ m/ / ) |
|
770 { |
|
771 print "* Warning: $workdir contains whitespace, hence the files will be created in default location \n"; |
|
772 $workdir = ""; |
|
773 } |
|
774 if ($workdir ne "") |
|
775 { |
|
776 $invokecmddir = cwd; |
|
777 $invokecmddir=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
|
778 $invokecmddir.= "\/" unless $invokecmddir =~ /\/$/; |
|
779 $workdir =~ s-\\-\/-g; |
|
780 chdir "$workdir" or die "cannot change to directory $workdir\n"; |
|
781 $thisdir=cwd; |
|
782 $thisdir=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
|
783 $thisdir.= "\/" unless $thisdir =~ /\/$/; |
|
784 $thisdir=~s-^(.:)?\/--o; # remove drive letter and leading backslash |
|
785 } |
|
786 next; |
|
787 } |
|
788 } |
|
748 foreach my $arg (@argList) |
789 foreach my $arg (@argList) |
749 { |
790 { |
750 if ($arg =~ /^-argfile=(.*)/) |
791 if ($arg =~ /^-argfile=(.*)/) |
751 { |
792 { |
752 ¶meterFileProcessor($1) if (defined $paramFileFlag); |
793 ¶meterFileProcessor($1) if (defined $paramFileFlag); |
771 my $varname = $1; |
812 my $varname = $1; |
772 |
813 |
773 if ($varname =~ /^\.(.*)$/) |
814 if ($varname =~ /^\.(.*)$/) |
774 { |
815 { |
775 # for testing, locate the VAR file in the current directory |
816 # for testing, locate the VAR file in the current directory |
776 %featureVariant = featurevariantparser->GetVariant($1, "."); |
817 %featureVariant = get_variant($1, "."); |
777 } |
818 } |
778 else |
819 else |
779 { |
820 { |
780 %featureVariant = featurevariantparser->GetVariant($varname); |
821 %featureVariant = get_variant($varname); |
781 } |
822 } |
782 if (!$featureVariant{'VALID'}) |
823 if (!$featureVariant{'VALID'}) |
783 { |
824 { |
784 print "FEATUREVARIANT $varname is not VALID\n"; |
825 print "FEATUREVARIANT $varname is not VALID\n"; |
785 $errors++; |
826 $errors++; |
795 } |
836 } |
796 if ($arg =~ /^-o(.*)/i) |
837 if ($arg =~ /^-o(.*)/i) |
797 { |
838 { |
798 $opt_o = $1; |
839 $opt_o = $1; |
799 next; |
840 next; |
800 } |
|
801 if ($arg =~ /^-fastcompress$/i) |
|
802 { |
|
803 $opt_fastcompress = "-fastcompress"; |
|
804 next; |
|
805 } |
841 } |
806 if ($arg =~ /^-j(\d+)$/i) |
842 if ($arg =~ /^-j(\d+)$/i) |
807 { |
843 { |
808 $opt_jobs = "-j".$1; |
844 $opt_jobs = "-j".$1; |
809 next; |
845 next; |
869 { |
905 { |
870 print "Error: No filename specified with \"-fm=\" option.\n"; |
906 print "Error: No filename specified with \"-fm=\" option.\n"; |
871 } |
907 } |
872 next; |
908 next; |
873 } |
909 } |
910 #Process Cache command line options. |
|
911 if($arg =~ /^-cache/) |
|
912 { |
|
913 $opt_cache = 1; |
|
914 next; |
|
915 } |
|
916 if($arg =~ /^-nocache/) |
|
917 { |
|
918 $opt_nocache = 1; |
|
919 next; |
|
920 } |
|
921 if($arg =~ /^-cleancache/) |
|
922 { |
|
923 $opt_cleancache = 1; |
|
924 next; |
|
925 } |
|
926 |
|
874 #Process ROM image compression type if it's specified through command line option. |
927 #Process ROM image compression type if it's specified through command line option. |
875 if($arg =~ /^-compress(.*)/) |
928 if($arg =~ /^-compress(.*)/) |
876 { |
929 { |
877 if($1 eq '') |
930 if($1 eq '') |
878 { |
931 { |
956 if($arg =~ /^-gendep$/) |
1009 if($arg =~ /^-gendep$/) |
957 { |
1010 { |
958 $gendep=1; |
1011 $gendep=1; |
959 next; |
1012 next; |
960 } |
1013 } |
1014 if ($arg =~ /^-checkcase$/) |
|
1015 { |
|
1016 $checkcase=1; |
|
1017 next; |
|
1018 } |
|
1019 if ($arg =~ /^-checkcase_test$/) |
|
1020 { |
|
1021 $checkcase_test=1; |
|
1022 next; |
|
1023 } |
|
1024 if ($arg =~ /^-workdir=(.*)/) |
|
1025 { |
|
1026 next; |
|
1027 } |
|
961 if($arg =~/^-c(.*)/) |
1028 if($arg =~/^-c(.*)/) |
962 { |
1029 { |
963 if($1 eq 'none' ) |
1030 if($1 eq 'none' ) |
964 { |
1031 { |
965 $opt_compression = " -compressionmethod none"; |
1032 $opt_compression = " -compressionmethod none"; |
996 next; |
1063 next; |
997 } |
1064 } |
998 else |
1065 else |
999 { |
1066 { |
1000 $ZDirloc = $1; |
1067 $ZDirloc = $1; |
1001 if( $ZDirloc !~ m/\\(\Z)/) |
1068 $ZDirloc =~ s-\\-\/-g; |
1069 if( $ZDirloc !~ m/\/(\Z)/) |
|
1002 { |
1070 { |
1003 $ZDirloc .= "\\"; |
1071 $ZDirloc .= "\/"; |
1004 } |
1072 } |
1005 if( $ZDirloc !~ m/:/) |
1073 if( $ZDirloc !~ m/:/) |
1006 { |
1074 { |
1007 print "drive letter not specified\n"; |
1075 print "drive letter not specified\n"; |
1008 $ZDirloc = &datadriveimage::setPath($ZDirloc); |
1076 $ZDirloc = &datadriveimage::setPath($ZDirloc); |
1025 next; |
1093 next; |
1026 } |
1094 } |
1027 else |
1095 else |
1028 { |
1096 { |
1029 $DataDriveDirloc = $1; |
1097 $DataDriveDirloc = $1; |
1030 if( $DataDriveDirloc !~ m/\\(\Z)/) |
1098 $DataDriveDirloc =~ s-\\-\/-g; |
1099 if( $DataDriveDirloc !~ m/\/(\Z)/) |
|
1031 { |
1100 { |
1032 $DataDriveDirloc .= "\\"; |
1101 $DataDriveDirloc .= "\/"; |
1033 } |
1102 } |
1034 if( $DataDriveDirloc !~ m/:/) |
1103 if( $DataDriveDirloc !~ m/:/) |
1035 { |
1104 { |
1036 print "drive not specified\n"; |
1105 print "drive not specified\n"; |
1037 $DataDriveDirloc = &datadriveimage::setPath($DataDriveDirloc); |
1106 $DataDriveDirloc = &datadriveimage::setPath($DataDriveDirloc); |
1086 $paraFile = $1; |
1155 $paraFile = $1; |
1087 next; |
1156 next; |
1088 } |
1157 } |
1089 if ( $arg =~ /^-l=(.*)/i || $arg =~ /^-logimageentry=(.*)/i ) |
1158 if ( $arg =~ /^-l=(.*)/i || $arg =~ /^-logimageentry=(.*)/i ) |
1090 { |
1159 { |
1091 if( $1 =~/\\/ || $1 =~ m/:/) |
1160 if( $1 =~/[\/\\]/ || $1 =~ m/:/) |
1092 { |
1161 { |
1093 print "* Warning: Invalid log file extension try filename.txt\n"; |
1162 print "* Warning: Invalid log file extension try filename.txt\n"; |
1094 next; |
1163 next; |
1095 } |
1164 } |
1096 else |
1165 else |
1114 # It's an OBY file |
1183 # It's an OBY file |
1115 next if (match_obyfile($arg)); |
1184 next if (match_obyfile($arg)); |
1116 next if (match_obyfile("$arg.oby")); |
1185 next if (match_obyfile("$arg.oby")); |
1117 |
1186 |
1118 print "Cannot find oby file: $arg\n"; |
1187 print "Cannot find oby file: $arg\n"; |
1119 $errors++; |
1188 $errors++ if(!$opt_k); |
1120 } |
1189 } |
1121 |
1190 |
1122 if (defined $paramFileFlag) |
1191 if (defined $paramFileFlag) |
1123 { |
1192 { |
1124 return; |
1193 return; |
1125 } |
1194 } |
1126 |
1195 |
1127 if (@obyfiles<1) |
1196 if (@obyfiles<1) |
1128 { |
1197 { |
1129 print "Missing obyfile argument\n"; |
1198 print "Missing obyfile argument\n"; |
1130 $errors++; |
1199 $errors++ if(!$opt_k); |
1131 } |
1200 } |
1132 |
1201 |
1133 if ($errors) |
1202 if ($errors) |
1134 { |
1203 { |
1135 print_usage(); |
1204 print_usage(); |
1144 |
1213 |
1145 # Adding variant specific macros by including a HRH file |
1214 # Adding variant specific macros by including a HRH file |
1146 # (only required if no Feature Variant is used) |
1215 # (only required if no Feature Variant is used) |
1147 if (!$featureVariant{'VALID'}) |
1216 if (!$featureVariant{'VALID'}) |
1148 { |
1217 { |
1149 my $variantMacroHRHFile = Variant_GetMacroHRHFile(); |
1218 my $variantMacroHRHFile = get_variantmacroHRHfile(); |
1150 if($variantMacroHRHFile){ |
1219 if($variantMacroHRHFile){ |
1151 |
1220 my $variantFilePath = split_path('Path',$variantMacroHRHFile); |
1152 my $variantFilePath = Path_Split('Path',$variantMacroHRHFile); |
1221 $cppargs .= " -I " . &append_driveandquote($variantFilePath) . " -include " . &append_driveandquote($variantMacroHRHFile); |
1153 $cppargs .= " -I \"" . &Path_RltToWork($variantFilePath) . "\" -include \"" . &Path_RltToWork($variantMacroHRHFile) . "\""; |
1222 print "in cmd process $cppargs\n" if ($opt_v); |
1154 } |
1223 } |
1155 } |
1224 } |
1156 # load the required modules if xml is required |
1225 # load the required modules if xml is required |
1157 if ($xmlrequired == 1) |
1226 if ($xmlrequired == 1) |
1158 { |
1227 { |
1159 my $epocToolsPath = $ENV{EPOCROOT}."epoc32\\tools\\"; |
|
1160 Load_SetModulePath($epocToolsPath); |
|
1161 if (defined ($featureXml)) |
1228 if (defined ($featureXml)) |
1162 { |
1229 { |
1163 load_featuresutil(); |
1230 load_featuresutil(); |
1164 } |
1231 } |
1165 |
1232 |
1166 if ($image_content) |
1233 if ($image_content) |
1167 { |
1234 { |
1168 &Load_ModuleL("ImageContentHandler"); |
1235 &FlexLoad_ModuleL("ImageContentHandler"); |
1169 # some variables for ImageContentHandler may have been setup |
1236 # some variables for ImageContentHandler may have been setup |
1170 my ($key, $value); |
1237 my ($key, $value); |
1171 &ImageContentHandler::SetBldRomOpts; # Defaults to ARMV5 platform |
1238 &ImageContentHandler::SetBldRomOpts; # Defaults to armv5 platform |
1172 while (($key,$value) = each %tmpBldRomOpts) |
1239 while (($key,$value) = each %tmpBldRomOpts) |
1173 { |
1240 { |
1174 &ImageContentHandler::SetBldRomOpts($key, $value); |
1241 &ImageContentHandler::SetBldRomOpts($key, $value); |
1175 } |
1242 } |
1176 } |
1243 } |
1213 } |
1280 } |
1214 } |
1281 } |
1215 else |
1282 else |
1216 { |
1283 { |
1217 # no feature variant so use the standard includes |
1284 # no feature variant so use the standard includes |
1218 $cppargs .= " -I. -I$rominclude"; |
1285 $cppargs .= " -I. -I \"$rominclude\""; |
1219 } |
1286 $cppargs .= " -I \"$invokecmddir\"" if ($invokecmddir ne ""); |
1220 |
1287 } |
1221 print "* cpp -o tmp1.oby $cppargs\n" if ($opt_v); |
1288 |
1289 print "* cpp -Wno-endif-labels -o tmp1.oby $cppargs\n" if ($opt_v); |
|
1222 |
1290 |
1291 is_existinpath("cpp", romutl::DIE_NOT_FOUND); |
|
1223 $errors = 0; |
1292 $errors = 0; |
1224 open CPP, "| cpp -o tmp1.oby $cppargs" or die "* Can't execute cpp"; |
1293 open CPP, "| cpp -Wno-endif-labels -o tmp1.oby $cppargs" or die "* Can't execute cpp"; |
1225 foreach my $arg (@obyfiles) |
1294 foreach my $arg (@obyfiles) |
1226 { |
1295 { |
1227 print CPP "\n#line 1 \"$arg\"\n"; |
1296 print CPP "\n#line 1 \"$arg\"\n"; |
1228 |
1297 |
1229 open OBY, $arg or die "* Can't open $arg"; |
1298 if(open(OBY, $arg)) { |
1230 print "* reading $arg\n" if ($opt_v); |
1299 print "* reading $arg\n" if ($opt_v); |
1231 while ($line=<OBY>) |
1300 while ($line=<OBY>) { |
1232 { |
1301 print CPP $line; |
1233 print CPP $line; |
1302 } |
1234 } |
1303 close OBY; |
1235 close OBY; |
1304 } |
1305 else { |
|
1306 print STDERR "* Can't open $arg\n"; |
|
1307 if(!$opt_k){ |
|
1308 close CPP; |
|
1309 exit(1); |
|
1310 } |
|
1311 } |
|
1236 } |
1312 } |
1237 close CPP; |
1313 close CPP; |
1238 my $cpp_status = $?; |
1314 my $cpp_status = $?; |
1239 die "* cpp failed\n" if ($cpp_status != 0 || !-f "tmp1.oby"); |
1315 die "* cpp failed\n" if ($cpp_status != 0 || !-f "tmp1.oby"); |
1240 |
1316 |
1273 while($tmpline =<OBYFH>) { |
1349 while($tmpline =<OBYFH>) { |
1274 if ($tmpline=~/(\S+)\s*=\s*(\S+)\s+(\S+)/) {#Get the first parameter (source File path) from oby line |
1350 if ($tmpline=~/(\S+)\s*=\s*(\S+)\s+(\S+)/) {#Get the first parameter (source File path) from oby line |
1275 $srcFilePath = $2; |
1351 $srcFilePath = $2; |
1276 $dstFilePath = $3; |
1352 $dstFilePath = $3; |
1277 |
1353 |
1278 if ($srcFilePath=~/.*\\(\S+)/) { |
1354 if ($srcFilePath=~/.*[\/\\](\S+)/) { |
1279 $srcFileName = $1; |
1355 $srcFileName = $1; |
1280 } |
1356 } |
1281 if ($dstFilePath=~/.*\\(\S+)/) { |
1357 if ($dstFilePath=~/.*[\/\\](\S+)/) { |
1282 $dstFileName = $1; |
1358 $dstFileName = $1; |
1283 } |
1359 } |
1284 my $binaryInfoRef = &cdfparser::GetBinaryInfo($dstFileName); |
1360 my $binaryInfoRef = &cdfparser::GetBinaryInfo($dstFileName); |
1285 |
1361 |
1286 if(defined($binaryInfoRef)) |
1362 if(defined($binaryInfoRef)) |
1345 if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) |
1421 if ($line=~/^\s*defaultfeaturedb\s*=?\s*(\S+)/i) |
1346 { |
1422 { |
1347 # Get the default value for featuredatabasefile |
1423 # Get the default value for featuredatabasefile |
1348 |
1424 |
1349 $featureXml = "$epocroot$1"; |
1425 $featureXml = "$epocroot$1"; |
1426 $featureXml =~ s-\\-\/-g; |
|
1350 $featuremanager = 1; |
1427 $featuremanager = 1; |
1351 $defaultFeatureDbFlag = 1; |
1428 $defaultFeatureDbFlag = 1; |
1352 load_featuresutil(); |
1429 load_featuresutil(); |
1353 last; |
1430 last; |
1354 } |
1431 } |
1364 |
1441 |
1365 open TMP1, "tmp1.oby" or die("* Can't open tmp1.oby\n"); |
1442 open TMP1, "tmp1.oby" or die("* Can't open tmp1.oby\n"); |
1366 while ($line=<TMP1>) |
1443 while ($line=<TMP1>) |
1367 { |
1444 { |
1368 track_source($line); |
1445 track_source($line); |
1446 $line =~ s-\\-\/-g; |
|
1369 # |
1447 # |
1370 # Recognise keywords in lines that we process before substitution |
1448 # Recognise keywords in lines that we process before substitution |
1371 # |
1449 # |
1372 # # lineno "file" flagno |
1450 # # lineno "file" flagno |
1373 # DEFINE name replacement-with-0-spaces |
1451 # DEFINE name replacement-with-0-spaces |
1690 push @obydata, $line; |
1768 push @obydata, $line; |
1691 } |
1769 } |
1692 |
1770 |
1693 close TMP1; |
1771 close TMP1; |
1694 exit(1) if ($errors); |
1772 exit(1) if ($errors); |
1695 |
|
1696 dump_obydata("tmp2.oby", "result of substitution phase") if ($opt_v); |
1773 dump_obydata("tmp2.oby", "result of substitution phase") if ($opt_v); |
1697 } |
1774 } |
1698 |
1775 |
1699 sub check_romimage |
1776 sub check_romimage |
1700 { |
1777 { |
1741 my ($line) = @_; |
1818 my ($line) = @_; |
1742 if ($line=~/^# (\d+) "(.*)"/) |
1819 if ($line=~/^# (\d+) "(.*)"/) |
1743 { |
1820 { |
1744 $sourceline=$1-1; |
1821 $sourceline=$1-1; |
1745 $sourcefile=$2; |
1822 $sourcefile=$2; |
1746 $sourcefile=~ s/\//\\/g; |
|
1747 $sourcefile=~ s/\\\\/\\/g; |
1823 $sourcefile=~ s/\\\\/\\/g; |
1824 $sourcefile=~ s/\\/\//g; |
|
1748 return; |
1825 return; |
1749 } |
1826 } |
1750 $sourceline++; |
1827 $sourceline++; |
1751 } |
1828 } |
1752 |
1829 |
2065 print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v); |
2142 print ("Warning: SPI creation/placement flag not enabled. Ignoring SPI_POSITION\n" ) if ($opt_v); |
2066 } |
2143 } |
2067 } |
2144 } |
2068 # a partition is specified |
2145 # a partition is specified |
2069 # push this line into the currently selected partition |
2146 # push this line into the currently selected partition |
2070 my $partition=@currentpartition[-1]; |
2147 my $partition=$currentpartition[-1]; |
2071 push @$partition, $modifiedLine; |
2148 push @$partition, $modifiedLine; |
2072 $line="REM handled $line"; |
2149 $line="REM handled $line"; |
2073 } |
2150 } |
2074 elsif ($line =~ /^\s*SPI_POSITION/i) |
2151 elsif ($line =~ /^\s*SPI_POSITION/i) |
2075 { |
2152 { |
2216 $errors++ if ($strict); |
2293 $errors++ if ($strict); |
2217 } |
2294 } |
2218 |
2295 |
2219 if ($spidatahide) |
2296 if ($spidatahide) |
2220 { |
2297 { |
2221 push @newobydata, "hide=$fileRomDir\\$pluginFileName\n"; |
2298 push @newobydata, "hide=$fileRomDir\/$pluginFileName\n"; |
2222 } |
2299 } |
2223 else |
2300 else |
2224 { |
2301 { |
2225 push @newobydata, "file=$emulatorDir\\$pluginFileName $fileRomDir\\$pluginFileName $paged_data\n"; |
2302 push @newobydata, "file=$emulatorDir\/$pluginFileName $fileRomDir\/$pluginFileName $paged_data\n"; |
2226 } |
2303 } |
2227 |
2304 |
2228 if($createspi) { |
2305 if($createspi) { |
2229 if ($spidatahide) |
2306 if ($spidatahide) |
2230 { |
2307 { |
2231 push @newobydata, "spidatahide=MULTI_LINGUIFY(RSC $dataz_\\$resourceDir\\$pluginResourceName $resourceDir\\$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
2308 push @newobydata, "spidatahide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
2232 } |
2309 } |
2233 else |
2310 else |
2234 { |
2311 { |
2235 push @newobydata, "spidata=MULTI_LINGUIFY(RSC $dataz_\\$resourceDir\\$pluginResourceName $resourceDir\\$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
2312 push @newobydata, "spidata=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName) " . lc($plugintype) . "\.spi " . $plugintypes{$plugintype} . "\n"; |
2236 } |
2313 } |
2237 } else { |
2314 } else { |
2238 if ($spidatahide) |
2315 if ($spidatahide) |
2239 { |
2316 { |
2240 push @newobydata, "hide=MULTI_LINGUIFY(RSC $dataz_\\$resourceDir\\$pluginResourceName $resourceDir\\$pluginResourceName)\n"; |
2317 push @newobydata, "hide=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n"; |
2241 } |
2318 } |
2242 else |
2319 else |
2243 { |
2320 { |
2244 push @newobydata, "data=MULTI_LINGUIFY(RSC $dataz_\\$resourceDir\\$pluginResourceName $resourceDir\\$pluginResourceName)\n"; |
2321 push @newobydata, "data=MULTI_LINGUIFY(RSC $dataz_\/$resourceDir\/$pluginResourceName $resourceDir\/$pluginResourceName)\n"; |
2245 } |
2322 } |
2246 } |
2323 } |
2247 return 1; #successful match |
2324 return 1; #successful match |
2248 } |
2325 } |
2249 } |
2326 } |
2273 # ignore REM statements, to avoid processing "REM data=xxx yyy" |
2350 # ignore REM statements, to avoid processing "REM data=xxx yyy" |
2274 } |
2351 } |
2275 elsif ($line=~/^(.*?)\bMULTI_LINGUIFY\s*\(\s*(\S+)\s+(\S+)\s+(\S+)\s*\)(.*)$/i) |
2352 elsif ($line=~/^(.*?)\bMULTI_LINGUIFY\s*\(\s*(\S+)\s+(\S+)\s+(\S+)\s*\)(.*)$/i) |
2276 { |
2353 { |
2277 my $initialStuff=$1; |
2354 my $initialStuff=$1; |
2355 $initialStuff = lc ($initialStuff);# if ($enableLowercaseTransfer); |
|
2278 my $defaultFileNameExtension=$2; |
2356 my $defaultFileNameExtension=$2; |
2357 $defaultFileNameExtension = lc ($defaultFileNameExtension);# if ($enableLowercaseTransfer); |
|
2279 my $sourceFileNameWithoutExtension=$3; |
2358 my $sourceFileNameWithoutExtension=$3; |
2359 $sourceFileNameWithoutExtension = ($sourceFileNameWithoutExtension);# if ($enableLowercaseTransfer); |
|
2280 my $targetFileNameWithoutExtension=$4; |
2360 my $targetFileNameWithoutExtension=$4; |
2281 my $finalStuff=$5; |
2361 my $finalStuff=$5; |
2282 my $spidataflag = 0; |
2362 my $spidataflag = 0; |
2283 my $spidatahide = 0; |
2363 my $spidatahide = 0; |
2284 my $datahide = 0; |
2364 my $datahide = 0; |
2309 # ecom.spi should contain the .RSC files |
2389 # ecom.spi should contain the .RSC files |
2310 if ($spidataflag) |
2390 if ($spidataflag) |
2311 { |
2391 { |
2312 my $sourceFileNameExtension = $defaultFileNameExtension; |
2392 my $sourceFileNameExtension = $defaultFileNameExtension; |
2313 my $targetFileNameExtension = $defaultFileNameExtension; |
2393 my $targetFileNameExtension = $defaultFileNameExtension; |
2314 if (-e "$sourceFileNameWithoutExtension.$sourceFileNameExtension") |
2394 if (-e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension")) |
2315 { |
2395 { |
2316 if ($spidatahide) |
2396 if ($spidatahide) |
2317 { |
2397 { |
2318 push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$finalStuff\n"; |
2398 push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension$finalStuff\n"; |
2319 } |
2399 } |
2325 } |
2405 } |
2326 my $useDefaultFileNameExtension=1; |
2406 my $useDefaultFileNameExtension=1; |
2327 foreach my $languageCode (keys %languageCodes) { |
2407 foreach my $languageCode (keys %languageCodes) { |
2328 my $sourceFileNameExtension=$defaultFileNameExtension; |
2408 my $sourceFileNameExtension=$defaultFileNameExtension; |
2329 $sourceFileNameExtension=~s/^(.*).{2}$/$1$languageCode/; |
2409 $sourceFileNameExtension=~s/^(.*).{2}$/$1$languageCode/; |
2330 if (! -e "$sourceFileNameWithoutExtension.$sourceFileNameExtension") |
2410 if (! -e ("$sourceFileNameWithoutExtension.$sourceFileNameExtension")) |
2331 { |
2411 { |
2332 if (!$spidataflag) |
2412 if (!$spidataflag) |
2333 { |
2413 { |
2334 next if (!$useDefaultFileNameExtension); |
2414 next if (!$useDefaultFileNameExtension); |
2335 next if (defined $defaultLanguageCode and !($languageCode eq $defaultLanguageCode)); |
2415 next if (defined $defaultLanguageCode and !($languageCode eq $defaultLanguageCode)); |
2375 { |
2455 { |
2376 push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n"; |
2456 push @newobydata, "$initialStuff$sourceFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$sourceFileNameExtension$modifiedfinalStuff\n"; |
2377 if(!($sourceFileNameExtension eq $targetFileNameExtension)) |
2457 if(!($sourceFileNameExtension eq $targetFileNameExtension)) |
2378 { |
2458 { |
2379 push @newobydata, "alias $targetFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension $modifiedfinalStuff\n"; |
2459 push @newobydata, "alias $targetFileNameWithoutExtension.$sourceFileNameExtension $targetFileNameWithoutExtension.$targetFileNameExtension $modifiedfinalStuff\n"; |
2460 $targetFileNameWithoutExtension =~ s-\\-\/-g; |
|
2380 $multiLinguifyAlias{"$targetFileNameWithoutExtension.$sourceFileNameExtension"} = 1; |
2461 $multiLinguifyAlias{"$targetFileNameWithoutExtension.$sourceFileNameExtension"} = 1; |
2381 } |
2462 } |
2382 } |
2463 } |
2383 } |
2464 } |
2384 $line = reassert_sourceline(); |
2465 $line = reassert_sourceline(); |
2453 { |
2534 { |
2454 push @hidedatainspi, $hidedatafiles[$j]{data}; #push name of data file to be hidden onto array if correct romimage and spi type |
2535 push @hidedatainspi, $hidedatafiles[$j]{data}; #push name of data file to be hidden onto array if correct romimage and spi type |
2455 } |
2536 } |
2456 } |
2537 } |
2457 my @spiargs; #arguments passed to createSpi |
2538 my @spiargs; #arguments passed to createSpi |
2458 push @spiargs, ("-t$targetspi", "-d\\$thisdir", "-hide@hidedatainspi"); |
2539 push @spiargs, ("-t$targetspi", "-d\/$thisdir", "-hide@hidedatainspi"); |
2459 if($existingspi ne "") { push @spiargs, $existingspi; } |
2540 if($existingspi ne "") { push @spiargs, $existingspi; } |
2460 &spitool::createSpi(@spiargs, @dataforspi); # external call to |
2541 &spitool::createSpi(@spiargs, @dataforspi); # external call to |
2461 } |
2542 } |
2462 } |
2543 } |
2463 |
2544 |
2619 next if (!$spipositionflag{$imageIdx});#This spi has already been entered into OBY. |
2700 next if (!$spipositionflag{$imageIdx});#This spi has already been entered into OBY. |
2620 my $spiIdx=0; |
2701 my $spiIdx=0; |
2621 while(defined $spiarray[$imageIdx][$spiIdx]) { |
2702 while(defined $spiarray[$imageIdx][$spiIdx]) { |
2622 if($spiarray[$imageIdx][$spiIdx]{spifile} =~ /(.+)\.(.*)$/) { |
2703 if($spiarray[$imageIdx][$spiIdx]{spifile} =~ /(.+)\.(.*)$/) { |
2623 my $targetspi="$1-$imageIdx-$spiIdx\.$2"; |
2704 my $targetspi="$1-$imageIdx-$spiIdx\.$2"; |
2624 push @newobydata, "data=" . "\\$thisdir" . $targetspi . " \"" . $spiarray[$imageIdx][$spiIdx]{spi} . "\"\n"; |
2705 push @newobydata, "data=" . "\/$thisdir" . $targetspi . " \"" . $spiarray[$imageIdx][$spiIdx]{spi} . "\"\n"; |
2625 } |
2706 } |
2626 $spiIdx++; |
2707 $spiIdx++; |
2627 } |
2708 } |
2628 if($spiIdx == 0){ |
2709 if($spiIdx == 0){ |
2629 # If there is no plugin in this image, the SPI_POSITION statement is ignore. |
2710 # If there is no plugin in this image, the SPI_POSITION statement is ignore. |
2646 $flag=0; |
2727 $flag=0; |
2647 my $k=0; |
2728 my $k=0; |
2648 while(defined $spiarray[0][$k]) { |
2729 while(defined $spiarray[0][$k]) { |
2649 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2730 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2650 my $targetspi="$1-0-$k\.$2"; |
2731 my $targetspi="$1-0-$k\.$2"; |
2651 push @newobydata, "data=" . "\\$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2732 push @newobydata, "data=" . "\/$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2652 } |
2733 } |
2653 $k++; |
2734 $k++; |
2654 } |
2735 } |
2655 } |
2736 } |
2656 my $j=0; |
2737 my $j=0; |
2657 push @newobydata, "\n" . $line . "\n"; |
2738 push @newobydata, "\n" . $line . "\n"; |
2658 while(defined $spiarray[$romimage][$j]) { #put in SPI files for current ROM_IMAGE |
2739 while(defined $spiarray[$romimage][$j]) { #put in SPI files for current ROM_IMAGE |
2659 if($spiarray[$romimage][$j]{spifile} =~ /(.+)\.(.*)$/) { |
2740 if($spiarray[$romimage][$j]{spifile} =~ /(.+)\.(.*)$/) { |
2660 my $targetspi="$1-$romimage-$j\.$2"; |
2741 my $targetspi="$1-$romimage-$j\.$2"; |
2661 push @newobydata, "data=" . "\\$thisdir" . $targetspi . " \"" . $spiarray[$romimage][$j]{spidir} . $targetspi . "\"\n"; |
2742 push @newobydata, "data=" . "\/$thisdir" . $targetspi . " \"" . $spiarray[$romimage][$j]{spidir} . $targetspi . "\"\n"; |
2662 } |
2743 } |
2663 $j++; |
2744 $j++; |
2664 } |
2745 } |
2665 } elsif($line =~ /^\s*extensionrom/i) { |
2746 } elsif($line =~ /^\s*extensionrom/i) { |
2666 if($flag) { #put in SPI files |
2747 if($flag) { #put in SPI files |
2667 my $k=0; |
2748 my $k=0; |
2668 while(defined $spiarray[0][$k]) { |
2749 while(defined $spiarray[0][$k]) { |
2669 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2750 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2670 my $targetspi="$1-0-$k\.$2"; |
2751 my $targetspi="$1-0-$k\.$2"; |
2671 push @newobydata, "data=" . "\\$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2752 push @newobydata, "data=" . "\/$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2672 } |
2753 } |
2673 $k++; |
2754 $k++; |
2674 } |
2755 } |
2675 $flag = 0; |
2756 $flag = 0; |
2676 } |
2757 } |
2683 if($flag) { #put in SPI files for ROM_IMAGE[0] if it is the only ROM_IMAGE |
2764 if($flag) { #put in SPI files for ROM_IMAGE[0] if it is the only ROM_IMAGE |
2684 my $k=0; |
2765 my $k=0; |
2685 while(defined $spiarray[0][$k]) { |
2766 while(defined $spiarray[0][$k]) { |
2686 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2767 if($spiarray[0][$k]{spifile} =~ /(.+)\.(.*)$/) { |
2687 my $targetspi="$1-0-$k\.$2"; |
2768 my $targetspi="$1-0-$k\.$2"; |
2688 push @newobydata, "data=" . "\\$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2769 push @newobydata, "data=" . "\/$thisdir" . $targetspi . " \"" . $spiarray[0][$k]{spidir} . $targetspi . "\"\n"; |
2689 } |
2770 } |
2690 $k++; |
2771 $k++; |
2691 } |
2772 } |
2692 } |
2773 } |
2693 @obydata=@newobydata; |
2774 @obydata=@newobydata; |
2695 dump_obydata("tmp6.oby", "result of SPI stage") if ($opt_v); |
2776 dump_obydata("tmp6.oby", "result of SPI stage") if ($opt_v); |
2696 } |
2777 } |
2697 |
2778 |
2698 sub load_featuresutil |
2779 sub load_featuresutil |
2699 { |
2780 { |
2700 &Load_ModuleL("featuresutil"); |
2781 &FlexLoad_ModuleL("featuresutil"); |
2701 |
2782 |
2702 # Parse the feature database XML file |
2783 # Parse the feature database XML file |
2703 if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict)) |
2784 if(!&featuresutil::parseXMLDatabase($featureXml, $featuremanager, $strict)) |
2704 { |
2785 { |
2705 $featureXml = undef; |
2786 $featureXml = undef; |
2721 } |
2802 } |
2722 # Set the name and Rom Image location of feature file. |
2803 # Set the name and Rom Image location of feature file. |
2723 if ($enforceFeatureManager) |
2804 if ($enforceFeatureManager) |
2724 { |
2805 { |
2725 # features data file location |
2806 # features data file location |
2726 $dir = "private\\10205054\\"; |
2807 $dir = "private\/10205054\/"; |
2727 $featurefilename = "features.dat"; |
2808 $featurefilename = "features.dat"; |
2728 } |
2809 } |
2729 else |
2810 else |
2730 { |
2811 { |
2731 # feature registry configuration file location |
2812 # feature registry configuration file location |
2732 $dir = "private\\102744CA\\"; |
2813 $dir = "private\/102744CA\/"; |
2733 $featurefilename = "featreg.cfg"; |
2814 $featurefilename = "featreg.cfg"; |
2734 } |
2815 } |
2735 if (defined ($featureXml)) |
2816 if (defined ($featureXml)) |
2736 { |
2817 { |
2737 my $featurefilecount=0; |
2818 my $featurefilecount=0; |
2888 while(defined $featurefilearray[0][$k]) |
2969 while(defined $featurefilearray[0][$k]) |
2889 { |
2970 { |
2890 my $targetfeaturefile=$featurefilearray[0][$k]{cfgfile}; |
2971 my $targetfeaturefile=$featurefilearray[0][$k]{cfgfile}; |
2891 if (defined $targetfeaturefile) |
2972 if (defined $targetfeaturefile) |
2892 { |
2973 { |
2893 push @newobydata, "data=" . "\\$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
2974 push @newobydata, "data=" . "\/$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
2894 } |
2975 } |
2895 $k++; |
2976 $k++; |
2896 } |
2977 } |
2897 } |
2978 } |
2898 push @newobydata, "\n" . $line . "\n"; |
2979 push @newobydata, "\n" . $line . "\n"; |
2911 # list with mangled names. Hence, mangled name for feature files should not be put in ROM_IMAGE. |
2992 # list with mangled names. Hence, mangled name for feature files should not be put in ROM_IMAGE. |
2912 my $exattribute = "exattrib=U"; |
2993 my $exattribute = "exattrib=U"; |
2913 |
2994 |
2914 if (defined $targetfeaturefile) |
2995 if (defined $targetfeaturefile) |
2915 { |
2996 { |
2916 push @newobydata, "data=" . "\\$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[$romimage][$j]{cfgdir} . $destinationfeaturefile . "\"\t\t" . $exattribute . "\n"; |
2997 push @newobydata, "data=" . "\/$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[$romimage][$j]{cfgdir} . $destinationfeaturefile . "\"\t\t" . $exattribute . "\n"; |
2917 } |
2998 } |
2918 $j++; |
2999 $j++; |
2919 } |
3000 } |
2920 } |
3001 } |
2921 elsif($line !~ /^\s*(FEATURE)\s*/i && $line !~ /^\s*(EXCLUDE_FEATURE)\s*/i) |
3002 elsif($line !~ /^\s*(FEATURE)\s*/i && $line !~ /^\s*(EXCLUDE_FEATURE)\s*/i) |
2932 while(defined $featurefilearray[0][$k]) |
3013 while(defined $featurefilearray[0][$k]) |
2933 { |
3014 { |
2934 my $targetfeaturefile = $featurefilearray[0][$k]{cfgfile}; |
3015 my $targetfeaturefile = $featurefilearray[0][$k]{cfgfile}; |
2935 if (defined $targetfeaturefile) |
3016 if (defined $targetfeaturefile) |
2936 { |
3017 { |
2937 push @newobydata, "data=" . "\\$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
3018 push @newobydata, "data=" . "\/$thisdir" . $targetfeaturefile . " \"" . $featurefilearray[0][$k]{cfgdir} . $targetfeaturefile . "\"\n"; |
2938 } |
3019 } |
2939 $k++; |
3020 $k++; |
2940 } |
3021 } |
2941 } |
3022 } |
2942 @obydata=@newobydata; |
3023 @obydata=@newobydata; |
2974 elsif ($enforceFeatureManager) |
3055 elsif ($enforceFeatureManager) |
2975 { |
3056 { |
2976 print "Error: no feature data file or pre-built feature data file is provided!"; |
3057 print "Error: no feature data file or pre-built feature data file is provided!"; |
2977 exit(1); |
3058 exit(1); |
2978 } |
3059 } |
3060 |
|
3061 checkcase() if ($checkcase); |
|
2979 } |
3062 } |
2980 my ($fromABI,$toABI) = split / /,$abiDowngrade; |
3063 my ($fromABI,$toABI) = split / /,$abiDowngrade; |
2981 |
3064 |
2982 #---------------------------------------------------------------------------------- |
3065 #---------------------------------------------------------------------------------- |
2983 # Problem suppression phase |
3066 # Problem suppression phase |
2989 # correct source binary name using the VMAP file mechanism. |
3072 # correct source binary name using the VMAP file mechanism. |
2990 |
3073 |
2991 sub suppress_phase |
3074 sub suppress_phase |
2992 { |
3075 { |
2993 undef @newobydata; |
3076 undef @newobydata; |
2994 Plat_Init($PerlLibPath); |
3077 |
3078 init_plat($PerlEPOCPath); |
|
2995 |
3079 |
2996 # use the "default" feature variant by default. |
3080 # use the "default" feature variant by default. |
2997 my $varname = $featureVariant{'VALID'} ? $featureVariant{'NAME'} : "default"; |
3081 my $varname = $featureVariant{'VALID'} ? $featureVariant{'NAME'} : "default"; |
2998 |
3082 |
2999 foreach $line (@obydata) |
3083 foreach $line (@obydata) |
3000 { |
3084 { |
3001 track_source($line); |
3085 track_source($line); |
3002 if ($line =~ /^\s*REM/i) |
3086 if ($line =~ /^\s*REM/i || $line =~ /^\s*TIME\s*=\s*/i) |
3003 { |
3087 { |
3004 # ignore REM statements, to avoid processing "REM data=xxx yyy" |
3088 # ignore REM statements, to avoid processing "REM data=xxx yyy" |
3005 } |
3089 } |
3006 # |
3090 # |
3007 # thing=some\file |
3091 # thing=some\file |
3008 # |
3092 # |
3009 elsif ($line =~ /(\S+)\s*=\s*"?(\S+\\\S+)"?/) |
3093 elsif ($line =~ /(\S+)\s*=\s*"?(\S+[\/\\]\S+)"?/) |
3010 { |
3094 { |
3011 my $what = $1; |
3095 my $what = $1; |
3012 my $filename = $2; |
3096 my $filename = $2; |
3013 if ($line =~ /(\S+)\s*=\s*"([^"]+)"/) |
3097 if ($line =~ /(\S+)\s*=\s*"([^"]+)"/) |
3014 { |
3098 { |
3015 $filename = $2; |
3099 $filename = $2; |
3016 } |
3100 } |
3017 my $normedFilename = &Genutl_NormaliseVersionedName($filename); |
3101 my $normedFilename = &get_versionedname($filename); |
3018 |
3102 |
3019 # find all the alternative file locations |
3103 # find all the alternative file locations |
3020 my @alternatives = fallback($normedFilename); |
3104 my @alternatives = fallback($normedFilename); |
3021 # test the original location first |
3105 # test the original location first |
3022 unshift(@alternatives, $normedFilename); |
3106 unshift(@alternatives, $normedFilename); |
3025 my $fileExists = 0; |
3109 my $fileExists = 0; |
3026 foreach my $altFile (@alternatives) |
3110 foreach my $altFile (@alternatives) |
3027 { |
3111 { |
3028 my $tmpPath; |
3112 my $tmpPath; |
3029 my $tmpFile; |
3113 my $tmpFile; |
3030 if($altFile =~ /"?(.*\\arm\w+_?\w+)\\([^"]+)/i) |
3114 if($altFile =~ /"?(.*[\/\\]arm\w+_?\w+)[\/\\]([^"]+)/i) |
3031 { |
3115 { |
3032 $tmpPath = $1; |
3116 $tmpPath = $1; |
3033 $tmpFile = $2; |
3117 $tmpFile = $2; |
3034 } |
3118 } |
3035 $tmpPath .= "\.$varname"; |
3119 $tmpPath .= "\.$varname"; |
3036 if (-d $tmpPath){ |
3120 |
3037 if (-e $tmpPath ."\\$tmpFile"){ |
3121 if (-e $tmpPath ."\/$tmpFile"){ |
3038 $fileExists = $tmpPath . "\\$tmpFile"; |
3122 # SBSv2 variant binary exists |
3039 } |
3123 $fileExists = $tmpPath . "\/$tmpFile"; |
3040 elsif (-e $altFile){ |
|
3041 $fileExists = $altFile; |
|
3042 } |
|
3043 } |
3124 } |
3044 else { |
3125 else { |
3045 $fileExists = featurevariantmap->Find($altFile, $varname); |
3126 # SBSv1 variant binary or invariant binary |
3127 $fileExists = get_BVbinname($altFile, $varname); |
|
3046 } |
3128 } |
3047 last if $fileExists; |
3129 last if $fileExists; |
3048 } |
3130 } |
3049 |
3131 # for -workdir option, to support relative path to the call path |
3132 if (!$fileExists && ($invokecmddir ne "") && ($filename !~ /^([\\\/]|.:)/)) |
|
3133 { |
|
3134 if (-e $invokecmddir.$filename) |
|
3135 { |
|
3136 $fileExists = $invokecmddir.$filename; |
|
3137 } |
|
3138 } |
|
3139 |
|
3050 # edit the OBY line to use the actual file name which we found. |
3140 # edit the OBY line to use the actual file name which we found. |
3051 # (maybe) warn if an alternative to the original was selected. |
3141 # (maybe) warn if an alternative to the original was selected. |
3052 if ($fileExists) |
3142 if ($fileExists) |
3053 { |
3143 { |
3054 my $from = $filename; |
3144 my $from = $filename; |
3055 $from =~ s/\\/\\\\/g; # need to escape backslashes |
3145 $from =~ s/\\/\\\\/g; |
3146 $from =~ s/\//\\\//g; # need to escape backslashes |
|
3056 $from =~ s/(\[|\])/\\$1/g; # need to escape square brackets for file names like "featreg.cfg[x-y]",etc. |
3147 $from =~ s/(\[|\])/\\$1/g; # need to escape square brackets for file names like "featreg.cfg[x-y]",etc. |
3057 my $into = $fileExists; |
3148 my $into = $fileExists; |
3058 |
3149 |
3059 $line =~ s/$from/$into/; |
3150 $line =~ s/$from/$into/i; |
3060 |
3151 |
3061 if ($warnSelection && ($fileExists ne $normedFilename)) |
3152 if ($warnSelection && ($fileExists ne $normedFilename)) |
3062 { |
3153 { |
3063 print "replaced $filename with $fileExists\n"; |
3154 print "replaced $filename with $fileExists\n"; |
3064 } |
3155 } |
3091 |
3182 |
3092 if($aSrcfile =~ /"?([^"]+)/){ |
3183 if($aSrcfile =~ /"?([^"]+)/){ |
3093 $aSrcfile = $1; |
3184 $aSrcfile = $1; |
3094 } |
3185 } |
3095 |
3186 |
3096 $aSrcfile = &Genutl_NormaliseVersionedName($aSrcfile); |
3187 $aSrcfile = &get_versionedname($aSrcfile); |
3097 if($dstFile =~ /"?(.*)\\([^"]+)/) |
3188 if($dstFile =~ /"?(.*)[\/\\]([^"]+)/) |
3098 { |
3189 { |
3099 $dstPath = $1; |
3190 $dstPath = $1; |
3100 $dstFile = $2; |
3191 $dstFile = $2; |
3101 } |
3192 } |
3102 my $dllMapKey = lc ($dstFile); |
3193 my $dllMapKey = lc ($dstFile); |
3108 } |
3199 } |
3109 |
3200 |
3110 } |
3201 } |
3111 push @newobydata, $line; |
3202 push @newobydata, $line; |
3112 } |
3203 } |
3204 |
|
3113 @obydata = @newobydata; |
3205 @obydata = @newobydata; |
3114 dump_obydata("tmp7.oby", "result of problem-suppression phase") if ($opt_v); |
3206 dump_obydata("tmp7.oby", "result of problem-suppression phase") if ($opt_v); |
3115 die "ERROR: $errors missing file(s) detected\n" if ($strict && $errors ); |
3207 die "ERROR: $errors missing file(s) detected\n" if ($strict && $errors ); |
3116 } |
3208 } |
3117 |
3209 |
3134 |
3226 |
3135 # If BINARY_SELECTION_ORDER macro is specified in the oby file |
3227 # If BINARY_SELECTION_ORDER macro is specified in the oby file |
3136 if ($binarySelectionOrderFlag) |
3228 if ($binarySelectionOrderFlag) |
3137 { |
3229 { |
3138 # Search in the specified binary order |
3230 # Search in the specified binary order |
3139 if(!defined(@Global_PlatList)) |
3231 if(scalar(@Global_PlatList) == 0) |
3140 { |
3232 { |
3141 @Global_PlatList = Plat_List(); |
3233 @Global_PlatList = get_platlist(); |
3142 } |
3234 } |
3143 my $b; |
3235 my $b; |
3144 my $e; |
3236 my $e; |
3145 foreach my $plat (@Global_PlatList) |
3237 foreach my $plat (@Global_PlatList) |
3146 { |
3238 { |
3147 if ($file =~ /^(.*)\\$plat\\(.*)$/i) |
3239 if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) |
3148 { |
3240 { |
3149 $b = $1; |
3241 $b = $1; |
3150 $e = $2; |
3242 $e = $2; |
3151 last; |
3243 last; |
3152 } |
3244 } |
3153 } |
3245 } |
3154 push(@alternatives, "$b\\$firstDIR\\$e"); |
3246 push(@alternatives, "$b\/$firstDIR\/$e"); |
3155 |
3247 |
3156 foreach my $toDIR (@binarySelectionOrder) |
3248 foreach my $toDIR (@binarySelectionOrder) |
3157 { |
3249 { |
3158 push(@alternatives, "$b\\$toDIR\\$e"); |
3250 push(@alternatives, "$b\/$toDIR\/$e"); |
3159 } |
3251 } |
3160 } |
3252 } |
3161 |
3253 |
3162 # If the file is not found in the specified ABIV2 platform, then select from ARMV5 directory. |
3254 # If the file is not found in the specified ABIV2 platform, then select from armv5 directory. |
3163 # This is necessary as some of the runtime DLLs will be present only in ARMV5 directory. |
3255 # This is necessary as some of the runtime DLLs will be present only in armv5 directory. |
3164 # Add the BPABI Platforms to be added |
3256 # Add the BPABI Platforms to be added |
3165 if(!defined(@Global_BPABIPlats)) |
3257 if(scalar(@Global_BPABIPlats) == 0) |
3166 { |
3258 { |
3167 @Global_BPABIPlats = &BPABIutl_Plat_List; |
3259 @Global_BPABIPlats = &get_bpabiplatlist; |
3168 } |
3260 } |
3169 |
3261 |
3170 foreach my $BpabiPlat (@Global_BPABIPlats) |
3262 foreach my $BpabiPlat (@Global_BPABIPlats) |
3171 { |
3263 { |
3172 if ($fromABI eq "" && $file =~ /^(.*)\\$BpabiPlat\\(.*)$/) |
3264 if ($fromABI eq "" && $file =~ /^(.*)[\/\\]$BpabiPlat[\/\\](.*)$/i) |
3173 { |
3265 { |
3174 push(@alternatives, "$1\\armv5\\$2"); |
3266 push(@alternatives, "$1\/armv5\/$2"); |
3175 } |
3267 } |
3176 } |
3268 } |
3177 |
3269 |
3178 if ($customizedPlat && $fromABI eq "" && $file =~ /^(.*)\\$customizedPlat\\(.*)$/) |
3270 if ($customizedPlat && $fromABI eq "" && $file =~ /^(.*)[\/\\]$customizedPlat[\/\\](.*)$/i) |
3179 { |
3271 { |
3180 my $b = $1; |
3272 my $b = $1; |
3181 my $e = $2; |
3273 my $e = $2; |
3182 # if platform customization |
3274 # if platform customization |
3183 my $rootPlat = Plat_Root($customizedPlat); |
3275 my $rootPlat = get_platroot($customizedPlat); |
3184 |
3276 |
3185 #Check in ARMV7 folder for binaries in case GCCEV7 is used [DEF128457 ] |
3277 #Check in ARMV7 folder for binaries in case GCCEV7 is used [DEF128457 ] |
3186 if($customizedPlat == "GCCEV7") |
3278 if($customizedPlat == "GCCEV7") |
3187 { |
3279 { |
3188 push(@alternatives,"$b\\armv7\\$e"); |
3280 push(@alternatives,"$b\/armv7\/$e"); |
3189 } |
3281 } |
3190 |
3282 |
3191 if( grep /$rootPlat/, @Global_BPABIPlats) |
3283 if( grep /$rootPlat/, @Global_BPABIPlats) |
3192 { |
3284 { |
3193 push(@alternatives, "$b\\armv5\\$e"); |
3285 push(@alternatives, "$b\/armv5\/$e"); |
3194 } |
3286 } |
3195 } |
3287 } |
3196 |
3288 |
3197 if ($fromABI eq "" && $file =~ /^(.*)\\ARMV5_ABIV1\\(.*)$/i) |
3289 if ($fromABI eq "" && $file =~ /^(.*)[\/\\]armv5_abiv1[\/\\](.*)$/i) |
3198 { |
3290 { |
3199 push(@alternatives, "$1\\armv5\\$2"); |
3291 push(@alternatives, "$1\/armv5\/$2"); |
3200 } |
3292 } |
3201 |
3293 |
3202 if ($fromABI ne "" && $file =~ /^(.*)\\$fromABI\\(.*)$/) |
3294 if ($fromABI ne "" && $file =~ /^(.*)[\/\\]$fromABI[\/\\](.*)$/) |
3203 { |
3295 { |
3204 push(@alternatives, "$1\\$toABI\\$2"); |
3296 push(@alternatives, "$1\/$toABI\/$2"); |
3205 } |
3297 } |
3206 |
3298 |
3207 return @alternatives; |
3299 return @alternatives; |
3208 } |
3300 } |
3209 |
3301 |
3213 { |
3305 { |
3214 my $file = shift; |
3306 my $file = shift; |
3215 my @alternatives; |
3307 my @alternatives; |
3216 $customizedPlat = undef; # global (used in feedback) |
3308 $customizedPlat = undef; # global (used in feedback) |
3217 |
3309 |
3218 if(!defined(@Global_PlatList)) |
3310 if(scalar(@Global_PlatList) == 0) |
3219 { |
3311 { |
3220 @Global_PlatList = Plat_List(); |
3312 @Global_PlatList = get_platlist(); |
3221 } |
3313 } |
3222 foreach my $plat (@Global_PlatList) |
3314 foreach my $plat (@Global_PlatList) |
3223 { |
3315 { |
3224 if ($file =~ /^(.*)\\$plat\\(.*)$/i) |
3316 if ($file =~ /^(.*)[\/\\]$plat[\/\\](.*)$/i) |
3225 { |
3317 { |
3226 my $b = $1; |
3318 my $b = $1; |
3227 my $e = $2; |
3319 my $e = $2; |
3228 my $root = Plat_Customizes($plat); |
3320 my $root = get_platcustomizes($plat); |
3229 if ($root) |
3321 if ($root) |
3230 { |
3322 { |
3231 # Preserve the plat that is customized |
3323 # Preserve the plat that is customized |
3232 $customizedPlat = $plat; |
3324 $customizedPlat = $plat; |
3233 |
3325 |
3234 # If a BSF platform customizes another BSF platform (i.e. a |
3326 # If a BSF platform customizes another BSF platform (i.e. a |
3235 # BSF hierarchy exists), look for the file starting from the |
3327 # BSF hierarchy exists), look for the file starting from the |
3236 # child BSF platform and working back to the root BSF platform |
3328 # child BSF platform and working back to the root BSF platform |
3237 while ($root) |
3329 while ($root) |
3238 { |
3330 { |
3239 push(@alternatives, "$b\\$root\\$e"); |
3331 push(@alternatives, "$b\/$root\/$e"); |
3240 |
3332 |
3241 # Temporary special case for ARMV5_ABIV1 and ARMV5_ABIV2 |
3333 # Temporary special case for armv5_abiv1 and armv5_abiv2 |
3242 if ($root =~ /^armv5_abiv[12]$/i) |
3334 if ($root =~ /^armv5_abiv[12]$/i) |
3243 { |
3335 { |
3244 push(@alternatives, "$b\\armv5\\$e"); |
3336 push(@alternatives, "$b\/armv5\/$e"); |
3245 } |
3337 } |
3246 |
3338 |
3247 $root = Plat_Customizes($root); |
3339 $root = get_platcustomizes($root); |
3248 } |
3340 } |
3249 } |
3341 } |
3250 return @alternatives; |
3342 return @alternatives; |
3251 } |
3343 } |
3252 } |
3344 } |
3309 # bitmap=source dest |
3401 # bitmap=source dest |
3310 # |
3402 # |
3311 if ($line =~ /^\s*bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
3403 if ($line =~ /^\s*bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
3312 { |
3404 { |
3313 my $mbm = $1; |
3405 my $mbm = $1; |
3314 my $dest = $2; |
3406 my $dest = $2; |
3315 my $rom_mbm = "$1_rom"; |
3407 my $rom_mbm = "$1_rom"; |
3316 if ($is_xip eq 0) |
3408 if ($is_xip eq 0) |
3317 { |
3409 { |
3318 # non-XIP rom - just include the mbm file |
3410 # non-XIP rom - just include the mbm file |
3319 $line = "data=\"$mbm\"\t\"$dest\"\n"; |
3411 $line = "data=\"$mbm\"\t\"$dest\"\n"; |
3320 } |
3412 } |
3321 else |
3413 else |
3322 { |
3414 { |
3323 if (! -e $rom_mbm || -M $rom_mbm >= -M $mbm) |
3415 if (! -e $rom_mbm || -M $rom_mbm >= -M $mbm) |
3324 { |
3416 { |
3325 system "bmconv /q /r $rom_mbm /m$mbm"; |
3417 is_existinpath("bmconv", romutl::DIE_NOT_FOUND); |
3326 my $bmconv_status = $?; |
3418 |
3419 my $rom_mbm_tmp = $rom_mbm; |
|
3420 my $mbm_tmp = $mbm; |
|
3421 if ($^O =~ /^MSWIN32$/i){ |
|
3422 $mbm_tmp =~ s-\/-\\-g; |
|
3423 $rom_mbm_tmp =~ s-\/-\\-g; |
|
3424 } |
|
3425 |
|
3426 system "bmconv -q -r $rom_mbm_tmp -m$mbm_tmp"; |
|
3427 my $bmconv_status = $?; |
|
3327 die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $rom_mbm); |
3428 die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $rom_mbm); |
3328 } |
3429 } |
3329 $line = "data=\"$rom_mbm\"\t\"$dest\"\n"; |
3430 $line = "data=\"$rom_mbm\"\t\"$dest\"\n"; |
3330 push @tempfiles, $rom_mbm; |
3431 push @tempfiles, $rom_mbm; |
3331 } |
3432 } |
3335 # |
3436 # |
3336 # if file is a compressed ROM image file |
3437 # if file is a compressed ROM image file |
3337 elsif ($line =~ /^\s*compressed-bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
3438 elsif ($line =~ /^\s*compressed-bitmap=\s*"?(\S+)"?\s+"?(\S+)"?/i) |
3338 { |
3439 { |
3339 my $mbm = $1; |
3440 my $mbm = $1; |
3340 my $dest = $2; |
3441 my $dest = $2; |
3341 my $cmprssd_rom_mbm = "$1_rom"; |
3442 my $cmprssd_rom_mbm = "$1_rom"; |
3342 if ($is_xip eq 0) |
3443 if ($is_xip eq 0) |
3343 { |
3444 { |
3344 # non-XIP rom - just include the mbm file |
3445 # non-XIP rom - just include the mbm file |
3345 $line = "data=\"$mbm\"\t\"$dest\"\n"; |
3446 $line = "data=\"$mbm\"\t\"$dest\"\n"; |
3346 } |
3447 } |
3347 else |
3448 else |
3348 { |
3449 { |
3349 if (! -e $cmprssd_rom_mbm || -M $cmprssd_rom_mbm >= -M $mbm) |
3450 if (! -e $cmprssd_rom_mbm || -M $cmprssd_rom_mbm >= -M $mbm) |
3350 { |
3451 { |
3351 system "bmconv /q /s $cmprssd_rom_mbm /m$mbm"; |
3452 is_existinpath("bmconv", romutl::DIE_NOT_FOUND); |
3453 |
|
3454 my $cmprssd_rom_mbm_tmp = $cmprssd_rom_mbm; |
|
3455 my $mbm_tmp = $mbm; |
|
3456 if ($^O =~ /^MSWIN32$/i){ |
|
3457 $mbm_tmp =~ s-\/-\\-g; |
|
3458 $cmprssd_rom_mbm_tmp =~ s-\/-\\-g; |
|
3459 } |
|
3460 |
|
3461 system "bmconv -q -s $cmprssd_rom_mbm_tmp -m$mbm_tmp"; |
|
3352 my $bmconv_status = $?; |
3462 my $bmconv_status = $?; |
3353 die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $cmprssd_rom_mbm); |
3463 die "* bmconv failed\n" if ($bmconv_status != 0 || !-f $cmprssd_rom_mbm); |
3354 } |
3464 } |
3355 $line = "data=\"$cmprssd_rom_mbm\"\t\"$dest\"\n"; |
3465 $line = "data=\"$cmprssd_rom_mbm\"\t\"$dest\"\n"; |
3356 push @tempfiles, $cmprssd_rom_mbm; |
3466 push @tempfiles, $cmprssd_rom_mbm; |
3377 # data=\epoc32\wins\C\System\Alarms\churchbell.snd "System\Alarms\Church bell" |
3487 # data=\epoc32\wins\C\System\Alarms\churchbell.snd "System\Alarms\Church bell" |
3378 # file[0x07060001]=\epoc32\release\MAWD\urel\cAkyb1.dll System\Libs\EKeyb.dll |
3488 # file[0x07060001]=\epoc32\release\MAWD\urel\cAkyb1.dll System\Libs\EKeyb.dll |
3379 # file=\epoc32\release\marm\urel\eikcore.dll System\Libs\Eikcore.dll |
3489 # file=\epoc32\release\marm\urel\eikcore.dll System\Libs\Eikcore.dll |
3380 # alias \System\Bin\DRTRVCT2_2.dll \System\Bin\DRTRVCT2_1.dll |
3490 # alias \System\Bin\DRTRVCT2_2.dll \System\Bin\DRTRVCT2_1.dll |
3381 # |
3491 # |
3492 $line =~ s-\\-\/-g; |
|
3382 if ($line =~ /^\s*TIME\s*=\s*/i) |
3493 if ($line =~ /^\s*TIME\s*=\s*/i) |
3383 { |
3494 { |
3384 return $line; |
3495 return $line; |
3385 } |
3496 } |
3386 elsif($line =~ /^\s*volume\s*=.*/i) |
3497 elsif($line =~ /^\s*volume\s*=.*/i) |
3389 } |
3500 } |
3390 elsif($line =~ /^\s*kerneltrace\s*=.*/i) |
3501 elsif($line =~ /^\s*kerneltrace\s*=.*/i) |
3391 { |
3502 { |
3392 return $line; |
3503 return $line; |
3393 } |
3504 } |
3394 if ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+"\\?(.*)"(.*)$/) |
3505 elsif($line =~ /^\s*bootbinary\s*=(.*)/i) |
3506 { |
|
3507 } |
|
3508 if ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+"\/?(.*)"(.*)$/) |
|
3395 { |
3509 { |
3396 $type = $1; |
3510 $type = $1; |
3397 $variant = ""; |
3511 $variant = ""; |
3398 $pcfile = $2; |
3512 $pcfile = $2; |
3399 $romfile = $3; |
3513 $romfile = $3; |
3400 $tail = $4; |
3514 $tail = $4; |
3401 } |
3515 } |
3402 elsif ($line =~ /^\s*(\S+)(\[\S+\])\s*=\s*(\S+)\s+\\?(\S+)(.*)$/) |
3516 elsif ($line =~ /^\s*(\S+)(\[\S+\])\s*=\s*(\S+)\s+\/?(\S+)(.*)$/) |
3403 { |
3517 { |
3404 $type = $1; |
3518 $type = $1; |
3405 $variant = $2; |
3519 $variant = $2; |
3406 $pcfile = $3; |
3520 $pcfile = $3; |
3407 $romfile = $4; |
3521 $romfile = $4; |
3408 $tail = $5; |
3522 $tail = $5; |
3409 } |
3523 } |
3410 elsif ($line =~ /(\S+)\s*=\s*"([^"]+)"\s+"\\?(.*)"(.*)$/) |
3524 elsif ($line =~ /(\S+)\s*=\s*"([^"]+)"\s+"\/?(.*)"(.*)$/) |
3411 { |
3525 { |
3412 if ($line !~ /^REM MISSING/i) |
3526 if ($line !~ /^REM MISSING/i) |
3413 { |
3527 { |
3414 $type = $1; |
3528 $type = $1; |
3415 $variant = ""; |
3529 $variant = ""; |
3419 } |
3533 } |
3420 else{ |
3534 else{ |
3421 return $line; |
3535 return $line; |
3422 } |
3536 } |
3423 } |
3537 } |
3424 elsif ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+\\?(\S+)(.*)$/) |
3538 elsif ($line =~ /^\s*(\S+)\s*=\s*(\S+)\s+\/?(\S+)(.*)$/) |
3425 { |
3539 { |
3426 $type = $1; |
3540 $type = $1; |
3427 $variant = ""; |
3541 $variant = ""; |
3428 $pcfile = $2; |
3542 $pcfile = $2; |
3429 $romfile = $3; |
3543 $romfile = $3; |
3449 if ($enforceSysBin) |
3563 if ($enforceSysBin) |
3450 { |
3564 { |
3451 if ($DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\\bin/i |
3565 if ($DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\\bin/i |
3452 && $DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\/bin/i) |
3566 && $DllDataMap{$patchdlldatamap_key}->{dstpath} !~ /^sys\/bin/i) |
3453 { |
3567 { |
3454 $DllDataMap{$patchdlldatamap_key}->{dstpath} = "sys\\bin"; |
3568 $DllDataMap{$patchdlldatamap_key}->{dstpath} = "sys\/bin"; |
3455 } |
3569 } |
3456 } |
3570 } |
3457 |
3571 |
3458 my $dllfile = $DllDataMap{$patchdlldatamap_key}->{dstpath} . "\\". $romfilename; |
3572 my $dllfile = $DllDataMap{$patchdlldatamap_key}->{dstpath} . "\/". $romfilename; |
3459 |
3573 |
3460 $line = "$1 "; |
3574 $line = "$1 "; |
3461 $line .= "$dllfile "; |
3575 $line .= "$dllfile "; |
3462 |
3576 |
3463 # Convert value into decimal (used to be done in AddDllDataInfo, but that limited us to |
3577 # Convert value into decimal (used to be done in AddDllDataInfo, but that limited us to |
3554 |
3668 |
3555 $line .= "$scalarSize $value\n"; |
3669 $line .= "$scalarSize $value\n"; |
3556 |
3670 |
3557 return $line; |
3671 return $line; |
3558 } |
3672 } |
3559 elsif ($line =~ /^\s*(\S+)\s*(\S+)\s+\\?(\S+)(.*)$/) |
3673 elsif ($line =~ /^\s*(\S+)\s*(\S+)\s+\/?(\S+)(.*)$/) |
3560 { |
3674 { |
3561 $type = $1; |
3675 $type = $1; |
3562 $variant = ""; |
3676 $variant = ""; |
3563 $pcfile = $2; |
3677 $pcfile = $2; |
3564 $romfile = $3; |
3678 $romfile = $3; |
3586 # Buildrom should generate warning when destination path provided for a file |
3700 # Buildrom should generate warning when destination path provided for a file |
3587 # is not a standard path(as per platsec) and "PlatSecEnforceSysBin" is turned off. |
3701 # is not a standard path(as per platsec) and "PlatSecEnforceSysBin" is turned off. |
3588 my $warnFlag = 1; |
3702 my $warnFlag = 1; |
3589 my $mustBeSysBin = $enforceSysBin; |
3703 my $mustBeSysBin = $enforceSysBin; |
3590 if ($type =~ /^(data|compress|nocompress)$/i |
3704 if ($type =~ /^(data|compress|nocompress)$/i |
3591 && $romfile !~ /^system\\(bin|libs|programs)\\/i) |
3705 && $romfile !~ /^system\/(bin|libs|programs)\//i) |
3592 { |
3706 { |
3593 $mustBeSysBin = 0; |
3707 $mustBeSysBin = 0; |
3594 $warnFlag = 0; |
3708 $warnFlag = 0; |
3595 } |
3709 } |
3596 |
3710 |
3603 # for multilinguify 'alias'es (generally resource files) 'MustBeSysBin' should not be enforced. |
3717 # for multilinguify 'alias'es (generally resource files) 'MustBeSysBin' should not be enforced. |
3604 if(defined($multiLinguifyAlias{$pcfile})) { |
3718 if(defined($multiLinguifyAlias{$pcfile})) { |
3605 return $line; |
3719 return $line; |
3606 } |
3720 } |
3607 |
3721 |
3608 my $filename = "\\$romfile"; # in case no path is specified |
3722 my $filename = "\/$romfile"; # in case no path is specified |
3609 $filename = substr $filename, rindex($filename, "\\"); |
3723 $filename = substr $filename, rindex($filename, "\/"); |
3610 $romfile = "sys\\bin".$filename; |
3724 $romfile = "sys\/bin".$filename; |
3611 |
3725 |
3612 if ($pcfile !~ /^sys\\bin\\/i |
3726 if ($pcfile !~ /^sys\\bin\\/i |
3613 && $pcfile !~ /^sys\/bin/i) |
3727 && $pcfile !~ /^sys\/bin/i) |
3614 { |
3728 { |
3615 my $pcfilename = "\\$pcfile"; # in case no path is specified |
3729 my $pcfilename = "\/$pcfile"; # in case no path is specified |
3616 $pcfilename = substr $pcfilename, rindex($pcfilename, "\\"); |
3730 $pcfilename = substr $pcfilename, rindex($pcfilename, "\/"); |
3617 $pcfile = "sys\\bin".$pcfilename; |
3731 $pcfile = "sys\/bin".$pcfilename; |
3618 } |
3732 } |
3619 return "$type$variant $pcfile \t$romfile$tail\n"; |
3733 return "$type$variant $pcfile \t$romfile$tail\n"; |
3620 } |
3734 } |
3621 |
3735 |
3622 if ($romfile !~ /^sys\\bin\\/i |
3736 if ($romfile !~ /^sys\\bin\\/i |
3623 && $romfile !~ /^sys\/bin/i) |
3737 && $romfile !~ /^sys\/bin/i) |
3624 { |
3738 { |
3625 my $filename = "\\$romfile"; # in case no path is specified |
3739 my $filename = "\/$romfile"; # in case no path is specified |
3626 $filename = substr $filename, rindex($filename, "\\"); |
3740 $filename = substr $filename, rindex($filename, "\/"); |
3627 $romfile = "sys\\bin".$filename; |
3741 $romfile = "sys\/bin".$filename; |
3628 } |
3742 } |
3629 } |
3743 } |
3630 else |
3744 else |
3631 { |
3745 { |
3632 if ($warnFlag && $romfile !~ /^sys\\bin\\/i && $romfile !~ /^sys\/bin/i) |
3746 if ($warnFlag && $romfile !~ /^sys\\bin\\/i && $romfile !~ /^sys\/bin/i) |
3750 if( ($newline !~ /^\s*TIME\s*=\s*/i) |
3864 if( ($newline !~ /^\s*TIME\s*=\s*/i) |
3751 &&($newline !~ /^\s*volume\s*=.*/i) |
3865 &&($newline !~ /^\s*volume\s*=.*/i) |
3752 &&($newline !~ /^\s*kerneltrace\s*=.*/i)) |
3866 &&($newline !~ /^\s*kerneltrace\s*=.*/i)) |
3753 { |
3867 { |
3754 my $tmpline = $newline; |
3868 my $tmpline = $newline; |
3755 if($^O =~ /^MSWin32$/i) |
3869 if(&is_windows) |
3756 { |
3870 { |
3757 $newline =~ s-\/-\\-go; |
3871 $newline =~ s-\/-\\-go; |
3758 if($opt_v) |
3872 if($opt_v) |
3759 { |
3873 { |
3760 print LOGWIN $newline; |
3874 print LOGWIN $newline; |
3780 close LOGWIN; |
3894 close LOGWIN; |
3781 close LOGLINUX; |
3895 close LOGLINUX; |
3782 } |
3896 } |
3783 |
3897 |
3784 exit(1) if($errors && $strict); |
3898 exit(1) if($errors && $strict); |
3785 |
|
3786 # Handle ROMNAME and possible -o override |
3899 # Handle ROMNAME and possible -o override |
3787 if ($opt_o ne "") |
3900 if ($opt_o ne "") |
3788 { |
3901 { |
3789 $romname=$opt_o; |
3902 $romname=$opt_o; |
3790 if ($opt_o=~/(\S+)\.(\S+)/) |
3903 if ($opt_o=~/(\S+)\.(\S+)/) |
4006 |
4119 |
4007 my $file; |
4120 my $file; |
4008 my $prevdir = ""; |
4121 my $prevdir = ""; |
4009 foreach $file (sort {uc($a) cmp uc($b)} keys %romfiles) |
4122 foreach $file (sort {uc($a) cmp uc($b)} keys %romfiles) |
4010 { |
4123 { |
4011 my $dir = substr $file,0,rindex($file, "\\"); |
4124 my $dir = substr $file,0,rindex($file, "\/"); |
4012 if (uc $dir ne uc $prevdir) |
4125 if (uc $dir ne uc $prevdir) |
4013 { |
4126 { |
4014 $prevdir = $dir; |
4127 $prevdir = $dir; |
4015 print DIRFILE "\n"; |
4128 print DIRFILE "\n"; |
4016 } |
4129 } |
4097 } |
4210 } |
4098 else |
4211 else |
4099 { |
4212 { |
4100 $rom_compression_type = ""; |
4213 $rom_compression_type = ""; |
4101 } |
4214 } |
4215 |
|
4216 #Compose command line options for Cache. |
|
4217 my $cache_options; |
|
4218 if($opt_cache == 1) |
|
4219 { |
|
4220 $cache_options = "-cache "; |
|
4221 } |
|
4222 if($opt_nocache == 1) |
|
4223 { |
|
4224 $cache_options .= "-nocache "; |
|
4225 } |
|
4226 if($opt_cleancache == 1) |
|
4227 { |
|
4228 $cache_options .= "-cleancache"; |
|
4229 } |
|
4102 |
4230 |
4103 my $rombuild; |
4231 my $rombuild; |
4104 if(!$geninc) |
4232 if(!$geninc) |
4105 { |
4233 { |
4106 $rombuild = "rombuild -slog $rom_compression_type $logLevel $lowMem $opt_fastcompress $opt_jobs"; |
4234 $rombuild = "rombuild -slog $rom_compression_type $logLevel $lowMem $opt_jobs"; |
4107 } |
4235 } |
4108 else |
4236 else |
4109 { |
4237 { |
4110 $rombuild = "rombuild -slog $rom_compression_type -geninc $logLevel $lowMem $opt_fastcompress $opt_jobs"; |
4238 $rombuild = "rombuild -slog $rom_compression_type -geninc $logLevel $lowMem $opt_jobs"; |
4111 } |
4239 } |
4112 if($gendep) |
4240 if($gendep) |
4113 { |
4241 { |
4114 $rombuild .= " -gendep"; |
4242 $rombuild .= " -gendep"; |
4115 } |
4243 } |
4116 my $rofsbuild = "rofsbuild -slog $logLevel $lowMem $opt_fastcompress $opt_jobs"; |
4244 $rombuild .= " -k" if($opt_k); |
4245 my $rofsbuild = "rofsbuild -slog $logLevel $lowMem $opt_jobs $cache_options"; |
|
4117 foreach my $arg (keys %rombuildOptions) |
4246 foreach my $arg (keys %rombuildOptions) |
4118 { |
4247 { |
4119 $rombuild .= " $arg"; |
4248 $rombuild .= " $arg"; |
4120 } |
4249 } |
4121 |
4250 $rofsbuild .= " -k" if($opt_k); |
4122 for (my $romidx=0; $romidx<8; $romidx++) |
4251 for (my $romidx=0; $romidx<8; $romidx++) |
4123 { |
4252 { |
4124 my $obeyfile=$romimage[$romidx]{obeyfile}; |
4253 my $obeyfile=$romimage[$romidx]{obeyfile}; |
4125 my $xip=$romimage[$romidx]{xip}; |
4254 my $xip=$romimage[$romidx]{xip}; |
4126 my $compress=$romimage[$romidx]{compress}; |
4255 my $compress=$romimage[$romidx]{compress}; |
4148 $compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/; |
4277 $compress =~m/\s-(compression)(method)\s(none|inflate|bytepair)/; |
4149 print "* ".$1." ".$2.": ".$3; |
4278 print "* ".$1." ".$2.": ".$3; |
4150 } |
4279 } |
4151 if ($xip) |
4280 if ($xip) |
4152 { |
4281 { |
4282 is_existinpath("rombuild", romutl::DIE_NOT_FOUND); |
|
4283 $rombuild .= " -symbols" unless($nosymbols) ; |
|
4153 run_rombuilder($rombuild.$compress, $obeyfile, "ROMBUILD.LOG"); |
4284 run_rombuilder($rombuild.$compress, $obeyfile, "ROMBUILD.LOG"); |
4154 if(!$nosymbols){ |
|
4155 print "* Writing $obeyfile.symbol - ROM symbol file\n"; |
|
4156 print "* Executing maksym $obeyfile.log $obeyfile.symbol\n" if ($opt_v); |
|
4157 system("maksym $obeyfile.log $obeyfile.symbol >maksym.out"); |
|
4158 exit(1) if (!-e "$obeyfile.symbol"); |
|
4159 } |
|
4160 } |
4285 } |
4161 else |
4286 else |
4162 { |
4287 { |
4163 # efficient_rom_paging.pm can move everything to core rom. |
4288 # efficient_rom_paging.pm can move everything to core rom. |
4164 # If that is the case, don't run rofsbuild at all to avoid errors. |
4289 # If that is the case, don't run rofsbuild at all to avoid errors. |
4165 use constant TRUE => 1; |
4290 # use constant TRUE => 1; |
4166 use constant FALSE => 0; |
4291 # use constant FALSE => 0; |
4167 my $run_rofs_build = FALSE; |
4292 my $run_rofs_build = 0; |
4168 |
4293 |
4169 open OBYFILE, "$obeyfile.oby"; |
4294 open OBYFILE, "$obeyfile.oby"; |
4170 for (<OBYFILE>) |
4295 for (<OBYFILE>) |
4171 { |
4296 { |
4172 if (is_oby_statement($_)) |
4297 if (is_oby_statement($_)) |
4173 { |
4298 { |
4174 $run_rofs_build = TRUE; |
4299 $run_rofs_build = 1; |
4175 last; |
4300 last; |
4176 } |
4301 } |
4177 } |
4302 } |
4178 close OBYFILE; |
4303 close OBYFILE; |
4179 if ($run_rofs_build) |
4304 if ($run_rofs_build) |
4180 { |
4305 { |
4306 is_existinpath("rofsbuild", romutl::DIE_NOT_FOUND); |
|
4307 if(!$nosymbols) |
|
4308 { |
|
4309 $rofsbuild .= " -symbols"; |
|
4310 } |
|
4181 run_rombuilder($rofsbuild.$compress, $obeyfile, "ROFSBUILD.LOG"); |
4311 run_rombuilder($rofsbuild.$compress, $obeyfile, "ROFSBUILD.LOG"); |
4182 if(!$nosymbols){ |
|
4183 print "* Writing $obeyfile.symbol - ROFS symbol file\n"; |
|
4184 print "* Executing maksymrofs $obeyfile.log $obeyfile.symbol\n" if ($opt_v); |
|
4185 system("maksymrofs $obeyfile.log $obeyfile.symbol >maksym.out"); |
|
4186 exit(1) if (!-e "$obeyfile.symbol" ); |
|
4187 } |
|
4188 } |
4312 } |
4189 } |
4313 } |
4190 unlink "rombuild.log"; |
4314 unlink "rombuild.log"; |
4191 unlink "maksym.out"; |
4315 unlink "maksym.out"; |
4192 } |
4316 } |
4212 # |
4336 # |
4213 |
4337 |
4214 sub relative_path |
4338 sub relative_path |
4215 { |
4339 { |
4216 my ($arg) = @_; |
4340 my ($arg) = @_; |
4217 return $arg if ($arg !~ /^\\/); # not an absolute path |
4341 return $arg if ($arg !~ /^\//); # not an absolute path |
4218 if ($uppath eq "x") |
4342 if ($uppath eq "x") |
4219 { |
4343 { |
4220 $uppath=cwd; |
4344 $uppath=cwd; |
4221 $uppath=~s-/-\\-go; # separator from Perl 5.005_02+ is forward slash |
4345 $uppath=~s-\\-\/-go; # separator from Perl 5.005_02+ is forward slash |
4222 $uppath=~s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash |
4346 $uppath=~s-^(.*[^\/])$-$1\/-o; # ensure path ends with a backslash |
4223 $uppath=~s-\\([^\\]+)-\\..-og; # convert directories into .. |
4347 $uppath=~s-\/([^\/]+)-\/..-og; # convert directories into .. |
4224 $uppath=~s-^.:\\--o; # remove drive letter and leading backslash |
4348 $uppath=~s-^.:\/--o; # remove drive letter and leading backslash |
4225 } |
4349 } |
4226 $arg=~s-^\\--o; # remove leading backslash from original path |
4350 $arg=~s-^\/--o; # remove leading backslash from original path |
4227 return "$uppath$arg"; |
4351 return "$uppath$arg"; |
4228 } |
4352 } |
4229 |
4353 |
4230 # Returns the global @obydata reference to support external tool invocation. |
4354 # Returns the global @obydata reference to support external tool invocation. |
4231 sub getOBYDataRef{ |
4355 sub getOBYDataRef{ |
4451 my $aDllFile = $DllMapRef->{srcfile}; |
4575 my $aDllFile = $DllMapRef->{srcfile}; |
4452 my $SymbolCount = scalar ( keys %{$DllMapRef}) - 2; #The map has 'srcfile' and 'dstpath' special keys besides the symbols. |
4576 my $SymbolCount = scalar ( keys %{$DllMapRef}) - 2; #The map has 'srcfile' and 'dstpath' special keys besides the symbols. |
4453 |
4577 |
4454 my $DllSymMapRef; |
4578 my $DllSymMapRef; |
4455 |
4579 |
4456 my @BPABIPlats = &BPABIutl_Plat_List; |
4580 my @BPABIPlats = &get_bpabiplatlist; |
4457 my $matchedSymbols = 0; |
4581 my $matchedSymbols = 0; |
4458 my $globalSyms = 0; |
4582 my $globalSyms = 0; |
4459 my @platlist = &Plat_List(); |
4583 my @platlist = &get_platlist; |
4460 my $platName; |
4584 my $platName; |
4461 my $rootPlatName; |
4585 my $rootPlatName; |
4462 my $plat = "ARMV5"; |
4586 my $plat = "armv5"; |
4463 $plat = &Variant_GetMacro() ? $plat."_ABIV1" : $plat."_ABIV2"; |
4587 $plat = &get_abiv2mode() ? $plat."_abiv1" : $plat."_abiv2"; |
4464 |
4588 |
4465 foreach my $plat(@platlist) |
4589 foreach my $plat(@platlist) |
4466 { |
4590 { |
4467 if(($aDllFile =~ /\\($plat)\\/i) or ($aDllFile =~ /\\($plat\.\w+)\\/i )) |
4591 if(($aDllFile =~ /[\/\\]($plat)[\/\\]/i) or ($aDllFile =~ /[\/\\]($plat\.\w+)[\/\\]/i )) |
4468 { |
4592 { |
4469 $platName = $1; |
4593 $platName = $1; |
4470 last; |
4594 last; |
4471 } |
4595 } |
4472 } |
4596 } |
4473 $rootPlatName = &Plat_Customizes($platName) ? &Plat_Root($platName) : $platName; |
4597 $rootPlatName = &get_platcustomizes($platName) ? &get_platroot($platName) : $platName; |
4474 |
4598 |
4475 # Map files will be referred for all ARM platforms, |
4599 # Map files will be referred for all ARM platforms, |
4476 # and for BSF platforms which cutomizes ARM platforms. |
4600 # and for BSF platforms which cutomizes ARM platforms. |
4477 if($rootPlatName =~ /^ARMV5|$plat$/i){ |
4601 if($rootPlatName =~ /^armv5|$plat$/i){ |
4478 my $mapfile = "${aDllFile}.map"; |
4602 my $mapfile = "${aDllFile}.map"; |
4479 |
4603 |
4480 open MAPFILE, "$mapfile" or die "Can't open $mapfile\n"; |
4604 open MAPFILE, "$mapfile" or die "Can't open $mapfile\n"; |
4481 while(<MAPFILE>){ |
4605 while(<MAPFILE>){ |
4482 my $line = $_; |
4606 my $line = $_; |
4516 |
4640 |
4517 # Record the address and the size of the symbol. |
4641 # Record the address and the size of the symbol. |
4518 $DllSymMapRef->{dataAddr} = $symbolValue; |
4642 $DllSymMapRef->{dataAddr} = $symbolValue; |
4519 $DllSymMapRef->{size} = $symbolSz; |
4643 $DllSymMapRef->{size} = $symbolSz; |
4520 |
4644 |
4645 |
|
4521 $matchedSymbols++; |
4646 $matchedSymbols++; |
4522 if( $matchedSymbols >= $SymbolCount){ |
4647 if( $matchedSymbols >= $SymbolCount){ |
4523 last; |
4648 last; |
4524 } |
4649 } |
4525 } |
4650 } |
4542 $errors++ if($strict); |
4667 $errors++ if($strict); |
4543 next; #go to the next patch dll data statement |
4668 next; #go to the next patch dll data statement |
4544 } |
4669 } |
4545 if( $aDllFile =~ /(.*)\.[^.]+$/ ){ |
4670 if( $aDllFile =~ /(.*)\.[^.]+$/ ){ |
4546 my $proxydsofile = "$1.dso"; |
4671 my $proxydsofile = "$1.dso"; |
4547 $proxydsofile =~ s/$abiDir\\(.*)\\/ARMV5\\LIB\\/ig; |
4672 $proxydsofile =~ s-$abiDir\/(.*)\/-armv5\/LIB\/-ig; |
4548 open PIPE, "getexports -d $proxydsofile|" or die "Can't open file $proxydsofile\n"; |
4673 open PIPE, "getexports -d $proxydsofile|" or die "Can't open file $proxydsofile\n"; |
4549 while (<PIPE>){ |
4674 while (<PIPE>){ |
4550 my $line = $_; |
4675 my $line = $_; |
4551 if($line =~ /\s*(\S+)\s+(\d+)\s+((\S+)\s+(\d+))?/){ |
4676 if($line =~ /\s*(\S+)\s+(\d+)\s+((\S+)\s+(\d+))?/){ |
4552 my $symbol = $1; |
4677 my $symbol = $1; |
4585 # absolute paths starting with slashes. |
4710 # absolute paths starting with slashes. |
4586 sub addDrivesToFeatureVariantPaths |
4711 sub addDrivesToFeatureVariantPaths |
4587 { |
4712 { |
4588 return unless $featureVariant{'VALID'}; |
4713 return unless $featureVariant{'VALID'}; |
4589 |
4714 |
4590 my $current = cwd(); |
4715 my $current = &get_epocdrive; |
4591 my $drive = $1 if ($current =~ /^(.:)/); |
4716 my $drive = $1 if ($current =~ /^(.:)/); |
4592 |
4717 |
4593 # pre-include file |
4718 # pre-include file |
4594 my $HRH = $featureVariant{'VARIANT_HRH'}; |
4719 my $HRH = $featureVariant{'VARIANT_HRH'}; |
4595 $featureVariant{'VARIANT_HRH'} = $drive . $HRH if ($HRH =~ /^[\\\/]/); |
4720 $featureVariant{'VARIANT_HRH'} = $drive . $HRH if ($HRH =~ /^[\\\/]/); |
4609 { |
4734 { |
4610 if($needSmrImage) |
4735 if($needSmrImage) |
4611 { |
4736 { |
4612 foreach my $oby (@obeyFileList) |
4737 foreach my $oby (@obeyFileList) |
4613 { |
4738 { |
4739 is_existinpath("rofsbuild", romutl::ERROR_NOT_FOUND); |
|
4614 my $command = "rofsbuild -slog -smr=$oby.oby"; |
4740 my $command = "rofsbuild -slog -smr=$oby.oby"; |
4615 print "* Executing $command\n" if($opt_v); |
4741 print "* Executing $command\n" if($opt_v); |
4616 system($command); |
4742 system($command); |
4617 if($? != 0) |
4743 if($? != 0) |
4618 { |
4744 { |
4649 { |
4775 { |
4650 print "\n SMR image creating error for empty image name!\n"; |
4776 print "\n SMR image creating error for empty image name!\n"; |
4651 } |
4777 } |
4652 } |
4778 } |
4653 |
4779 |
4780 sub checkcase() |
|
4781 { |
|
4782 if (&is_windows) |
|
4783 { |
|
4784 my @checkcase_obydatatemp = @obydata; |
|
4785 |
|
4786 # call the phase without external tools. |
|
4787 plugin_phase(); |
|
4788 multlinguify_phase(); |
|
4789 #spi_creation_phase(); #spi creation phase will delete some lines, so do not call this phase |
|
4790 suppress_phase(); |
|
4791 process_dlldata(); |
|
4792 bitmap_aif_converison_phase(); |
|
4793 |
|
4794 my $checkcase_log = "checkcase.log"; |
|
4795 unlink $checkcase_log; |
|
4796 |
|
4797 open CHECKCASELOG, ">$checkcase_log" or die("* Can't create $checkcase_log\n"); |
|
4798 my @checkcase_lines = @obydata; |
|
4799 my %checkcase_macro; |
|
4800 my @checkcase_macrodir; |
|
4801 my $checkcase_line; |
|
4802 print CHECKCASELOG "======================Macro check part:======================\n"; |
|
4803 foreach $checkcase_line (@checkcase_lines) |
|
4804 { |
|
4805 track_source($checkcase_line); |
|
4806 $checkcase_line =~ s-\/-\\-g; |
|
4807 $checkcase_line =~ s-\\\\-\\-g; |
|
4808 if ($checkcase_line =~ /^\s*REM\s*(re)?defined\s*(\w*)\s*as\s*(\S+)/) |
|
4809 { |
|
4810 my $checkcase_macrocontent = $3; |
|
4811 my $checkcase_macroname = $2; |
|
4812 if ($checkcase_macrocontent =~ /[a-zA-Z]/) |
|
4813 { |
|
4814 $checkcase_macro{$checkcase_macroname} = $checkcase_macrocontent; |
|
4815 checkcase_macro(\@checkcase_macrodir, $checkcase_macroname, $checkcase_macrocontent); |
|
4816 } |
|
4817 } |
|
4818 } |
|
4819 print CHECKCASELOG "======================Macro check part end======================\n\n"; |
|
4820 print CHECKCASELOG "======================File check part:======================\n"; |
|
4821 foreach $checkcase_line (@checkcase_lines) |
|
4822 { |
|
4823 if ($checkcase_line =~ /^\s*REM\s*.*/) |
|
4824 { |
|
4825 next; |
|
4826 } |
|
4827 if ($checkcase_line =~ /^\s*#\s*\d+\s*\"(\S+)\"\s*\d*\s*$/) #oby filename |
|
4828 { |
|
4829 my $checkcase_whichfile = $1; |
|
4830 checkcase_obyfilename($checkcase_whichfile); |
|
4831 track_source($checkcase_line); |
|
4832 }elsif ($checkcase_line =~ /^\s*\S+\s*=\s*"([^"]+)"\s+\S*\s*/ |
|
4833 || $checkcase_line =~ /^\s*\S+\s*=\s*(\S+)\s+\S*\s*/) #oby content file name |
|
4834 { |
|
4835 my $checkcase_pcsidefile = $1; |
|
4836 checkcase_pcsidefilename(\@checkcase_macrodir, $checkcase_pcsidefile); |
|
4837 } |
|
4838 } |
|
4839 print CHECKCASELOG "======================File check part end======================\n"; |
|
4840 close CHECKCASELOG; |
|
4841 |
|
4842 @obydata = @checkcase_obydatatemp; |
|
4843 }else |
|
4844 { |
|
4845 print "WARNING: checkcase option is only valid on windows.\n"; |
|
4846 } |
|
4847 } |
|
4848 |
|
4849 sub checkcase_macro() |
|
4850 { |
|
4851 my $macrodir = shift; |
|
4852 my $name = shift; |
|
4853 my $content = shift; |
|
4854 |
|
4855 if ($content =~ /epoc32/i && (-d $content)) |
|
4856 { |
|
4857 my $realdir = `directory.bat $content`; |
|
4858 $realdir =~ s/\s+$//g; |
|
4859 $realdir =~ s/^\s*\w://g if ($content !~ /^\w:/); |
|
4860 $realdir =~ s/\\$//g if ($content !~ /\\$/); |
|
4861 $realdir .= "\\" if ($content =~ /\\$/ && $realdir !~ /\\$/); |
|
4862 $sourcefile =~ s/\//\\/g; |
|
4863 $sourcefile =~ s/\\\\/\\/g; |
|
4864 if ($realdir ne $content) |
|
4865 { |
|
4866 print CHECKCASELOG "check case: macro name is $name\n"; |
|
4867 print CHECKCASELOG "WARNING: macro case is not equal to real.\n"; |
|
4868 print CHECKCASELOG "file name is $sourcefile\n"; |
|
4869 print CHECKCASELOG "current is $content\n"; |
|
4870 print CHECKCASELOG "expect is $realdir\n\n"; |
|
4871 checkcase_convert($sourcefile, $content, $realdir); |
|
4872 } |
|
4873 $content =~ s-\\-\\\\-g; |
|
4874 push @$macrodir, $content; |
|
4875 }else |
|
4876 { |
|
4877 if($name eq "PLATFORM_NAME") |
|
4878 { |
|
4879 $content =~ s-\\-\\\\-g; |
|
4880 $content =~ s-\.-\\\.-g; |
|
4881 $checkcase_platform = $content; |
|
4882 } |
|
4883 } |
|
4884 } |
|
4885 |
|
4886 sub checkcase_obyfilename() |
|
4887 { |
|
4888 my $checkfile = shift; |
|
4889 if (-e $checkfile) |
|
4890 { |
|
4891 while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){}; |
|
4892 $sourcefile =~ s/\//\\/g; |
|
4893 if ($checkfile eq $sourcefile) |
|
4894 { |
|
4895 return; |
|
4896 } |
|
4897 my($filename, $dir, $suffix) = fileparse($checkfile); |
|
4898 |
|
4899 my $realdir = `directory.bat $dir`; |
|
4900 $realdir =~ s/\s+$//g; |
|
4901 $realdir .= "\\" if ($realdir !~ /\\$/); |
|
4902 if ($realdir ne $dir) |
|
4903 { |
|
4904 print CHECKCASELOG "check case: oby file name is $checkfile\n"; |
|
4905 print CHECKCASELOG "WARNING: dir case is not equal to real.\n"; |
|
4906 my $tempsrcfile = $sourcefile; |
|
4907 $tempsrcfile =~ s/\\\\/\\/g; |
|
4908 print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
4909 print CHECKCASELOG "current is $dir\n"; |
|
4910 print CHECKCASELOG "expect is $realdir\n\n"; |
|
4911 checkcase_convert($sourcefile, $dir, $realdir); |
|
4912 } |
|
4913 |
|
4914 my $currentdir = cwd; |
|
4915 chdir "$dir"; |
|
4916 my @realfile = `dir "$filename" 2>&1`; |
|
4917 my $line; |
|
4918 foreach $line (@realfile) |
|
4919 { |
|
4920 if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/) |
|
4921 { |
|
4922 my $realfilename = $5; |
|
4923 my $filetemp = lc $filename; |
|
4924 my $realtemp = lc $realfilename; |
|
4925 if ($filetemp eq $realtemp && $realfilename ne $filename) |
|
4926 { |
|
4927 print CHECKCASELOG "check case: oby file name is $checkfile\n"; |
|
4928 print CHECKCASELOG "WARNING: filename case is not equal to real.\n"; |
|
4929 my $tempsrcfile = $sourcefile; |
|
4930 $tempsrcfile =~ s/\\\\/\\/g; |
|
4931 print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
4932 print CHECKCASELOG "current is $filename\n"; |
|
4933 print CHECKCASELOG "expect is $realfilename\n\n"; |
|
4934 checkcase_convert($sourcefile, $filename, $realfilename); |
|
4935 } |
|
4936 } |
|
4937 } |
|
4938 chdir "$currentdir"; |
|
4939 } |
|
4940 } |
|
4941 |
|
4942 sub checkcase_pcsidefilename() |
|
4943 { |
|
4944 my $macrodirs = shift; |
|
4945 my $checkfile = shift; |
|
4946 $checkfile =~ s/^\"//g; |
|
4947 $checkfile =~ s/\"$//g; |
|
4948 if (-e $checkfile) |
|
4949 { |
|
4950 while ($checkfile=~s-[\\](?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go){}; |
|
4951 $sourcefile =~ s/\//\\/g; |
|
4952 my($filename, $dir, $suffix) = fileparse($checkfile); |
|
4953 if ($dir eq "\.\\") |
|
4954 { |
|
4955 $dir = cwd; |
|
4956 $dir =~ s/\//\\/g; |
|
4957 $dir .= "\\" if ($dir !~ /\\$/); |
|
4958 } |
|
4959 |
|
4960 my $realdir = `directory.bat $dir`; |
|
4961 $realdir =~ s/\s+$//g; |
|
4962 $realdir =~ s/^\s*\w://g if ($dir !~ /^\w:/); |
|
4963 $realdir .= "\\" if ($realdir !~ /\\$/); |
|
4964 my $dirtemp = $dir; |
|
4965 if ($checkcase_test) |
|
4966 { |
|
4967 my $macrodirtemp = ""; |
|
4968 foreach my $macrodir (@$macrodirs) |
|
4969 { |
|
4970 if ($dirtemp =~ /^$macrodir(.*)$/) |
|
4971 { |
|
4972 $macrodirtemp = $macrodir if (length($macrodirtemp) < length($macrodir)); |
|
4973 } |
|
4974 } |
|
4975 if ($macrodirtemp ne "") |
|
4976 { |
|
4977 $dirtemp =~ s/^$macrodirtemp//g; |
|
4978 $realdir =~ s/^$macrodirtemp//ig; |
|
4979 } |
|
4980 } |
|
4981 if ($realdir ne $dirtemp) |
|
4982 { |
|
4983 print CHECKCASELOG "check case: pc side file name is $checkfile\n"; |
|
4984 print CHECKCASELOG "WARNING: dir case is not equal to real.\n"; |
|
4985 my $tempsrcfile = $sourcefile; |
|
4986 $tempsrcfile =~ s/\\\\/\\/g; |
|
4987 print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
4988 print CHECKCASELOG "current is $dirtemp\n"; |
|
4989 print CHECKCASELOG "expect is $realdir\n\n"; |
|
4990 checkcase_convert($sourcefile, $dirtemp, $realdir); |
|
4991 } |
|
4992 |
|
4993 my $currentdir = cwd; |
|
4994 chdir "$dir"; |
|
4995 my @realfile = `dir "$filename" 2>&1`; |
|
4996 my $line; |
|
4997 foreach $line (@realfile) |
|
4998 { |
|
4999 if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+(.+)\s*/) |
|
5000 { |
|
5001 my $realfilename = $5; |
|
5002 my $filetemp = lc $filename; |
|
5003 my $realtemp = lc $realfilename; |
|
5004 if ($filetemp eq $realtemp && $realfilename ne $filename) |
|
5005 { |
|
5006 print CHECKCASELOG "check case: pc side file name is $checkfile\n"; |
|
5007 print CHECKCASELOG "WARNING: filename case is not equal to real.\n"; |
|
5008 my $tempsrcfile = $sourcefile; |
|
5009 $tempsrcfile =~ s/\\\\/\\/g; |
|
5010 print CHECKCASELOG "file name is $tempsrcfile\n"; |
|
5011 print CHECKCASELOG "current is $filename\n"; |
|
5012 print CHECKCASELOG "expect is $realfilename\n\n"; |
|
5013 checkcase_convert($sourcefile, $filename, $realfilename); |
|
5014 } |
|
5015 } |
|
5016 } |
|
5017 chdir "$currentdir"; |
|
5018 } |
|
5019 } |
|
5020 |
|
5021 sub checkcase_convert() |
|
5022 { |
|
5023 return if (!$checkcase_test); |
|
5024 |
|
5025 my $file = shift; |
|
5026 my $origin = shift; |
|
5027 my $real = shift; |
|
5028 |
|
5029 my @realfile = `dir "$file" 2>&1`; |
|
5030 my $line; |
|
5031 foreach $line (@realfile) |
|
5032 { |
|
5033 if ($line =~ /^\s*(\S+)\s+(\d{2}:\d{2})\s+(PM|AM)?\s+([\d\,])+\s+([\S]+)\s*/) |
|
5034 { |
|
5035 my $realfilename = $5; |
|
5036 $realfilename =~ s-\.-\\\.-g; |
|
5037 $file =~ s-$realfilename$--ig; |
|
5038 $realfilename =~ s-\\\.-\.-g; |
|
5039 $file .= $realfilename; |
|
5040 } |
|
5041 } |
|
5042 |
|
5043 my $tempfile = $file.".temp"; |
|
5044 my $usemultimacro = 0; |
|
5045 my $uses60macro_aifrsc = 0; |
|
5046 my $uses60macro_exe = 0; |
|
5047 my $uses60macro_aificon = 0; |
|
5048 my $uses60macro_resource = 0; |
|
5049 my $originwithoutext = $origin; |
|
5050 my $realwithoutext = $real; |
|
5051 if ($origin =~ /epoc32/i) |
|
5052 { |
|
5053 my $tempepocroot = $ENV{EPOCROOT}; |
|
5054 $tempepocroot =~ s-\\-\\\\-g; |
|
5055 $origin =~ s/^$tempepocroot//g; |
|
5056 $real =~ s/^$tempepocroot//g; |
|
5057 }elsif ($checkcase_platform ne "" && $origin =~ /^_$checkcase_platform\_(.*)/) |
|
5058 { |
|
5059 $origin =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g; |
|
5060 $real =~ s/^_$checkcase_platform\_/_PLATFORM_NAME_/g; |
|
5061 }elsif ($origin =~ /\S+\_reg\.rsc$/) |
|
5062 { |
|
5063 $originwithoutext =~ s/\_reg\.rsc$//g; |
|
5064 $realwithoutext =~ s/\_reg\.rsc$//ig; |
|
5065 $uses60macro_aifrsc = 1; |
|
5066 }elsif ($origin =~ /\S+\.rsc$/) |
|
5067 { |
|
5068 $originwithoutext =~ s/\.rsc$//g; |
|
5069 $realwithoutext =~ s/\.rsc$//ig; |
|
5070 $usemultimacro = 1; |
|
5071 $uses60macro_resource = 1; |
|
5072 }elsif ($origin =~ /\S+\.r01$/) |
|
5073 { |
|
5074 $originwithoutext =~ s/\.r01$//g; |
|
5075 $realwithoutext =~ s/\.r01$//ig; |
|
5076 $usemultimacro = 1; |
|
5077 }elsif ($origin =~ /\S+\.exe$/) |
|
5078 { |
|
5079 $originwithoutext =~ s/\.exe$//g; |
|
5080 $realwithoutext =~ s/\.exe$//ig; |
|
5081 $uses60macro_exe = 1; |
|
5082 }elsif ($origin =~ /\S+\_aif\.mif$/) |
|
5083 { |
|
5084 $originwithoutext =~ s/\_aif\.mif$//g; |
|
5085 $realwithoutext =~ s/\_aif\.mif$//ig; |
|
5086 $uses60macro_aificon = 1; |
|
5087 }elsif ($origin =~ /\S+\.mif$/) |
|
5088 { |
|
5089 $originwithoutext =~ s/\.mif$//g; |
|
5090 $realwithoutext =~ s/\.mif$//ig; |
|
5091 $uses60macro_aificon = 1; |
|
5092 } |
|
5093 $origin =~ s-\\-\\\\-g; |
|
5094 $origin =~ s-\.-\\\.-g; |
|
5095 |
|
5096 open (SRC, "<$file"); |
|
5097 open (DST, ">$tempfile"); |
|
5098 my $line; |
|
5099 while($line = <SRC>) |
|
5100 { |
|
5101 my $flag = 0; |
|
5102 |
|
5103 if ($line =~ /$origin/) |
|
5104 { |
|
5105 $originwithoutext = $origin; |
|
5106 $realwithoutext = $real; |
|
5107 $flag = 1; |
|
5108 }elsif ($usemultimacro) |
|
5109 { |
|
5110 if ($line =~ /^.*=\s*MULTI_LINGUIFY\s*\(.*$originwithoutext/) |
|
5111 { |
|
5112 $flag = 1; |
|
5113 }elsif ($line =~ /^\s*S60_APP_RESOURCE\s*\(\s*$originwithoutext\s*\)/ && $uses60macro_resource) |
|
5114 { |
|
5115 $flag = 1; |
|
5116 } |
|
5117 }elsif ($uses60macro_exe) |
|
5118 { |
|
5119 if ($line =~ /^\s*S60_APP_EXE\s*\(\s*$originwithoutext\s*\)/) |
|
5120 { |
|
5121 $flag = 1; |
|
5122 } |
|
5123 }elsif ($uses60macro_aificon) |
|
5124 { |
|
5125 if ($line =~ /^\s*S60_APP_AIF_ICONS\s*\(\s*$originwithoutext\s*\)/) |
|
5126 { |
|
5127 $flag = 1; |
|
5128 }elsif ($line =~ /^\s*SCALABLE_IMAGE\s*\(.*$originwithoutext\s*\)/) |
|
5129 { |
|
5130 $flag = 1; |
|
5131 }elsif ($line =~ /^\s*S60_APP_BITMAP\s*\(\s*$originwithoutext\s*\)/) |
|
5132 { |
|
5133 $flag = 1; |
|
5134 } |
|
5135 }elsif ($uses60macro_aifrsc) |
|
5136 { |
|
5137 if ($line =~ /^\s*S60_APP_AIF_RSC\s*\(\s*$originwithoutext\s*\)/) |
|
5138 { |
|
5139 $flag = 1; |
|
5140 }elsif ($line =~ /^\s*S60_UPGRADABLE_APP_REG_RSC\s*\(\s*$originwithoutext\s*\)/) |
|
5141 { |
|
5142 $flag = 1; |
|
5143 } |
|
5144 } |
|
5145 if ($flag) |
|
5146 { |
|
5147 print CHECKCASELOG "it has been converted automatically\n"; |
|
5148 print CHECKCASELOG "original line is $line"; |
|
5149 $line =~ s-$originwithoutext-$realwithoutext-; |
|
5150 print CHECKCASELOG "converted line is $line\n"; |
|
5151 } |
|
5152 print DST $line; |
|
5153 } |
|
5154 close SRC; |
|
5155 close DST; |
|
5156 |
|
5157 unlink "$file"; |
|
5158 rename ("$file.temp", "$file"); |
|
5159 } |
|
5160 |
|
4654 1; |
5161 1; |