|
Revision 535, 1.5 kB
(checked in by jdecq, 9 months ago)
|
locales from xulrunner 1.9.1 beta
|
| Line | |
|---|
| 1 |
#!/usr/bin/perl |
|---|
| 2 |
|
|---|
| 3 |
use warnings; |
|---|
| 4 |
use strict; |
|---|
| 5 |
use Cwd; |
|---|
| 6 |
|
|---|
| 7 |
$|++; |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
# |
|---|
| 11 |
# 1. Build the locale list |
|---|
| 12 |
# |
|---|
| 13 |
|
|---|
| 14 |
my $dir = getcwd; |
|---|
| 15 |
my $locales = {}; |
|---|
| 16 |
|
|---|
| 17 |
opendir DH, "$dir/locale" or die "can't open locale folder: $!"; |
|---|
| 18 |
while (my $name = readdir(DH)){ |
|---|
| 19 |
|
|---|
| 20 |
if ($name =~ m/^[a-z]{2}-[a-z]{2}$/i){ |
|---|
| 21 |
|
|---|
| 22 |
$locales->{$name} = 1; |
|---|
| 23 |
} |
|---|
| 24 |
} |
|---|
| 25 |
closedir DH; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
# |
|---|
| 29 |
# 2. build the JARs |
|---|
| 30 |
# |
|---|
| 31 |
|
|---|
| 32 |
`rm $dir/??-??.*`; |
|---|
| 33 |
|
|---|
| 34 |
`mkdir $dir/build`; |
|---|
| 35 |
`rm -r $dir/build/*`; |
|---|
| 36 |
|
|---|
| 37 |
for my $locale(keys %{$locales}){ |
|---|
| 38 |
|
|---|
| 39 |
print "Building $locale.jar..."; |
|---|
| 40 |
|
|---|
| 41 |
mkdir "$dir/build/locale"; |
|---|
| 42 |
mkdir "$dir/build/locale/$locale"; |
|---|
| 43 |
|
|---|
| 44 |
©_files_to("$dir/locale/$locale/", "$dir/build/locale/$locale/"); |
|---|
| 45 |
|
|---|
| 46 |
chdir "$dir/build"; |
|---|
| 47 |
|
|---|
| 48 |
`'C:/Program Files/7-Zip/7z.exe' a -r -tzip $locale.zip locale -mx1`; |
|---|
| 49 |
`mv $locale.zip ../$locale.jar`; |
|---|
| 50 |
|
|---|
| 51 |
`rm -r $dir/build/locale`; |
|---|
| 52 |
|
|---|
| 53 |
print "ok\n"; |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
`rm -r $dir/build`; |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
# |
|---|
| 60 |
# 3. build the manifests |
|---|
| 61 |
# |
|---|
| 62 |
|
|---|
| 63 |
chdir $dir; |
|---|
| 64 |
|
|---|
| 65 |
for my $locale(keys %{$locales}){ |
|---|
| 66 |
|
|---|
| 67 |
print "building $locale.manifest..."; |
|---|
| 68 |
|
|---|
| 69 |
`perl -p -e 's/LOCALE/$locale/g' manifest.template > $locale.manifest`; |
|---|
| 70 |
|
|---|
| 71 |
print "ok\n"; |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
# |
|---|
| 76 |
# 4. all done! |
|---|
| 77 |
# |
|---|
| 78 |
|
|---|
| 79 |
print "ok, all done!\n"; |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
sub copy_files_to { |
|---|
| 85 |
|
|---|
| 86 |
my ($src, $dst) = @_; |
|---|
| 87 |
|
|---|
| 88 |
my @lines = split "\n", `find $src | grep -v .svn`; |
|---|
| 89 |
|
|---|
| 90 |
my $src_q = quotemeta $src; |
|---|
| 91 |
|
|---|
| 92 |
for my $file (@lines){ |
|---|
| 93 |
|
|---|
| 94 |
$file =~ s/^$src_q//; |
|---|
| 95 |
|
|---|
| 96 |
if (length $file){ |
|---|
| 97 |
|
|---|
| 98 |
if (-f "$src$file"){ |
|---|
| 99 |
|
|---|
| 100 |
`cp $src$file $dst$file`; |
|---|
| 101 |
} |
|---|
| 102 |
|
|---|
| 103 |
if (-d "$src$file" && !-d "$dst$file"){ |
|---|
| 104 |
|
|---|
| 105 |
`mkdir $dst$file`; |
|---|
| 106 |
} |
|---|
| 107 |
} |
|---|
| 108 |
} |
|---|
| 109 |
} |
|---|