|
|
|
# Notes about the icu directory.
|
build, i18n: improve Intl build, add "--with-intl"
The two main goals of this change are:
- To make it easier to build the Intl option using ICU (particularly,
using a newer ICU than v8/Chromium's version)
- To enable a much smaller ICU build with only English support The goal
here is to get node.js binaries built this way by default so that the
Intl API can be used. Additional data can be added at execution time
(see Readme and wiki)
More details are at https://github.com/joyent/node/pull/7719
In particular, this change adds the "--with-intl=" configure option to
provide more ways of building "Intl":
- "full-icu" picks up an ICU from deps/icu
- "small-icu" is similar, but builds only English
- "system-icu" uses pkg-config to find an installed ICU
- "none" does nothing (no Intl)
For Windows builds, the "full-icu" or "small-icu" options are added to
vcbuild.bat.
Note that the existing "--with-icu-path" option is not removed from
configure, but may not be used alongside the new option.
Wiki changes have already been made on
https://github.com/joyent/node/wiki/Installation
and a new page created at
https://github.com/joyent/node/wiki/Intl
(marked as provisional until this change lands.)
Summary of changes:
* README.md : doc updates
* .gitignore : added "deps/icu" as this is the location where ICU is
unpacked to.
* Makefile : added the tools/icu/* files to cpplint, but excluded a
problematic file.
* configure : added the "--with-intl" option mentioned above.
Calculate at config time the list of ICU source files to use and data
packaging options.
* node.gyp : add the new files src/node_i18n.cc/.h as well as ICU
linkage.
* src/node.cc : add call into
node::i18n::InitializeICUDirectory(icu_data_dir) as well as new
--icu-data-dir option and NODE_ICU_DATA env variable to configure ICU
data loading. This loading is only relevant in the "small"
configuration.
* src/node_i18n.cc : new source file for the above Initialize..
function, to setup ICU as needed.
* tools/icu : new directory with some tools needed for this build.
* tools/icu/icu-generic.gyp : new .gyp file that builds ICU in some new
ways, both on unix/mac and windows.
* tools/icu/icu-system.gyp : new .gyp file to build node against a
pkg-config detected ICU.
* tools/icu/icu_small.json : new config file for the "English-only" small
build.
* tools/icu/icutrim.py : new tool for trimming down ICU data. Reads the
above .json file.
* tools/icu/iculslocs.cc : new tool for repairing ICU data manifests
after trim operation.
* tools/icu/no-op.cc : dummy file to force .gyp into using a C++ linker.
* vcbuild.bat : added small-icu and full-icu options, to call into
configure.
* Fixed toolset dependencies, see
https://github.com/joyent/node/pull/7719#issuecomment-54641687
Note that because of a bug in gyp {CC,CXX}_host must also be set.
Otherwise gcc/g++ will be used by default for part of the build.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
10 years ago
|
|
|
|
|
|
|
## How to upgrade ICU
|
|
|
|
|
|
|
|
- Make sure your node workspace is clean (clean `git status`) should be sufficient.
|
|
|
|
- Configure Node with the specific [ICU version](http://icu-project.org/download) you want to upgrade to, for example:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
./configure \
|
|
|
|
--with-intl=small-icu \
|
|
|
|
--with-icu-source=http://download.icu-project.org/files/icu4c/58.1/icu4c-58_1-src.tgz
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
(The equivalent `vcbuild.bat` commands should work also. Note that we use the `.tgz` and not the `.zip` here,
|
|
|
|
that is because of line endings.)
|
|
|
|
|
|
|
|
- (note- may need to make changes in `icu-generic.gyp` or `tools/icu/patches` for
|
|
|
|
version specific stuff)
|
|
|
|
|
|
|
|
- Verify the node build works
|
|
|
|
|
|
|
|
```shell
|
|
|
|
make test-ci
|
|
|
|
```
|
|
|
|
|
|
|
|
Also running
|
|
|
|
```js
|
|
|
|
new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8));
|
|
|
|
```
|
|
|
|
|
|
|
|
…Should return `January` not `enero`.
|
|
|
|
(TODO here: improve [testing](https://github.com/nodejs/Intl/issues/16))
|
|
|
|
|
|
|
|
|
|
|
|
- Now, copy `deps/icu` over to `deps/icu-small`
|
|
|
|
|
|
|
|
```shell
|
|
|
|
python tools/icu/shrink-icu-src.py
|
|
|
|
```
|
|
|
|
|
|
|
|
- Now, do a clean rebuild of node to test:
|
|
|
|
|
|
|
|
(TODO: fix this when these options become default)
|
|
|
|
|
|
|
|
```shell
|
|
|
|
./configure --with-intl=small-icu --with-icu-source=deps/icu-small
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
- Test this newly default-generated Node.js
|
|
|
|
```js
|
|
|
|
process.versions.icu;
|
|
|
|
new Intl.DateTimeFormat('es',{month:'long'}).format(new Date(9E8));
|
|
|
|
```
|
|
|
|
|
|
|
|
(should return your updated ICU version number, and also `January` again.)
|
|
|
|
|
|
|
|
- You are ready to check in the updated `deps/small-icu`.
|
|
|
|
This is a big commit, so make this a separate commit from other changes.
|
|
|
|
|
|
|
|
- Now, rebuild the Node license.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# clean up - remove deps/icu
|
|
|
|
make clean
|
|
|
|
tools/license-builder.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
- Now, fix the default URL for the `full-icu` build in `/configure`, in
|
|
|
|
the `configure_intl()` function. It should match the ICU URL used in the
|
|
|
|
first step. When this is done, the following should build with full ICU.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# clean up
|
|
|
|
rm -rf out deps/icu deps/icu4c*
|
|
|
|
./configure --with-intl=full-icu --download=all
|
|
|
|
make
|
|
|
|
make test-ci
|
|
|
|
```
|
|
|
|
|
|
|
|
- commit the change to `configure` along with the updated `LICENSE` file.
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
## Notes about these tools
|
|
|
|
|
build, i18n: improve Intl build, add "--with-intl"
The two main goals of this change are:
- To make it easier to build the Intl option using ICU (particularly,
using a newer ICU than v8/Chromium's version)
- To enable a much smaller ICU build with only English support The goal
here is to get node.js binaries built this way by default so that the
Intl API can be used. Additional data can be added at execution time
(see Readme and wiki)
More details are at https://github.com/joyent/node/pull/7719
In particular, this change adds the "--with-intl=" configure option to
provide more ways of building "Intl":
- "full-icu" picks up an ICU from deps/icu
- "small-icu" is similar, but builds only English
- "system-icu" uses pkg-config to find an installed ICU
- "none" does nothing (no Intl)
For Windows builds, the "full-icu" or "small-icu" options are added to
vcbuild.bat.
Note that the existing "--with-icu-path" option is not removed from
configure, but may not be used alongside the new option.
Wiki changes have already been made on
https://github.com/joyent/node/wiki/Installation
and a new page created at
https://github.com/joyent/node/wiki/Intl
(marked as provisional until this change lands.)
Summary of changes:
* README.md : doc updates
* .gitignore : added "deps/icu" as this is the location where ICU is
unpacked to.
* Makefile : added the tools/icu/* files to cpplint, but excluded a
problematic file.
* configure : added the "--with-intl" option mentioned above.
Calculate at config time the list of ICU source files to use and data
packaging options.
* node.gyp : add the new files src/node_i18n.cc/.h as well as ICU
linkage.
* src/node.cc : add call into
node::i18n::InitializeICUDirectory(icu_data_dir) as well as new
--icu-data-dir option and NODE_ICU_DATA env variable to configure ICU
data loading. This loading is only relevant in the "small"
configuration.
* src/node_i18n.cc : new source file for the above Initialize..
function, to setup ICU as needed.
* tools/icu : new directory with some tools needed for this build.
* tools/icu/icu-generic.gyp : new .gyp file that builds ICU in some new
ways, both on unix/mac and windows.
* tools/icu/icu-system.gyp : new .gyp file to build node against a
pkg-config detected ICU.
* tools/icu/icu_small.json : new config file for the "English-only" small
build.
* tools/icu/icutrim.py : new tool for trimming down ICU data. Reads the
above .json file.
* tools/icu/iculslocs.cc : new tool for repairing ICU data manifests
after trim operation.
* tools/icu/no-op.cc : dummy file to force .gyp into using a C++ linker.
* vcbuild.bat : added small-icu and full-icu options, to call into
configure.
* Fixed toolset dependencies, see
https://github.com/joyent/node/pull/7719#issuecomment-54641687
Note that because of a bug in gyp {CC,CXX}_host must also be set.
Otherwise gcc/g++ will be used by default for part of the build.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
10 years ago
|
|
|
The files in this directory were written for the node.js effort. It's
|
|
|
|
the intent of their author (Steven R. Loomis / srl295) to merge them
|
|
|
|
upstream into ICU, pending much discussion within the ICU-PMC.
|
|
|
|
|
|
|
|
`icu_small.json` is somewhat node-specific as it specifies a "small ICU"
|
|
|
|
configuration file for the `icutrim.py` script. `icutrim.py` and
|
|
|
|
`iculslocs.cpp` may themselves be superseded by components built into
|
|
|
|
ICU in the future.
|
|
|
|
|
|
|
|
The following tickets were opened during this work, and their
|
|
|
|
resolution may inform the reader as to the current state of icu-trim
|
|
|
|
upstream:
|
|
|
|
|
|
|
|
* [#10919](http://bugs.icu-project.org/trac/ticket/10919)
|
|
|
|
(experimental branch - may copy any source patches here)
|
|
|
|
* [#10922](http://bugs.icu-project.org/trac/ticket/10922)
|
|
|
|
(data packaging improvements)
|
|
|
|
* [#10923](http://bugs.icu-project.org/trac/ticket/10923)
|
|
|
|
(rewrite data building in python)
|
|
|
|
|
|
|
|
When/if components (not including the `.json` file) are merged into
|
|
|
|
ICU, this code and `configure` will be updated to detect and use those
|
|
|
|
variants rather than the ones in this directory.
|