X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..03115e547b9a040702fdddc7f9bf4c315a8c62a7:/icuSources/tools/genrb/genrbjar.pl diff --git a/icuSources/tools/genrb/genrbjar.pl b/icuSources/tools/genrb/genrbjar.pl index eb1fb2df..12be04de 100644 --- a/icuSources/tools/genrb/genrbjar.pl +++ b/icuSources/tools/genrb/genrbjar.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # ******************************************************************** # * COPYRIGHT: -# * Copyright (c) 2002-2003, International Business Machines Corporation and +# * Copyright (c) 2002-2004, International Business Machines Corporation and # * others. All Rights Reserved. # ******************************************************************** @@ -19,21 +19,31 @@ use warnings; use File::Path; use File::Copy; -usage() unless (@ARGV >= 3); +my $isMSWin32 = ($^O eq 'MSWin32'); +usage() unless (@ARGV >= ($isMSWin32 ? 3:2)); my $ICU_ROOT = shift; my $ICU4J_ROOT = shift; -my $ldVar = shift; +my $prefix = ''; # e.g. "LD_LIBRARY_PATH=..." +my $flavor = ''; # e.g. "Debug/" +if ($isMSWin32) { + $flavor = shift() . '/'; +} else { + my $isDarwin = ($^O eq 'darwin'); + my $ldVar = ($isDarwin ? 'DYLD_LIBRARY_PATH' : 'LD_LIBRARY_PATH'); + $prefix = ($isMSWin32 ? '' : "$ldVar=$ICU_ROOT/source/common:$ICU_ROOT/source/i18n:$ICU_ROOT/source/tools/toolutil:$ICU_ROOT/source/data/out:$ICU_ROOT/source/data: "); +} +checkPlatform(); # Step 1. Run genrb. print "\n[Step 1: Run genrb]\n"; -my $genrb = "$ICU_ROOT/source/tools/genrb/genrb"; +my $genrb = "$ICU_ROOT/source/tools/genrb/${flavor}genrb"; my $dataDir = "$ICU_ROOT/source/data/locales"; my $javaRootDir = "$dataDir/java"; my $pkg = "com/ibm/icu/impl/data"; my $javaDir = "$javaRootDir/$pkg"; chdir($dataDir); mkpath($javaDir); -my $op = "$ldVar=$ICU_ROOT/source/common:$ICU_ROOT/source/i18n:$ICU_ROOT/source/tools/toolutil:$ICU_ROOT/source/data/out:$ICU_ROOT/source/data: $genrb -s. -d$javaDir -j -p com.ibm.icu.impl.data -b LocaleElements "; +my $op = "$prefix$genrb -s. -d$javaDir -j -p com.ibm.icu.impl.data -b LocaleElements "; print "{Command: $op*.txt}\n"; print "Directory: $dataDir\n"; my @list; @@ -160,6 +170,7 @@ print " $jarFile updated\n"; # Done! print "\n[All done]\n"; +checkPlatform(); exit(0); #----------------------------------------------------------------------- @@ -298,10 +309,25 @@ sub patchIndex { print " $file patched (index)\n"; } +#----------------------------------------------------------------------- +sub checkPlatform { + my $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/; + if (!$is_big_endian) { + print "*******\n"; + print "WARNING: You are running on a LITTLE ENDIAN machine.\n"; + print "WARNING: You cannot use the resulting ICULocaleData.jar\n"; + print "WARNING: *.col files will have incorrect byte order.\n"; + print "*******\n"; + } +} + #----------------------------------------------------------------------- sub usage { print << "END"; -Usage: genrbjar.pl [+] +Usage: genrbjar.pl [+] + genrbjar.pl ('Debug' | 'Release') [+] + +'Debug' or 'Release' is required on MSWin32, and absent on UNIX. genrbjar creates the ICULocaleData.jar file in the icu4j project. It uses locale data files in the icu4c directory and processes them with @@ -316,9 +342,14 @@ are listed, all locales are processed. Before running this tool, a JDK must be installed and the javac and jar binaries for that JDK must be on the system path. -e.g: - i) on MacOSX: ./genrbjar.pl /Users/build/ICU_MACOSX/icu /Users/build/icu4j DYLD_LIBRARY_PATH - ii) on Linux: ./genrbjar.pl /Users/build/ICU_MACOSX/icu /Users/build/icu4j LD_LIBRARY_PATH +Examples: + i) on Linux: ./genrbjar.pl ~/icu ~/icu4j + ii) on Win32: perl genrbjar.pl C:\\icu C:\\icu4j Debug + +NOTE: You CANNOT use the ICULocaleData.jar created on little endian +machines (e.g. Win32) because the *.col files will have the wrong byte +order. However, you can use the *.class files and look at the *.java +files. END exit(0); }