2 # ********************************************************************
4 # * Copyright (c) 2002-2004, International Business Machines Corporation and
5 # * others. All Rights Reserved.
6 # ********************************************************************
8 # Script to generate the icudata.jar and testdata.jar files. This file is
9 # part of icu4j. It is checked into CVS. It is generated from
10 # locale data in the icu4c project. See usage() notes (below)
11 # for more information.
13 # This script requires perl. For Win32, I recommend www.activestate.com.
16 # copied heavily from genrbjar.pl
29 #------------------------------------------------------------------
33 "--icu-root=s" => \
$icuRootDir,
34 "--jar=s" => \
$jarDir,
35 "--icu4j-root=s" => \
$icu4jDir,
36 "--version=s" => \
$version
38 usage
() unless defined $icuRootDir;
39 usage
() unless defined $jarDir;
40 #usage() unless defined $icu4jRootDir;
41 $icuswap = $icuRootDir."/bin/icuswap -tb";
45 $icu4jDataDir ="com/ibm/icu/impl/data/icudt".$version."b";
46 $icu4jTestDataDir = "com/ibm/icu/dev/data/testdata";
47 $icuDataDir =$icuRootDir."/source/data/out/build/icudt".$version.checkPlatform
();
48 $icuTestDataDir =$icuRootDir."/source/test/testdata/out/build/";
49 convertData
($icuDataDir, $icuswap, $tempDir, $icu4jDataDir);
50 #convertData($icuDataDir."/coll/", $icuswap, $tempDir, $icu4jDataDir."/coll");
51 createJar
("$jarDir/jar", "icudata.jar", $tempDir, $icu4jDataDir);
53 convertTestData
($icuTestDataDir, $icuswap, $tempDir, $icu4jTestDataDir);
54 createJar
("$jarDir/jar", "testdata.jar", $tempDir, $icu4jTestDataDir);
57 #-----------------------------------------------------------------------
59 local($jar, $jarFile, $tempDir, $dirToJar) = @_;
61 $command = "$jar cvf $jarFile -C $tempDir $dirToJar";
64 #-----------------------------------------------------------------------
66 my $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/;
73 #-----------------------------------------------------------------------
75 #-----------------------------------------------------------------------
77 local($icuDataDir, $icuswap, $tempDir, $icu4jDataDir) =@_;
78 my $dir = $tempDir."/".$icu4jDataDir;
79 # create the temp directory
80 mkpath
("$tempDir/$icu4jDataDir");
81 # cd to the temp directory
85 opendir(DIR
,$icuDataDir);
89 print "{Command: $op*.*}\n";
93 foreach $item (@list){
94 next if($item eq "." || $item eq "..");
95 next if($item =~ /^t_.*$\.res/ ||$item =~ /^translit_.*$\.res/ || $item =~ /$\.cnv/ ||
96 $item=~/$\.crs/ || $item=~ /$\.txt/ || $item=~ /^zoneinfo/ ||
97 $item=~/icudata\.res/ || $item=~/$\.exp/ || $item=~/$\.lib/ || $item=~/$\.obj/ ||
98 $item=~/cnvalias\.icu/ || $item=~/$\.lst/);
99 if(-d
"$icuDataDir/$item"){
100 convertData
("$icuDataDir/$item/", $icuswap, $tempDir, "$icu4jDataDir./$item/");
103 $command = $icuswap." $icuDataDir/$item $tempDir/$icu4jDataDir/$item";
110 #-----------------------------------------------------------------------
112 local($icuDataDir, $icuswap, $tempDir, $icu4jDataDir) =@_;
113 my $dir = $tempDir."/".$icu4jDataDir;
114 # create the temp directory
115 mkpath
("$tempDir/$icu4jDataDir");
116 # cd to the temp directory
118 print "{Command: $op*.*}\n";
121 opendir(DIR
,$icuDataDir);
123 @list = readdir(DIR
);
128 foreach $item (@list){
129 next if($item eq "." || $item eq "..");
130 next if($item =~ /$\.cnv/ || item
=~/$\.crs/ || $item=~ /$\.txt/ ||
131 $item=~/$\.exp/ || $item=~/$\.lib/ || $item=~/$\.obj/ ||
132 $item=~/$\.mak/ || $item=~/test\.icu/ || $item=~/$\.lst/);
134 if($item =~ /^testdata_/){
136 $file =~ s/testdata_//g;
137 $command = "$icuswap $icuDataDir/$item $tempDir/$icu4jDataDir/$file";
145 #------------------------------------------------------------------------------------------------
149 $prompt = "Command: $cmd.." unless ($prompt);
152 my $exit_value = $? >> 8;
153 #my $signal_num = $? & 127;
154 #my $dumped_core = $? & 128;
155 if ($exit_value == 0) {
159 print "ERROR ($exit_value)\n";
163 #-----------------------------------------------------------------------
169 --icu-root
=<directory where icu4c lives
>
170 --jar
=<directory where jar
.exe lives
>
171 --icu4j-root
=<directory
>
172 --version
=<ICU4C version
>
174 gendtjar
.pl
--icu-root
=\\work
\\icu
--jar
=\\jdk1
.4
.1\\bin
--icu4j-root
=\\work
\\icu4j
--version
=3.0