-
Notifications
You must be signed in to change notification settings - Fork 7.3k
build: enable a smaller Intl (i18n / ICU) build #7719
Conversation
I updated the todo list at top - v8 has commented on some of these patches.
So, I think I can update this PR to not have any |
I've rebased this PR, and removed the v8 deps. |
if anyone wants a full icudt53l.dat file to play with the --with-icu-dir= option, the one I am using is at https://ssl.icu-project.org/~srl/tmp/NOT_FOR_PRODUCTION/NOT_FOR_PRODUCTION_TESTICU.zip (md5: fd2dcff4bd5b88b4841710120987ebaf ) otherwise you can pull it from the ICU 53 source .tgz download at http://site.icu-project.org/download/53 - see |
|
||
`make` | ||
|
||
`make install` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap lines at 80 columns here? If you have trouble fitting URLs in that space, you can use GH's [description]: http://www.example.com/
markdown extension. See the bottom of doc/api/http.markdown for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do. The README notes are sort of centralized notes on the whole PR, much of it will get either removed or split out elsewhere in the docs.
There's a bunch of style issues but in general I like where this is going. Can you run |
@bnoordhuis thanks, will do. On the |
Apropos the shell script, I think it's going to be a hard requirement that it works on both Windows and POSIX platforms. Some solution would need to be concocted but I'm not sure what. Do you have suggestions? |
@bnoordhuis re: Windows, Just to verify, there's no prereq of cygwin or msys? (I think this is why chromium's ICU branch was so big, it had prebuilt data in a consumable form for Windows to avoid building the tools..) Anyways, I've got Win7 fired up, I'll work on this. All of the above is important proof of concept and the C/python code will be needed no matter what. |
That's correct, the only prerequisites are MSVC and python. I suppose that, technically speaking, you could also build node with the Windows SDK but I don't think anyone actually does. |
@bnoordhuis I was able to get a windows build to build/run w/o crashing, minus any data. So we won't need any new prereqs, just need to port the ICU tooling over to gyp. Trying to avoid hand-curation of the kind that Chromium does. FYI: windows work on a side PR https://github.com/srl295/node/pull/1 - I'll merge it back in back to this PR once working. |
FYI: https://github.com/srl295/btest402 is my trivial "is Intl alive or dead? is it a small or full set?" test project. |
@bnoordhuis I think I have addressed most of the style issues besides the |
FYI: windows build (with no inbuilt data) is working. Will keep working on the data portion. |
Now |
* English and Root data only | ||
* Only the services needed by v8's Intl implementation | ||
* Specify an additional icu data file with either: | ||
* The `NODE_ICU_DATA` env variable: `env NODE_ICU_DATA=/some/path node` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could that be a potential security pitfall in the (admittedly rather unlikely) event that node is a setuid root binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICU has a #define UCONFIG_NO_FILE_IO 1
switch as well as an API udata_setFileAccess(UDATA_NO_FILES);
, either of which serves to shut off file I/O for ICU itself.
@srl295 Does seem to be a gyp bug. So I won't prevent this patch from landing because of someone else's screw up in a third-party dependency. :-P Let me just go over this one more time and I'll sign off. |
@srl295 Two nits. Other than that LGTM. Ping me when resolved and we'll finally merge this! |
Reviewed-by: Trevor Norris <[email protected]>
Reviewed-by: Trevor Norris <[email protected]>
The parameter parser specifically looked for the old bracket syntax. This generated a lot of warnings when building the docs. Those warnings have been fixed by changing the parsing logic. Signed-off-by: Trevor Norris <[email protected]>
Running fill() with an empty string would cause Node to hang indefinitely. Now it will return without having operated on the buffer. User facing function has been pulled into JS to perform all initial value checks and coercions. The C++ method has been placed on the "internal" object. Coerced non-string values to numbers to match v0.10 support. Simplified logic and changed a couple variable names. Added tests for fill() and moved them all to the beginning of buffer-test.js since many other tests depend on fill() working properly. Fixes: nodejs#8469 Signed-off-by: Trevor Norris <[email protected]>
Note: This is a rebase on master/v0.12 (as of 57ed3da) 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 in the PR nodejs#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.) Now, a summary of the 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 nodejs#7719 (comment) * Made clang work * wrapped the `--icu-data-dir=` param in `#if defined(NODE_HAVE_I18N_SUPPORT)` as requested
@trevnorris done and rebased.. |
Reviewed-By: Chris Dickinson <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
@srl295 Oh, so close. Sorry one more question. Thanks for persevering through all this. Think this is the longest PR thread in Node history. |
@trevnorris no prob, thanks to you (& the rest of the community) for working with me on it! OK, I've Edit: re-based on v0.12 I also reviewed the diffs vs. v0.12 and didn't find any other such odd changes. Maybe a |
Note: This is a rebase on master/v0.12 (as of 25702ab) 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 in the PR nodejs#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.) Now, a summary of the 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 nodejs#7719 (comment) * Made clang work * wrapped the `--icu-data-dir=` param in `#if defined(NODE_HAVE_I18N_SUPPORT)` as requested
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 #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 #7719 (comment) 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 <[email protected]> Reviewed-by: Fedor Indutny <[email protected]>
Thanks much. Merged in ac2857b. |
@trevnorris yay! Will :
|
Awesome! Now on to the quest of having the default Node build use the |
Move from argparse to optparse for dependency management. Fixes: #7719 (comment) Reviewed-by: Trevor Norris <[email protected]>
Implements #7676 - see
README.md
for details. Also search forIntl
on https://github.com/srl295/node/wiki/Installation to see items to add into the main wiki.Passes
make test
as well as current HEAD did (some network test failures?)known TODOs:
README.md
. Move elsewhere/delete.icu-generic.sh
in python and/or use cygwin?deps/icu
, enjoy"configure
options to:--with-intl=small-icu
orfull-icu
orsystem-icu
system-icu
- mac/unx only, looks for an installed ICU.InitializeICU
function https://code.google.com/p/v8/issues/detail?id=3344 ( workaround: could call the ICU functions directly from node.. ) *Update: v8's preference may be that node call into ICU directly here for setup. Fine, I can move that code out of deps/v8 and into node.cc or elsewhere. *NB: I have signed the CLA, you will find me under
srloomis
at US dot IBM dot COM