Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,10 @@ This is the default option.
./configure --with-intl=full-icu
```

`--with-icu-compress` stores that data file compressed. The first run
unpacks it into the temp directory and maps the result, so later
processes share those pages. It is off unless a packager opts in.

#### Windows

```powershell
Expand Down
16 changes: 16 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,15 @@
'the icu4c source archive. '
f"v{icu_versions['minimum_icu']}.x or later recommended.")

intl_optgroup.add_argument('--with-icu-compress',
action='store_true',
dest='with_icu_compress',
default=False,
help='Compress bundled ICU data and map a per-user cache file at runtime. '
'Off by default. Packagers opt in when a smaller on-disk binary is '
'worth the first-launch unpack. Requires --with-intl=full-icu or '
'small-icu.')

intl_optgroup.add_argument('--with-icu-default-data-dir',
action='store',
dest='with_icu_default_data_dir',
Expand Down Expand Up @@ -2544,11 +2553,15 @@ def icu_download(path):
# always set icu_small, node.gyp depends on it being defined.
o['variables']['icu_small'] = b(False)
o['variables']['icu_system'] = b(False)
# Off unless a packager passes --with-icu-compress.
o['variables']['icu_compress_data'] = b(False)

# prevent data override
o['defines'] += ['ICU_NO_USER_DATA_OVERRIDE']

with_intl = options.with_intl
if options.with_icu_compress and with_intl not in ('small-icu', 'full-icu'):
error('--with-icu-compress requires --with-intl=full-icu or small-icu')
Comment on lines +2563 to +2564

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better done in the if system-icu branch.

with_icu_source = options.with_icu_source
have_icu_path = bool(options.with_icu_path)
if have_icu_path and with_intl != 'none':
Expand Down Expand Up @@ -2603,6 +2616,9 @@ def icu_download(path):
o['variables']['icu_gyp_path'] = 'tools/icu/icu-system.gyp'
return

if options.with_icu_compress:
o['variables']['icu_compress_data'] = b(True)

# this is just the 'deps' dir. Used for unpacking.
icu_parent_path = 'deps'

Expand Down
13 changes: 11 additions & 2 deletions deps/zstd/zstd.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,16 @@
],
'sources': [
'<@(zstd_sources)',
]
}
],
'toolsets': ['host', 'target'],
},
{
'target_name': 'zstd_compress',
'type': 'executable',
'toolsets': ['host'],
'dependencies': ['zstd#host'],
'include_dirs': ['lib'],
'sources': ['../../tools/zstd_compress.cc'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder if bringing in a whole new implementation file is the best option. Isn't there any compression anywhere linked into node already?

},
]
}
25 changes: 25 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
'src/node_watchdog.cc',
'src/node_worker.cc',
'src/node_zlib.cc',
'src/zstd_blob.cc',
'src/zstd_blob.h',
'src/path.cc',
'src/permission/fs_permission.cc',
'src/permission/permission.cc',
Expand Down Expand Up @@ -659,6 +661,23 @@
'WARNING_CFLAGS': [ '-Werror' ],
},
}],
# The Release executable's local symbol table and STABS dominate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems unrelated to ICU.

# LINKEDIT. -x drops local symbols and -S drops STABS. Debug keeps
# them. Do not pass -dead_strip: N-API and libuv symbols are reached
# only from addons loaded at runtime, and dead-stripping removes
# those exports from the executable.
['OS=="mac" or OS=="ios"', {
'configurations': {
'Release': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-x',
'-Wl,-S',
],
},
},
},
}],
['node_shared=="true" and OS=="win"', {
'dependencies': ['generate_node_def'],
'msvs_settings': {
Expand Down Expand Up @@ -901,6 +920,9 @@
'msvs_disabled_warnings!': [4244],

'conditions': [
[ 'icu_compress_data=="true"', {
'defines': [ 'NODE_HAVE_EMBEDDED_ICU_ZSTD=1' ],
}],
[ 'openssl_default_cipher_list!=""', {
'defines': [
'NODE_OPENSSL_DEFAULT_CIPHER_LIST="<(openssl_default_cipher_list)"'
Expand Down Expand Up @@ -1671,6 +1693,9 @@
[ 'node_shared_libuv=="false"', {
'dependencies': [ 'deps/uv/uv.gyp:libuv#host' ],
}],
[ 'node_shared_zstd=="false"', {
'dependencies': [ 'deps/zstd/zstd.gyp:zstd#host' ],
}],
[ 'OS in "linux mac openharmony"', {
'defines': ['NODE_JS2C_USE_STRING_LITERALS'],
}],
Expand Down
Loading
Loading