| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ee1e5a2 commit dce6413
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -117,29 +117,14 @@ $ make | |||
| 117 | 117 | ||
| 118 | 118 | ### `Intl` (ECMA-402) support: | |
| 119 | 119 | ||
| 120 | - [Intl](https://github.com/nodejs/node/wiki/Intl) support is not | ||
| 121 | - enabled by default. | ||
| 120 | + [Intl](https://github.com/nodejs/node/wiki/Intl) support is | ||
| 121 | + enabled by default, with English data only. | ||
| 122 | 122 | ||
| 123 | + #### Default: `small-icu` (English only) support | ||
| 123 | 124 | ||
| 124 | - #### "small" (English only) support | ||
| 125 | - | ||
| 126 | - This option will build with "small" (English only) support, but | ||
| 127 | - the full `Intl` (ECMA-402) APIs. With `--download=all` it will | ||
| 128 | - download the ICU library as needed. | ||
| 129 | - | ||
| 130 | - ##### Unix / OS X: | ||
| 131 | - | ||
| 132 | - ```text | ||
| 133 | - $ ./configure --with-intl=small-icu --download=all | ||
| 134 | - ``` | ||
| 135 | - | ||
| 136 | - ##### Windows: | ||
| 137 | - | ||
| 138 | - ```text | ||
| 139 | - > vcbuild small-icu download-all | ||
| 140 | - ``` | ||
| 141 | - | ||
| 142 | - The `small-icu` mode builds with English-only data. You can add full | ||
| 125 | + By default, only English data is included, but | ||
| 126 | + the full `Intl` (ECMA-402) APIs. It does not need to download | ||
| 127 | + any dependencies to function. You can add full | ||
| 143 | 128 | data at runtime. | |
| 144 | 129 | ||
| 145 | 130 | *Note:* more docs are on | |
@@ -148,7 +133,8 @@ data at runtime. | |||
| 148 | 133 | #### Build with full ICU support (all locales supported by ICU): | |
| 149 | 134 | ||
| 150 | 135 | With the `--download=all`, this may download ICU if you don't have an | |
| 151 | - ICU in `deps/icu`. | ||
| 136 | + ICU in `deps/icu`. (The embedded `small-icu` included in the default | ||
| 137 | + Node.js source does not include all locales.) | ||
| 152 | 138 | ||
| 153 | 139 | ##### Unix / OS X: | |
| 154 | 140 | ||
@@ -164,19 +150,19 @@ $ ./configure --with-intl=full-icu --download=all | |||
| 164 | 150 | ||
| 165 | 151 | #### Building without Intl support | |
| 166 | 152 | ||
| 167 | - The `Intl` object will not be available. This is the default at | ||
| 168 | - present, so this option is not normally needed. | ||
| 153 | + The `Intl` object will not be available, nor some other APIs such as | ||
| 154 | + `String.normalize`. | ||
| 169 | 155 | ||
| 170 | 156 | ##### Unix / OS X: | |
| 171 | 157 | ||
| 172 | 158 | ```text | |
| 173 | - $ ./configure --with-intl=none | ||
| 159 | + $ ./configure --without-intl | ||
| 174 | 160 | ``` | |
| 175 | 161 | ||
| 176 | 162 | ##### Windows: | |
| 177 | 163 | ||
| 178 | 164 | ```text | |
| 179 | - > vcbuild intl-none | ||
| 165 | + > vcbuild without-intl | ||
| 180 | 166 | ``` | |
| 181 | 167 | ||
| 182 | 168 | #### Use existing installed ICU (Unix / OS X only): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -303,20 +303,28 @@ parser.add_option('--with-etw', | |||
| 303 | 303 | intl_optgroup.add_option('--with-intl', | |
| 304 | 304 | action='store', | |
| 305 | 305 | dest='with_intl', | |
| 306 | - default='none', | ||
| 306 | + default='small-icu', | ||
| 307 | 307 | choices=valid_intl_modes, | |
| 308 | 308 | help='Intl mode (valid choices: {0}) [default: %default]'.format( | |
| 309 | 309 | ', '.join(valid_intl_modes))) | |
| 310 | 310 | ||
| 311 | + intl_optgroup.add_option('--without-intl', | ||
| 312 | + action='store_const', | ||
| 313 | + dest='with_intl', | ||
| 314 | + const='none', | ||
| 315 | + help='Disable Intl, same as --with-intl=none') | ||
| 316 | + | ||
| 311 | 317 | intl_optgroup.add_option('--with-icu-path', | |
| 312 | 318 | action='store', | |
| 313 | 319 | dest='with_icu_path', | |
| 314 | 320 | help='Path to icu.gyp (ICU i18n, Chromium version only.)') | |
| 315 | 321 | ||
| 322 | + icu_default_locales='root,en' | ||
| 323 | + | ||
| 316 | 324 | intl_optgroup.add_option('--with-icu-locales', | |
| 317 | 325 | action='store', | |
| 318 | 326 | dest='with_icu_locales', | |
| 319 | - default='root,en', | ||
| 327 | + default=icu_default_locales, | ||
| 320 | 328 | help='Comma-separated list of locales for "small-icu". "root" is assumed. ' | |
| 321 | 329 | '[default: %default]') | |
| 322 | 330 | ||
@@ -880,7 +888,7 @@ do_not_edit = '# Do not edit. Generated by the configure script.\n' | |||
| 880 | 888 | ||
| 881 | 889 | def glob_to_var(dir_base, dir_sub, patch_dir): | |
| 882 | 890 | list = [] | |
| 883 | - dir_all = os.path.join(dir_base, dir_sub) | ||
| 891 | + dir_all = '%s/%s' % (dir_base, dir_sub) | ||
| 884 | 892 | files = os.walk(dir_all) | |
| 885 | 893 | for ent in files: | |
| 886 | 894 | (path, dirs, files) = ent | |
@@ -968,6 +976,7 @@ def configure_intl(o): | |||
| 968 | 976 | locs = set(options.with_icu_locales.split(',')) | |
| 969 | 977 | locs.add('root') # must have root | |
| 970 | 978 | o['variables']['icu_locales'] = string.join(locs,',') | |
| 979 | + # We will check a bit later if we can use the canned deps/icu-small | ||
| 971 | 980 | elif with_intl == 'full-icu': | |
| 972 | 981 | # full ICU | |
| 973 | 982 | o['variables']['v8_enable_i18n_support'] = 1 | |
@@ -994,15 +1003,42 @@ def configure_intl(o): | |||
| 994 | 1003 | # this is just the 'deps' dir. Used for unpacking. | |
| 995 | 1004 | icu_parent_path = os.path.join(root_dir, 'deps') | |
| 996 | 1005 | ||
| 997 | - # The full path to the ICU source directory. | ||
| 998 | - icu_full_path = os.path.join(icu_parent_path, 'icu') | ||
| 1006 | + # The full path to the ICU source directory. Should not include './'. | ||
| 1007 | + icu_full_path = 'deps/icu' | ||
| 999 | 1008 | ||
| 1000 | 1009 | # icu-tmp is used to download and unpack the ICU tarball. | |
| 1001 | 1010 | icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp') | |
| 1002 | 1011 | ||
| 1012 | + # canned ICU. see tools/icu/README.md to update. | ||
| 1013 | + canned_icu_dir = 'deps/icu-small' | ||
| 1014 | + | ||
| 1015 | + # We can use 'deps/icu-small' - pre-canned ICU *iff* | ||
| 1016 | + # - with_intl == small-icu (the default!) | ||
| 1017 | + # - with_icu_locales == 'root,en' (the default!) | ||
| 1018 | + # - deps/icu-small exists! | ||
| 1019 | + # - with_icu_source is unset (i.e. no other ICU was specified) | ||
| 1020 | + # (Note that this is the *DEFAULT CASE*.) | ||
| 1021 | + # | ||
| 1022 | + # This is *roughly* equivalent to | ||
| 1023 | + # $ configure --with-intl=small-icu --with-icu-source=deps/icu-small | ||
| 1024 | + # .. Except that we avoid copying icu-small over to deps/icu. | ||
| 1025 | + # In this default case, deps/icu is ignored, although make clean will | ||
| 1026 | + # still harmlessly remove deps/icu. | ||
| 1027 | + | ||
| 1028 | + # are we using default locales? | ||
| 1029 | + using_default_locales = ( options.with_icu_locales == icu_default_locales ) | ||
| 1030 | + | ||
| 1031 | + # make sure the canned ICU really exists | ||
| 1032 | + canned_icu_available = os.path.isdir(canned_icu_dir) | ||
| 1033 | + | ||
| 1034 | + if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available: | ||
| 1035 | + # OK- we can use the canned ICU. | ||
| 1036 | + icu_config['variables']['icu_small_canned'] = 1 | ||
| 1037 | + icu_full_path = canned_icu_dir | ||
| 1038 | + | ||
| 1003 | 1039 | # --with-icu-source processing | |
| 1004 | - # first, check that they didn't pass --with-icu-source=deps/icu | ||
| 1005 | - if with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source): | ||
| 1040 | + # now, check that they didn't pass --with-icu-source=deps/icu | ||
| 1041 | + elif with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source): | ||
| 1006 | 1042 | print 'Ignoring redundant --with-icu-source=%s' % (with_icu_source) | |
| 1007 | 1043 | with_icu_source = None | |
| 1008 | 1044 | # if with_icu_source is still set, try to use it. | |
@@ -1043,7 +1079,7 @@ def configure_intl(o): | |||
| 1043 | 1079 | ||
| 1044 | 1080 | # ICU mode. (icu-generic.gyp) | |
| 1045 | 1081 | o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp' | |
| 1046 | - # ICU source dir relative to root | ||
| 1082 | + # ICU source dir relative to tools/icu (for .gyp file) | ||
| 1047 | 1083 | o['variables']['icu_path'] = icu_full_path | |
| 1048 | 1084 | if not os.path.isdir(icu_full_path): | |
| 1049 | 1085 | print '* ECMA-402 (Intl) support didn\'t find ICU in %s..' % (icu_full_path) | |
@@ -1083,14 +1119,14 @@ def configure_intl(o): | |||
| 1083 | 1119 | 'source/data/in', | |
| 1084 | 1120 | icu_data_file_l) | |
| 1085 | 1121 | # relative to dep.. | |
| 1086 | - icu_data_in = os.path.join('../../deps/icu/source/data/in', icu_data_file_l) | ||
| 1122 | + icu_data_in = os.path.join('..','..', icu_full_path, 'source/data/in', icu_data_file_l) | ||
| 1087 | 1123 | if not os.path.isfile(icu_data_path) and icu_endianness != 'l': | |
| 1088 | 1124 | # use host endianness | |
| 1089 | 1125 | icu_data_path = os.path.join(icu_full_path, | |
| 1090 | 1126 | 'source/data/in', | |
| 1091 | 1127 | icu_data_file) | |
| 1092 | 1128 | # relative to dep.. | |
| 1093 | - icu_data_in = os.path.join('icu/source/data/in', | ||
| 1129 | + icu_data_in = os.path.join('..', icu_full_path, 'source/data/in', | ||
| 1094 | 1130 | icu_data_file) | |
| 1095 | 1131 | # this is the input '.dat' file to use .. icudt*.dat | |
| 1096 | 1132 | # may be little-endian if from a icu-project.org tarball | |
@@ -1117,7 +1153,7 @@ def configure_intl(o): | |||
| 1117 | 1153 | # with a list of the src files to use | |
| 1118 | 1154 | for i in icu_src: | |
| 1119 | 1155 | var = 'icu_src_%s' % i | |
| 1120 | - path = '../../deps/icu/source/%s' % icu_src[i] | ||
| 1156 | + path = '../../%s/source/%s' % (icu_full_path, icu_src[i]) | ||
| 1121 | 1157 | icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) ) | |
| 1122 | 1158 | # write updated icu_config.gypi with a bunch of paths | |
| 1123 | 1159 | write(icu_config_name, do_not_edit + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,84 @@ | |||
| 1 | 1 | Notes about the icu directory. | |
| 2 | 2 | === | |
| 3 | 3 | ||
| 4 | + How to upgrade ICU | ||
| 5 | + --- | ||
| 6 | + | ||
| 7 | + - Make sure your node workspace is clean (clean `git status`) should be sufficient. | ||
| 8 | + - Configure Node with the specific [ICU version](http://icu-project.org/download) you want to upgrade to, for example: | ||
| 9 | + | ||
| 10 | + ``` | ||
| 11 | + ./configure \ | ||
| 12 | + --with-intl=small-icu \ | ||
| 13 | + --with-icu-source=http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.zip | ||
| 14 | + make | ||
| 15 | + ``` | ||
| 16 | + | ||
| 17 | + (the equivalent `vcbuild.bat` commands should work also.) | ||
| 18 | + | ||
| 19 | + - (note- may need to make changes in `icu-generic.gyp` or `tools/icu/patches` for | ||
| 20 | + version specific stuff) | ||
| 21 | + | ||
| 22 | + - Verify the node build works | ||
| 23 | + | ||
| 24 | + ``` | ||
| 25 | + make test-ci | ||
| 26 | + ``` | ||
| 27 | + | ||
| 28 | + Also running | ||
| 29 | + ```js | ||
| 30 | + new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8)); | ||
| 31 | + ``` | ||
| 32 | + | ||
| 33 | + …Should return `January` not `enero`. | ||
| 34 | + (TODO here: improve [testing](https://github.com/nodejs/Intl/issues/16)) | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + - Now, copy `deps/icu` over to `deps/icu-small` | ||
| 38 | + | ||
| 39 | + ``` | ||
| 40 | + python tools/icu/shrink-icu-src.py | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | + - Now, do a clean rebuild of node to test: | ||
| 44 | + | ||
| 45 | + (TODO: fix this when these options become default) | ||
| 46 | + | ||
| 47 | + ``` | ||
| 48 | + ./configure --with-intl=small-icu --with-icu-source=deps/icu-small | ||
| 49 | + make | ||
| 50 | + ``` | ||
| 51 | + | ||
| 52 | + - Test this newly default-generated Node.js | ||
| 53 | + ```js | ||
| 54 | + process.versions.icu; | ||
| 55 | + new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8)); | ||
| 56 | + ``` | ||
| 57 | + | ||
| 58 | + (should return your updated ICU version number, and also `January` again.) | ||
| 59 | + | ||
| 60 | + - You are ready to check in the updated `deps/small-icu`. | ||
| 61 | + This is a big commit, so make this a separate commit from other changes. | ||
| 62 | + | ||
| 63 | + - Now, fix the default URL for the `full-icu` build in `/configure`, in | ||
| 64 | + the `configure_intl()` function. It should match the ICU URL used in the | ||
| 65 | + first step. When this is done, the following should build with full ICU. | ||
| 66 | + | ||
| 67 | + ``` | ||
| 68 | + # clean up | ||
| 69 | + rm -rf out deps/icu deps/icu4c* | ||
| 70 | + ./configure --with-intl=full-icu --download=all | ||
| 71 | + make | ||
| 72 | + make test-ci | ||
| 73 | + ``` | ||
| 74 | + | ||
| 75 | + - commit the change to `configure`. | ||
| 76 | + | ||
| 77 | + ----- | ||
| 78 | + | ||
| 79 | + Notes about these tools | ||
| 80 | + --- | ||
| 81 | + | ||
| 4 | 82 | The files in this directory were written for the node.js effort. It's | |
| 5 | 83 | the intent of their author (Steven R. Loomis / srl295) to merge them | |
| 6 | 84 | upstream into ICU, pending much discussion within the ICU-PMC. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments