Skip to content

feat: add no_icu feature to build V8 without i18n/ICU support#1996

Open
bartlomieju wants to merge 3 commits into
mainfrom
feat/no_icu
Open

feat: add no_icu feature to build V8 without i18n/ICU support#1996
bartlomieju wants to merge 3 commits into
mainfrom
feat/no_icu

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

@bartlomieju bartlomieju commented May 31, 2026

Adds an opt-out no_icu cargo feature that builds V8 with
v8_enable_i18n_support=false. This drops the embedded ICU data (around
10MB) and the Intl API from the resulting static library, producing a
slimmer build for consumers that do not need internationalization. The
motivation is a slim denort variant for the Deno CLI, where the ICU and
Intl surface is rarely used.

The feature is an opt-out rather than a default-on icu feature on
purpose. A default-on feature would silently drop ICU for every consumer
that sets default-features = false (which the Deno CLI does), and it
would change existing prebuilt archive names. Modelling it as no_icu
keeps all current consumers and their archive names unchanged, and only
the slim build opts in.

A new rusty_v8_enable_i18n GN arg gates the ICU bindings in
src/binding.cc. When i18n is disabled, icu_get_default_locale and
icu_set_default_locale fall back to stub implementations that report a
fixed en-US tag and ignore locale changes, so the static library still
links without ICU. set_common_data_77 and its underlying ICU symbol are
compiled out, since there is no ICU to hand data to. The ICU-specific
tests are gated behind not(feature = "no_icu").

The prebuilt download suffix gains a _noicu component. CI builds a
simdutf + no_icu release variant across the targets the Deno CLI ships
(including the separate aarch64-pc-windows-msvc cross-compile job), so a
librusty_v8_simdutf_noicu_release_<target>.a archive is published. This
is the exact feature combo the CLI consumes (it always builds with
simdutf), so it does not expand the matrix into a full cross product.

Note: this is a prototype/experiment. The slim deno consumer plumbing (a
no_icu cargo feature threaded through deno_core/deno_runtime and a
denort-slim target) lives in the Deno repo and consumes the archives
produced here.

A possible future cleanup is to make simdutf a separately linkable
archive so it stops being a build-matrix axis: #1997.

Adds an opt-out `no_icu` cargo feature that builds V8 with
`v8_enable_i18n_support=false`. This drops the embedded ICU data (~10MB)
and the `Intl` API from the resulting static library, producing a
slimmer build for consumers that do not need internationalization.

The feature is modelled as an opt-out (rather than a default-on `icu`
feature) so existing consumers, including those that set
`default-features = false`, keep ICU without any changes and their
prebuilt archive names are unchanged.

A new `rusty_v8_enable_i18n` GN arg gates the ICU bindings in
`src/binding.cc`. When i18n is disabled, `icu_get_default_locale` and
`icu_set_default_locale` fall back to stub implementations that report a
fixed `en-US` tag and ignore locale changes, so the static library still
links without ICU. `set_common_data_77` (and its underlying ICU symbol)
is compiled out, since there is no ICU to hand data to.

The prebuilt download suffix gains a `_noicu` component, and CI builds a
`simdutf + no_icu` release variant across the targets the Deno CLI ships
so a `librusty_v8_simdutf_noicu_release_<target>.a` archive is published.
Adds a `build-windows-arm64-simdutf-noicu` cross-compile job mirroring the
existing simdutf aarch64-windows job, building with `--features simdutf
--features no_icu` and publishing the `_simdutf_noicu` archive and src
binding. Also adds it to the `publish` job's `needs` so the crate publish
waits for it.
The no_icu stubs make set_default_locale a no-op and get_language_tag
return a fixed en-US tag, so the locale round-trip assertion does not
hold without ICU.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant