Commit d502b83c authored by Stephen Gallagher's avatar Stephen Gallagher Committed by Rich Trott
Browse files

build: auto-load ICU data from --with-icu-default-data-dir

When compiled with `--with-intl=small` and
`--with-icu-default-data-dir=PATH`, Node.js will use PATH as a
fallback location for the ICU data.

We will first perform an access check using fopen(PATH, 'r') to
ensure that the file is readable. If it is, we'll set the
icu_data_directory and proceed. There's a slight overhead for the
fopen() check, but it should be barely measurable.

This will be useful for Linux distribution packagers who want to
be able to ship a minimal node binary in a container image but
also be able to add on the full i18n support where needed. With
this patch, it becomes possible to ship the interpreter as
/usr/bin/node in one package for the distribution and to ship the
data files in another package (without a strict dependency
between the two). This means that users of the distribution will
not need to explicitly direct Node.js to locate the ICU data. It
also means that in environments where full internationalization is
not required, they do not need to carry the extra content (with
the associated storage costs).

Refs: https://github.com/nodejs/node/issues/3460



Signed-off-by: default avatarStephen Gallagher <sgallagh@redhat.com>

PR-URL: https://github.com/nodejs/node/pull/30825


Reviewed-By: default avatarSteven R Loomis <srloomis@us.ibm.com>
Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarRichard Lau <riclau@uk.ibm.com>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
parent e4e5a835
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment