0
|
1 |
#
|
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
|
|
17 |
package SDK_lang;
|
|
18 |
use SDK_vars;
|
|
19 |
use SDK_utils;
|
|
20 |
use File::Find;
|
|
21 |
use File::Path;
|
|
22 |
use File::Basename;
|
|
23 |
use File::Copy;
|
|
24 |
use Cwd;
|
|
25 |
|
|
26 |
our ($VERSION, @ISA, @EXPORT);
|
|
27 |
|
|
28 |
$VERSION = 1.00;
|
|
29 |
@ISA = qw(Exporter);
|
|
30 |
@EXPORT = qw(copy_language_zips create_lang_package);
|
|
31 |
|
|
32 |
sub copy_language_zips {
|
|
33 |
my ($href) = @_;
|
|
34 |
enter_sub("Copying the language zips from $$href{Platform_Languages} -> $$href{S60_Root}\\Languages");
|
|
35 |
my $curr_dir = cwd();
|
|
36 |
my $lang_dir = "$$href{S60_Root}\\Languages";
|
|
37 |
print "Deleted dir - $lang_dir\n" if ((-e $lang_dir) && do_rmdir_all($lang_dir));
|
|
38 |
|
|
39 |
foreach my $pl_lang_path ( split (/ /, $iniH{Platform_Languages}) ){
|
|
40 |
if($_ =~ m/japan/g) # Added by dinesh since japanese is not required in the N97 SDK
|
|
41 |
{
|
|
42 |
print "Skipping copying of $_ file\n";
|
|
43 |
next;
|
|
44 |
}
|
|
45 |
map { my $cmd ="xcopy $pl_lang_path\\$_ $$href{S60_Root}\\Languages\\$_ /f /r /i /s /Y "; system ($cmd)==0 or print "$cmd\n";} qw(*_delta_*.zip);
|
|
46 |
}
|
|
47 |
|
|
48 |
#Copy the possible patches
|
|
49 |
if (-e $$href{Languages_Patch}) {
|
|
50 |
my $cmd = "xcopy $$href{Languages_Patch}\\*.zip $lang_dir\\ /f /r /i /s /Y";
|
|
51 |
system ($cmd)==0 or print "$cmd\n";
|
|
52 |
}
|
|
53 |
};
|
|
54 |
|
|
55 |
sub create_lang_package {
|
|
56 |
local ($S60_Root, $lang_dir, $graylist, $blacklist, $dest_dir) = @_;
|
|
57 |
enter_sub($lang_dir);
|
|
58 |
my $curr_dir = cwd;
|
|
59 |
local $emu_dirs = join " ", map { "epoc32\\$_\\*" } @emu_src_dirs;
|
|
60 |
return unless (chdir $lang_dir);
|
|
61 |
|
|
62 |
local $lang_wa_dir = "$iniH{Sce_Root}\\lang_wa";
|
|
63 |
print "Deleted dir - $lang_wa_dir\n" if ((-e $lang_wa_dir) && do_rmdir_all($lang_wa_dir));
|
|
64 |
mkpath($lang_wa_dir);
|
|
65 |
|
|
66 |
#Copy language zips to wa
|
|
67 |
foreach (<*.zip>){
|
|
68 |
if (/delta_/){
|
|
69 |
if($_ =~ m/japan/g) # Added by dinesh since japanese is not required in the N97 SDK
|
|
70 |
{
|
|
71 |
print "Skipping copying of $_ file\n";
|
|
72 |
next;
|
|
73 |
}
|
|
74 |
$cmd = "xcopy $_ $lang_wa_dir /F /I /Y";
|
|
75 |
system ($cmd)==0 or print "$cmd\n";
|
|
76 |
}
|
|
77 |
}
|
|
78 |
|
|
79 |
return unless (chdir "$lang_wa_dir");
|
|
80 |
print "\ngvn: lang_wa_dir is $lang_wa_dir\n";
|
|
81 |
|
|
82 |
print "Rename language zips === started ", scalar localtime(), "\n";
|
|
83 |
foreach (<*.zip>){
|
|
84 |
print "\ngvn: ZIP PROCESSED is: $_\n";
|
|
85 |
SWITCH: {
|
|
86 |
/china/ && do {
|
|
87 |
system ("rename $_ zh_CN.zip")==0 and print "$_ >-> zh_CN.zip\n";
|
|
88 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\31.zip $lang_dir\\package_31.zip";
|
|
89 |
print "$cmd\n"; system ($cmd);
|
|
90 |
last SWITCH;
|
|
91 |
};
|
|
92 |
/japan/ && do {
|
|
93 |
system ("rename $_ ja_JP.zip")==0 and print "$_ >-> ja_JP.zip\n";
|
|
94 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\32.zip $lang_dir\\package_32.zip";
|
|
95 |
print "$cmd\n"; system ($cmd);
|
|
96 |
last SWITCH;
|
|
97 |
};
|
|
98 |
/western/ && do {
|
|
99 |
system ("rename $_ en_US.zip")==0 and print "$_ >-> en_US.zip\n";
|
|
100 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\01.zip $lang_dir\\package_01.zip";
|
|
101 |
print "$cmd\n"; system ($cmd);
|
|
102 |
last SWITCH;
|
|
103 |
};
|
|
104 |
/arabic/ && do {
|
|
105 |
system ("rename $_ ar_SA.zip")==0 and print "$_ >-> ar_SA.zip\n";
|
|
106 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\37.zip $lang_dir\\package_37.zip";
|
|
107 |
print "$cmd\n"; system ($cmd);
|
|
108 |
last SWITCH;
|
|
109 |
};
|
|
110 |
/urdu/ && do {
|
|
111 |
system ("rename $_ ur_PK.zip")==0 and print "$_ >-> ur_PK.zip\n";
|
|
112 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\94.zip $lang_dir\\package_94.zip";
|
|
113 |
print "$cmd\n"; system ($cmd);
|
|
114 |
last SWITCH;
|
|
115 |
};
|
|
116 |
/hindi/ && do {
|
|
117 |
system ("rename $_ hi_IN.zip")==0 and print "$_ >-> hi_IN.zip\n";
|
|
118 |
$cmd = "copy /V $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\58.zip $lang_dir\\package_58.zip";
|
|
119 |
print "$cmd\n"; system ($cmd);
|
|
120 |
last SWITCH;
|
|
121 |
};
|
|
122 |
|
|
123 |
}
|
|
124 |
}
|
|
125 |
#Creating localization zip by adding all the package_*
|
|
126 |
$cmd = "zip -r $lang_dir\\localisation.zip $lang_dir\\package_*.zip";
|
|
127 |
print "$cmd\n"; system ($cmd);
|
|
128 |
|
|
129 |
|
|
130 |
create_lang_zips(\%sdk_lang_codes, $lang_dir, $lang_wa_dir, $dest_dir);
|
|
131 |
create_lang_zips(\%extra_lang_codes, $lang_dir, $lang_wa_dir, "$iniH{Sce_Root}\\sdk_lang_extra",\%lang_names);
|
|
132 |
|
|
133 |
#Now Create language packages.zip in sdk_lang_extra
|
|
134 |
create_lang_package_zip(\%sdk_lang_codes,$lang_wa_dir,$S60_Root,$graylist, $blacklist);
|
|
135 |
create_lang_package_zip(\%extra_lang_codes,$lang_wa_dir,$S60_Root,$graylist, $blacklist,\%lang_names);
|
|
136 |
|
|
137 |
#Now create Forum Nokia specific extra language package zips
|
|
138 |
print "\n Create FORUM NOKIA standard extra language zips";
|
|
139 |
create_FN_extralang_zip(\%extra_lang_codes,\%lang_names);
|
|
140 |
|
|
141 |
mkpath("$lang_wa_dir\\undo2zip");
|
|
142 |
chdir "$lang_wa_dir\\undo2zip" or print ("$!: $lang_wa_dir\\undo2zip\n" );
|
|
143 |
$cmd = "zip -r $dest_dir\\$iniH{ 'Platform_Build_ID' }-undo.zip *"; #Zip them again to Result directory (prefixed by build id)
|
|
144 |
print ($cmd."\n"); system ($cmd);
|
|
145 |
|
|
146 |
#Put English as a default
|
|
147 |
my $en_US_zip = glob("$dest_dir\\*-en_US.zip");
|
|
148 |
my $cmd = "unzip -o $en_US_zip -d \\sdk_wa";
|
|
149 |
print ( $cmd."\n" );
|
|
150 |
system ( $cmd );
|
|
151 |
foreach my $package (glob("$dest_dir\\*package*.zip")) { #Extract the packages (resources) on top of the sdk
|
|
152 |
my $cmd = "unzip -o $package -d \\sdk_wa";
|
|
153 |
print ( $cmd."\n" );
|
|
154 |
system ( $cmd );
|
|
155 |
$cmd = "move $package $iniH{Sce_Root}\\sdk_lang_extra"; #Move them to extra folder
|
|
156 |
print ( $cmd."\n" );
|
|
157 |
system ( $cmd );
|
|
158 |
}
|
|
159 |
chdir $curr_dir;
|
|
160 |
|
|
161 |
#Remove the work area
|
|
162 |
$subdir = "$lang_wa_dir";
|
|
163 |
#print "Deleted dir - $subdir\n" if do_rmdir_all($subdir);
|
|
164 |
}
|
|
165 |
|
|
166 |
|
|
167 |
#This sub will create Rel-$relid-package-$lang_key.zip (Rel200802-package_ja_JP.zip , Rel200802-package_ur_PK.zip)
|
|
168 |
sub create_lang_package_zip
|
|
169 |
{
|
|
170 |
|
|
171 |
my $lang_code_href=shift @_;
|
|
172 |
my $lang_wa_dir=shift @_;
|
|
173 |
my $S60_Root=shift @_;
|
|
174 |
my $graylist = shift @_;
|
|
175 |
my $blacklist = shift @_;
|
|
176 |
my $language_names=shift @_;
|
|
177 |
|
|
178 |
my $assemble_area=$lang_wa_dir."\\PACKAGES";
|
|
179 |
my $loc_resource_base=$S60_Root."\\epoc32\\RELEASE\\WINSCW\\udeb\\Z";
|
|
180 |
my @loc_resource_dirs=qw (private resource);
|
|
181 |
|
|
182 |
|
|
183 |
my $lang_extra_dest="$iniH{Sce_Root}\\sdk_lang_extra";
|
|
184 |
my $lang_code_val;
|
|
185 |
|
|
186 |
my $cmd;
|
|
187 |
my @out;
|
|
188 |
my $sstring;
|
|
189 |
my $lang_code_val_rx;
|
|
190 |
|
|
191 |
my $lang_rs_src;
|
|
192 |
my $lang_rs_dest;
|
|
193 |
my $lang_rs_dir_name;
|
|
194 |
my $S60_Root_Rx=quotemeta($S60_Root);
|
|
195 |
my $res;
|
|
196 |
|
|
197 |
#Create work area,
|
|
198 |
mkpath($assemble_area);
|
|
199 |
foreach my $lang_code_name ( keys %$lang_code_href)
|
|
200 |
{
|
|
201 |
#Initialize
|
|
202 |
$cmd="";
|
|
203 |
@out=();
|
|
204 |
$sstring="";
|
|
205 |
$lang_code_val_rx="";
|
|
206 |
print "\nCreating $lang_code_name package=== started ", scalar localtime(), "\n\n";
|
|
207 |
foreach $lang_code_val(@{$lang_code_href->{$lang_code_name}})#$lang_code val is an array, so expand it with @
|
|
208 |
{
|
|
209 |
$sstring.=' '.$lang_code_val; #Add for dir
|
|
210 |
$sstring.=' *.r'.$lang_code_val; #Add for files
|
|
211 |
$lang_code_val_rx.="|$lang_code_val\$";
|
|
212 |
}
|
|
213 |
$lang_code_val_rx=~s/^\|//; #Knock off first |
|
|
214 |
$cmd="dir $sstring /S /L /B";
|
|
215 |
print "\n Search string for $lang_code_name => $cmd";
|
|
216 |
|
|
217 |
#Now go to $loc_resource_base
|
|
218 |
chdir $loc_resource_base or print "\n ERROR: Can not chdir to $loc_resource_base";
|
|
219 |
|
|
220 |
print "\n EXEC: $cmd in ",cwd();
|
|
221 |
eval
|
|
222 |
{
|
|
223 |
@out=`$cmd`;
|
|
224 |
};
|
|
225 |
if ($@)
|
|
226 |
{
|
|
227 |
print "\n ERROR: $cmd failed in $loc_resource_base, $!";
|
|
228 |
}
|
|
229 |
|
|
230 |
#Got the list fo files, Now need to copy them to $assemble_src\\$lang_code_name
|
|
231 |
mkpath($assemble_area."\\".$lang_code_name);
|
|
232 |
for $lang_rs_src(@out)
|
|
233 |
{
|
|
234 |
#avoid unwanted file
|
|
235 |
chomp($lang_rs_src);
|
|
236 |
next if ($lang_rs_src!~m/$lang_code_val_rx/i);
|
|
237 |
|
|
238 |
if (! -d $lang_rs_src)
|
|
239 |
{
|
|
240 |
$lang_rs_dir_name=dirname($lang_rs_src) #if it is a dir , we need to cp as it is
|
|
241 |
}
|
|
242 |
else
|
|
243 |
{
|
|
244 |
$lang_rs_dir_name=$lang_rs_src;
|
|
245 |
}
|
|
246 |
$lang_rs_dir_name=~s/$S60_Root_Rx//io; # Strip the $S60_Root
|
|
247 |
$lang_rs_dest=$assemble_area."\\"."$lang_code_name"."\\".$lang_rs_dir_name;
|
|
248 |
|
|
249 |
#Make dest path
|
|
250 |
mkpath($lang_rs_dest);
|
|
251 |
#Copy it
|
|
252 |
$cmd="xcopy $lang_rs_src $lang_rs_dest /F /R /I /S /Y";
|
|
253 |
|
|
254 |
$res=system($cmd);
|
|
255 |
if($res !=0)
|
|
256 |
{
|
|
257 |
print "\n ERROR: $cmd FAILED, $res";
|
|
258 |
}
|
|
259 |
|
|
260 |
}
|
|
261 |
|
|
262 |
chdir $assemble_area."\\".$lang_code_name;
|
|
263 |
#Rm read only
|
|
264 |
print "\n Remove read only attribute in ",cwd();
|
|
265 |
system ("attrib /s *.* -r");
|
|
266 |
#Apply gray / balck
|
|
267 |
apply_blacklist($assemble_area."\\".$lang_code_name, ($blacklist, $common_graylist) );
|
|
268 |
#dbgstrip
|
|
269 |
print "\n Start DBGSTRIPPI in $assemble_area\\$lang_code_name";
|
|
270 |
find \&dbgstrippi, "$assemble_area\\$lang_code_name";
|
|
271 |
#lower case
|
|
272 |
print "\n Start DBGSTRIPPI in $assemble_area\\$lang_code_name";
|
|
273 |
find \&lowercase, "$assemble_area\\$lang_code_name";
|
|
274 |
|
|
275 |
chdir $assemble_area."\\".$lang_code_name;
|
|
276 |
#Zip it
|
|
277 |
print "\n Create lang ZIP package for $lang_code_name in ",cwd();
|
|
278 |
if(defined $language_names)
|
|
279 |
{
|
|
280 |
#Need to create FN specific extra lang zip
|
|
281 |
$cmd = "zip -r $lang_extra_dest\\$iniH{'Platform_Abbreviation'}_$iniH{'Edition_number'}_Edition_$$language_names{$lang_code_name}_plug_in.zip *";
|
|
282 |
}
|
|
283 |
else
|
|
284 |
{
|
|
285 |
$cmd="zip -r $lang_extra_dest\\$iniH{'Platform_Build_ID'}-package_$lang_code_name.zip *";
|
|
286 |
}
|
|
287 |
print "\n EXEC: $cmd";
|
|
288 |
$res=system($cmd);
|
|
289 |
if($res !=0)
|
|
290 |
{
|
|
291 |
print "\n ERROR: $cmd FAILED, $res";
|
|
292 |
}
|
|
293 |
|
|
294 |
}
|
|
295 |
}
|
|
296 |
|
|
297 |
#This sub will create the FN specific extra language packages by doing,
|
|
298 |
#For example, S60_5th_Edition_Arabic_v1_0_en.zip=S60_5th_Edition_Arabic_plug_in.zip+S60_5th_Edition_Arabic_Switcher.zip+ReadMe_Arabic.txt
|
|
299 |
sub create_FN_extralang_zip
|
|
300 |
{
|
|
301 |
my $lang_codes=shift @_;
|
|
302 |
my $language_names=shift @_;
|
|
303 |
my $lang_extra_dest="$iniH{Sce_Root}\\sdk_lang_extra";
|
|
304 |
my $readme_src= "$iniH{Sce_Root}\\Repository_area\\sdk_lang_extra_readme";
|
|
305 |
my $pre_pwd = cwd;
|
|
306 |
|
|
307 |
print "\n Start Create FORUM NOKIA standard extra language zips";
|
|
308 |
my $cmd="";
|
|
309 |
my $fn_zip_name="";
|
|
310 |
my $includes="";
|
|
311 |
chdir $lang_extra_dest or die "\n ERROR: Can not chdir to $lang_extra_dest";
|
|
312 |
foreach my $lang(keys %$lang_codes)
|
|
313 |
{
|
|
314 |
#Ex: S60_5th_Edition_Arabic_v1_0_en.zip
|
|
315 |
$fn_zip_name="$iniH{'Platform_Abbreviation'}_$iniH{'Edition_number'}_Edition_$$language_names{$lang}_v1_0_en.zip";
|
|
316 |
#Copy Read me
|
|
317 |
copy("$readme_src\\ReadMe_$$language_names{$lang}.txt","ReadMe_$$language_names{$lang}.txt");
|
|
318 |
#Ex: S60_5th_Edition_Arabic_plug_in.zip + S60_5th_Edition_Arabic_Switcher.zip+ReadMe_Arabic.txt
|
|
319 |
$includes="$iniH{'Platform_Abbreviation'}_$iniH{'Edition_number'}_Edition_$$language_names{$lang}_Switcher.zip $iniH{'Platform_Abbreviation'}_$iniH{'Edition_number'}_Edition_$$language_names{$lang}_plug_in.zip ReadMe_$$language_names{$lang}.txt";
|
|
320 |
|
|
321 |
$cmd = "zip $lang_extra_dest\\$fn_zip_name $includes";
|
|
322 |
print $cmd."\n"; system ( $cmd );
|
|
323 |
}
|
|
324 |
chdir $pre_pwd or die ("\n ERROR: Can not chdir to $pre_pwd");
|
|
325 |
}
|
|
326 |
sub create_lang_zips
|
|
327 |
{
|
|
328 |
my ( $lang_codes, $lang_dir, $lang_wa_dir, $dest_dir,$language_names) = @_;
|
|
329 |
enter_sub($lang_dir);
|
|
330 |
my $curr_dir = cwd;
|
|
331 |
|
|
332 |
my @localisation_zips = glob("$lang_dir\\*localisation.zip");
|
|
333 |
print "Deleted dir - $dest_dir\n" if do_rmdir_all($dest_dir);
|
|
334 |
mkpath($dest_dir);
|
|
335 |
|
|
336 |
foreach my $lang ( keys %$lang_codes ){ #Handle all languages, see SDK_vars.pm for %lang_codes
|
|
337 |
print "\nCreating $lang === started ", scalar localtime(), "\n\n";
|
|
338 |
chdir "$lang_wa_dir" or die "chdir for $lang_wa_dir failed: $!";
|
|
339 |
my ($lang_emu_wa, $lang_resource_wa) = ("$lang_wa_dir\\$lang\\emu","$lang_wa_dir\\$lang\\resource");
|
|
340 |
|
|
341 |
mkpath ($lang_emu_wa);#Create the directory for $lang_emu_wa
|
|
342 |
if (-e "$lang.zip" ){ #We have delta for this language
|
|
343 |
my $cmd = "unzip -o $lang.zip $emu_dirs -d $lang_emu_wa";
|
|
344 |
print ( $cmd."\n" );
|
|
345 |
system ( $cmd ); #Unzip delta to $lang directory
|
|
346 |
}
|
|
347 |
|
|
348 |
#Apply the language patches
|
|
349 |
#It extracts the languages patches resides on filerblr to $lang_wa_dir
|
|
350 |
if (-e "$iniH{S60_Root}\\Languages\\Patch_$lang.zip")
|
|
351 |
{
|
|
352 |
$cmd = "unzip -o $iniH{S60_Root}\\Languages\\Patch_$lang.zip $emu_dirs -d $lang_emu_wa";
|
|
353 |
system ($cmd)==0 or print "$cmd\n";
|
|
354 |
}
|
|
355 |
|
|
356 |
foreach my $lang_code ( @{$$lang_codes{$lang}} ){
|
|
357 |
#Get the localization packages from the localisation zip
|
|
358 |
for my $localisation_zip ( @localisation_zips ){
|
|
359 |
$cmd = "unzip -o -j -C $localisation_zip $lang_dir\\package_${lang_code}.zip -d $lang_wa_dir";
|
|
360 |
print ( $cmd."\n" ); system ( $cmd );
|
|
361 |
#$cmd = "unzip -o -C package_${lang_code}.zip $emu_dirs -d $lang_resource_wa";
|
|
362 |
$cmd = "unzip -o -C $iniH{S60_Root}\\s60\\misc\\release\\S60LocFiles\\data\\${lang_code}.zip $emu_dirs -d $lang_resource_wa";
|
|
363 |
do {print "$cmd\n"; system ($cmd)} if (-e "${lang_code}.zip"); #Unzip resource to $lang_resource_wa directory
|
|
364 |
}
|
|
365 |
}
|
|
366 |
|
|
367 |
if (chdir ("$lang_wa_dir\\$lang")) { #If the dir exists => we had the delta for this language
|
|
368 |
system ("attrib /s *.* -r"); #Remove read-only attributes
|
|
369 |
|
|
370 |
apply_blacklist($lang_emu_wa, ($blacklist, $common_graylist) ); #Apply graylist
|
|
371 |
apply_blacklist($lang_resource_wa, ($blacklist, $common_graylist) ); #Apply graylist
|
|
372 |
|
|
373 |
print ("Dgbstrippi started on ", cwd(), " === ", scalar localtime(), "\n");
|
|
374 |
find \&dbgstrippi, ".";
|
|
375 |
|
|
376 |
print "Filenames to lowercase started on ", cwd()," === ", scalar localtime(), "\n";
|
|
377 |
find \&lowercase, qw(.);
|
|
378 |
print "Filenames to lowercase === finished ", scalar localtime(), "\n";
|
|
379 |
|
|
380 |
# zap_files_from_lang_zips("$lang_wa_dir\\$lang"); #Remove files which are supposed to be patched, ie. do not overwrite patches
|
|
381 |
# create_101f876d_ini("$lang"); #Perhaps not needed anymore, this puts the initial input language on, I presume
|
|
382 |
}
|
|
383 |
|
|
384 |
mkpath("$lang_wa_dir\\$lang") unless (-e "$lang_wa_dir\\$lang");
|
|
385 |
chdir ("$lang_wa_dir\\$lang");
|
|
386 |
#Perhaps not needed anymore, the zips already contain this
|
|
387 |
create_language_txt($lang_emu_wa, $lang, $lang_codes);
|
|
388 |
|
|
389 |
create_lang_properties_file ( $lang_emu_wa, $lang ); #This must go to the zip. Do not zap!
|
|
390 |
#Zip the work areas
|
|
391 |
chdir "$lang_emu_wa" or die "chdir for $lang_emu_wa failed: $!";
|
|
392 |
if(defined $language_names)
|
|
393 |
{
|
|
394 |
#Need to create FN specific extra lang zip
|
|
395 |
$cmd = "zip -r $dest_dir\\$iniH{'Platform_Abbreviation'}_$iniH{'Edition_number'}_Edition_$$language_names{$lang}_Switcher.zip *";
|
|
396 |
}
|
|
397 |
else
|
|
398 |
{
|
|
399 |
$cmd = "zip -r $dest_dir\\$iniH{ 'Platform_Build_ID' }-$lang.zip *"; #Zip them again to Result directory (prefixed by build id)
|
|
400 |
}
|
|
401 |
print $cmd."\n"; system ( $cmd );
|
|
402 |
|
|
403 |
}
|
|
404 |
chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!";
|
|
405 |
|
|
406 |
print "Create undo zip === started ", scalar localtime(), "\n";
|
|
407 |
my $undo_dir = "$lang_wa_dir\\undo2zip";
|
|
408 |
foreach (<$dest_dir\\*.zip>){
|
|
409 |
next if /package/i; #Do not consider packages
|
|
410 |
my $cmd = "unzip -l $_";
|
|
411 |
print ( $cmd."\n" );
|
|
412 |
for ( `$cmd` ) { #Get the filelisting of the zip
|
|
413 |
next if /\/$/; #Skip the path lines. They end with /
|
|
414 |
next unless (s/.+\d //); #Devour anything before path
|
|
415 |
chomp;
|
|
416 |
s[/][\\]g;
|
|
417 |
next unless ( -e "$iniH{Sce_Root}\\sdk_wa\\$_"); #The file is not in SDK
|
|
418 |
m/(.*\\)/; #Take the directory part -> $1
|
|
419 |
$cmd = "xcopy \"$iniH{Sce_Root}\\sdk_wa\\$_\" \"$lang_wa_dir\\undo2zip\\$1\" /F /I /Y";
|
|
420 |
system ($cmd)==0 or print "$cmd\n"; #Copy the file from sdk_wa to be "undozipped"
|
|
421 |
}
|
|
422 |
}
|
|
423 |
}
|
|
424 |
|
|
425 |
|
|
426 |
sub create_101f876d_ini {
|
|
427 |
|
|
428 |
#Unicode file!
|
|
429 |
my $lang = shift;
|
|
430 |
my $file = "$lang_wa_dir\\$lang\\epoc32\\release\\winscw\\udeb\\z\\private\\10202be9\\101f876d.txt";
|
|
431 |
open(INI, "<:encoding(utf16le)", $file) or die "can't open $file: $!";
|
|
432 |
open(TMP, ">:raw:encoding(utf16le)", "tmp.txt") or die "can't open tmp.txt: $!";
|
|
433 |
while (<INI>){
|
|
434 |
s/0x5 int \p{IsDigit}+/0x5 int $$lang_codes{$lang}[0]/;
|
|
435 |
print TMP $_;
|
|
436 |
}
|
|
437 |
close(INI);
|
|
438 |
close(TMP);
|
|
439 |
rename("tmp.txt", $file) or die "can't rename tmp.txt to $file: $!";
|
|
440 |
print <<KORV5;
|
|
441 |
$file: 0x5 int 0 -> 0x5 int $$lang_codes{$lang}[0]
|
|
442 |
KORV5
|
|
443 |
}
|
|
444 |
|
|
445 |
sub create_lang_properties_file {
|
|
446 |
|
|
447 |
my ($lang_wa_dir, $lang) = @_;
|
|
448 |
my @array = split(/_/, $lang);
|
|
449 |
enter_sub($lang);
|
|
450 |
print "Create language.properties $array[0] === started in $lang_wa_dir ", scalar localtime(), "\n";
|
|
451 |
my $dest_dir = "$lang_wa_dir\\epoc32\\data";
|
|
452 |
mkpath($dest_dir);
|
|
453 |
open (LPF, ">$dest_dir\\language.properties") or die "Can't create $dest_dir\\language.properties: $!";
|
|
454 |
print LPF <<LANG_PROP;
|
|
455 |
#language.properties
|
|
456 |
language=$array[0]
|
|
457 |
country=$array[1]
|
|
458 |
version=$iniH{ 'Platform_Build_ID' }
|
|
459 |
LANG_PROP
|
|
460 |
close LPF;
|
|
461 |
print "Create language.properties $array[0] === finished ", scalar localtime(), "\n";
|
|
462 |
}
|
|
463 |
|
|
464 |
sub create_language_txt {
|
|
465 |
|
|
466 |
my ($lang_wa_dir, $lang, $lang_codes) = @_;
|
|
467 |
|
|
468 |
enter_sub();
|
|
469 |
#Check if already exists
|
|
470 |
if (-e "$lang_wa_dir\\epoc32\\release\\winscw\\udeb\\z\\resource\\bootdata\\languages.txt") {print "languages.txt already exists!\n"; return};
|
|
471 |
#Unicode file!
|
|
472 |
my $src_file = "$iniH{S60_Root}\\epoc32\\release\\winscw\\udeb\\z\\resource\\bootdata\\languages.txt";
|
|
473 |
open(LANG_SRC, "<:encoding(utf16le)", $src_file) or warn "can't open $src_file: $!" and return;
|
|
474 |
open(TMP, ">:raw:encoding(utf16le)", "languages.txt") or die "can't open languages.txt: $!";
|
|
475 |
while (<LANG_SRC>){
|
|
476 |
my $cnt=0;
|
|
477 |
$cnt = s/\p{IsDigit}+,d/$$lang_codes{$lang}[0],d/;
|
|
478 |
print "$src_file: $& --> $$lang_codes{$lang}[0],d\n" if ($cnt);
|
|
479 |
print TMP $_;
|
|
480 |
}
|
|
481 |
close(LANG_SRC);
|
|
482 |
close(TMP);
|
|
483 |
|
|
484 |
#Move the languages.txt to proper place
|
|
485 |
$cmd = "xcopy languages.txt $lang_wa_dir\\epoc32\\release\\winscw\\udeb\\z\\resource\\bootdata\\ /F /R /I /Y";
|
|
486 |
system ($cmd)==0 or print "$cmd\n";
|
|
487 |
unlink ("languages.txt");
|
|
488 |
exit_sub();
|
|
489 |
}
|
|
490 |
|
|
491 |
#Remove files that we are going to patch
|
|
492 |
#I.e. prevent the patches being overwritten
|
|
493 |
sub zap_files_from_lang_zips {
|
|
494 |
my $lang = shift;
|
|
495 |
enter_sub($lang);
|
|
496 |
foreach $patch_dir (qw(Common_Patch CPP_Patch Java_Patch)) { #These directories are included
|
|
497 |
next unless (-e "$repository_area\\$patch_dir");
|
|
498 |
#We create a file (=FH) containing the filenames
|
|
499 |
open( PATCH_FILES, "dir /s /a-d /b $repository_area\\$patch_dir |" ) or die "Cannot open dir $repository_area\\$patch_dir: $!";
|
|
500 |
while (<PATCH_FILES>){
|
|
501 |
chomp;
|
|
502 |
my $patch_path = "$repository_area\\$patch_dir\\";
|
|
503 |
s/\Q$patch_path\E/$lang\\/;
|
|
504 |
$target_item = "$_";
|
|
505 |
next unless ( -e ); #The file is not in language zip
|
|
506 |
#Delete directories
|
|
507 |
if( -d ) {
|
|
508 |
print "Deleted dir - $target_item\n" if do_rmdir_all($target_item);
|
|
509 |
}
|
|
510 |
#Notify that (upper)directory does not exist (One level up from item)
|
|
511 |
elsif ( not(-d (substr($target_item,0,rindex($target_item,'\\'))))) {
|
|
512 |
print "Could Not Delete $target_item\n";
|
|
513 |
}
|
|
514 |
# Delete files that exist or has a star in the name
|
|
515 |
elsif (-e "$target_item" or /\*/ ) {
|
|
516 |
system ("del /q /s $target_item")==0 or print " $target_item\n";
|
|
517 |
}
|
|
518 |
else {
|
|
519 |
system ("del /q /s $target_item")==0 or print " $target_item\n";
|
|
520 |
}
|
|
521 |
}
|
|
522 |
close( PATCH_FILES );
|
|
523 |
}
|
|
524 |
print "zap_files_from_lang_zips $lang === finished ", scalar localtime(), "\n";
|
|
525 |
exit_sub();
|
|
526 |
1;
|
|
527 |
}
|