readme.txt
1 This directory is used for building our Android ICU data file.
2
3 1. To generate ICU data files:run the icu_dat_generator.py script.
4 The command is:
5 ./icu_dat_generator.py <icu version> [-v] [-h]
6 For example:
7 ./icu_dat_generator.py 4.2
8
9 2. To add a resource to Android ICU data file: insert an entry to
10 icudtxx-<tag name>.txt under external/icu4c/stubdata directory then
11 run the icu_dat_generator.py.
12 For example, to add French sort to icudt42l-us.dat, you need to
13 a. Add an entry, "coll/fr.res", into external/icu4c/stubdata/icudt42l-us.txt
14 b. run "./icu_dat_generator.py 4.2".
15
16 3. To add a new Adnroid ICU data file: add the <tag name> to datlist[] in
17 icu_dat_generator.py and add corresponding resource list to
18 icudtxxl<tag name>.txt. Then run the script icu_dat_generator.py to generate
19 dat files.
20 For example, to add icudt42l-latin.dat, you need to
21 a. Modify icu_dat_generator.py by adding "latin" into datlist.
22 b. Make a new file icudt42l-latin.txt to include the resource list.
23 c. run "./icu_dat_generator.py 4.2".
24
25 4. Add a new resource or modify existing ICU resource definition:
26 Note: This is a rare case. You should talk to ICU team first if it is a bug
27 in ICU resource or a feature enhancement before making such changes.
28 If you would like to add existing ICU resource to Android, please check #2.
29 a. Create or change the text format resource files under external/icu4c/data.
30 b. Make a temporary directory for ICU build.
31 i.e. mkdir external/icu4c/icuBuild
32 c. cd to ICU build directory.
33 i.e. cd external/icu4c/icuBuild
34 d. Run external/icu4c/runConfigureICU with "Linux" option to generate the
35 makefile.
36 i.e. $ANDROID_BUILD_TOP/external/icu4c/runConfigureICU Linux
37 e. make -j2
38 f. The new icudtxxl.dat is under data/out/tmp and the individual resources are
39 under data/out/build/icudtxxl
40 For example, you can find data/out/tmp/icudt42l.dat and data/out/build/icudt42l/*.res.
41 g. Copy the new icudtxxl.dat over $ANDROID_BUILD_TOP/external/icu4c/stubdata/icudtxxl-all.dat.
42 i.e. cp data/out/tmp/icudt42l.dat $ANDROID_BUILD_TOP/external/icu4c/stubdata/icudt42l-all.dat.
43 h. Check #1 or #2 to replace or add resource to ICU.
44 i. Clean up ICU build directory.
45 j. Discuss with icu-team how to include the change to public ICU.
46
47 Locale Resource Files:
48 - icudt42l-all.dat contains the resources in packed
49 form. It includes everything that comes with
50 a vanilla ICU 4.2. icu_dat_generator.py uses this file to generate
51 custom build dat files.
52
53 - cnv/*.cnv are the additional encodings required by Android.
54 These are
55 - gsm-03.38-2000.cnv
56 - iso-8859_16-2001.cnv
57 - docomo-shift_jis-2007.cnv
58 - kddi-jisx-208-2007.cnv
59 - kddi-shift_jis-2007.cnv
60 - softbank-jisx-208-2007.cnv
61 - softbank-shift_jis-2007.cnv
62
63 - Text format ICU resource files are under external/icu4c/data directory.
64 Binary resource files are packaged in external/icu4c/stubdata/icudtxxl-all.dat.
65 If you have special need such as bug fxings or examining individual resource size,
66 you can run icupkg utility to extract icudtxxl-all.dat into a temporary directory.
67 For example:
68 cd $ANDROID_BUILD_TOP/external/icu4c/stubdata
69 cp icudt42l-all.dat icudt42l.dat
70 mkdir tempDir
71 $ANDROID_BUILD_TOP/prebuilt/linux-x86/icu-4.2/icupkg icudt42l.dat -x "*" -d tempDir
72
73 Run ICU tests:
74 ICU tests are not part of Android build. If you change the ICU code or data,
75 it is highly recommended to run ICU tests.
76 1. Remove the flag "-R" in external/icu4c/data/Makefile.in.
77 "Reverse collation keys" tables are not included in ICU data on Android. To
78 pass ICU collation tests, you need to delete the flag "-R" in Makefile.in.
79 Search for " -R" under "### collation res" section in external/icu4c/data/Makefile.in,
80 delete all of them.
81 2. Make a temporary directory for ICU build.
82 i.e. mkdir external/icu4c/icuBuild
83 3. cd to ICU build directory.
84 i.e. cd external/icu4c/icuBuild
85 4. Run external/icu4c/runConfigureICU with "Linux" option to generate the makefile.
86 i.e. $ANDROID_BUILD_TOP/external/icu4c/runConfigureICU Linux
87 5. make -j2 check
88 6. Check the result. Ignore the errors from tsconv.
89
90 Note:
91 1. The script assumes you have done
92 envsetup.sh and choosecombo before, because
93 it relies on an environment variable pointing
94 to the prebuilt tools.
95
96