build: add flag to compile V8 with Temporal support

Refs: https://github.com/nodejs/node/issues/58730
Co-authored-by: =?UTF-8?q?Micha=C3=ABl=20Zasso?= <targos@protonmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60701
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Antoine du Hamel
2025-11-20 00:57:41 +02:00
committed by GitHub
parent 934d90735a
commit eb6cb5b827
5 changed files with 63 additions and 2 deletions

View File

@@ -573,6 +573,28 @@ shared_optgroup.add_argument('--shared-sqlite-libpath',
dest='shared_sqlite_libpath',
help='a directory to search for the shared sqlite DLL')
shared_optgroup.add_argument('--shared-temporal_capi',
action='store_true',
dest='shared_temporal_capi',
default=None,
help='link to a shared temporal_capi DLL instead of static linking')
shared_optgroup.add_argument('--shared-temporal_capi-includes',
action='store',
dest='shared_temporal_capi_includes',
help='directory containing temporal_capi header files')
shared_optgroup.add_argument('--shared-temporal_capi-libname',
action='store',
dest='shared_temporal_capi_libname',
default='temporal_capi',
help='alternative lib name to link to [default: %(default)s]')
shared_optgroup.add_argument('--shared-temporal_capi-libpath',
action='store',
dest='shared_temporal_capi_libpath',
help='a directory to search for the shared temporal_capi DLL')
shared_optgroup.add_argument('--shared-zstd',
action='store_true',
dest='shared_zstd',
@@ -1009,6 +1031,13 @@ parser.add_argument('--v8-enable-snapshot-compression',
default=None,
help='Enable the built-in snapshot compression in V8.')
parser.add_argument('--v8-enable-temporal-support',
action='store_true',
dest='v8_enable_temporal_support',
default=None,
help='Enable Temporal support in V8.')
parser.add_argument('--node-builtin-modules-path',
action='store',
dest='node_builtin_modules_path',
@@ -1802,6 +1831,7 @@ def configure_v8(o, configs):
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
o['variables']['v8_enable_temporal_support'] = 1 if options.v8_enable_temporal_support else 0
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
@@ -2357,6 +2387,7 @@ configure_library('nghttp2', output, pkgname='libnghttp2')
configure_library('nghttp3', output, pkgname='libnghttp3')
configure_library('ngtcp2', output, pkgname='libngtcp2')
configure_sqlite(output);
configure_library('temporal_capi', output)
configure_library('uvwasi', output)
configure_library('zstd', output, pkgname='libzstd')
configure_v8(output, configurations)

View File

@@ -1,9 +1,10 @@
{
pkgs ? import ./tools/nix/pkgs.nix { },
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
withTemporal ? false,
ncu-path ? null, # Provide this if you want to use a local version of NCU
icu ? pkgs.icu,
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs; },
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs withTemporal; },
ccache ? pkgs.ccache,
ninja ? pkgs.ninja,
devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path; },
@@ -11,6 +12,9 @@
extraConfigFlags ? [
"--without-npm"
"--debug-node"
]
++ pkgs.lib.optionals withTemporal [
"--v8-enable-temporal-support"
],
}:
@@ -22,7 +26,7 @@ in
pkgs.mkShell {
inherit (pkgs.nodejs_latest) nativeBuildInputs;
buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optionals useSharedICU [ icu ];
buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optional useSharedICU icu;
packages = [
ccache

View File

@@ -1,5 +1,6 @@
{
pkgs ? import ./pkgs.nix { },
withTemporal ? false,
}:
{
inherit (pkgs)
@@ -45,3 +46,6 @@
];
});
}
// (pkgs.lib.optionalAttrs withTemporal {
inherit (pkgs) temporal_capi;
})

View File

@@ -295,6 +295,10 @@
# add a dependency on the ICU library.
'v8_enable_i18n_support%': 1,
# Enable Temporal API. Enabling this feature will
# add a dependency on the temporal_rs library.
'v8_enable_temporal_support%': 0,
# Lite mode disables a number of performance optimizations to reduce memory
# at the cost of performance.
# Sets --DV8_LITE_MODE.
@@ -410,6 +414,9 @@
['v8_enable_i18n_support==1', {
'defines': ['V8_INTL_SUPPORT',],
}],
['v8_enable_temporal_support==1', {
'defines': ['V8_TEMPORAL_SUPPORT',],
}],
# Refs: https://github.com/nodejs/node/pull/23801
# ['v8_enable_handle_zapping==1', {
# 'defines': ['ENABLE_HANDLE_ZAPPING',],

View File

@@ -27,6 +27,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_i18n_support.*?torque_files \\+= ")',
],
}],
['v8_enable_temporal_support==1', {
'torque_files': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_temporal_support.*?torque_files \\+= ")',
],
}],
['v8_enable_webassembly==1', {
'torque_files': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_webassembly.*?torque_files \\+= ")',
@@ -660,6 +665,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_snapshot_compression.*?sources \\+= ")',
],
}],
['v8_enable_temporal_support==1', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_temporal_support.*?sources \\+= ")',
],
}],
['v8_enable_sparkplug==1', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_sparkplug.*?sources \\+= ")',
@@ -1117,6 +1127,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_snapshot_compression.*?sources \\+= ")',
],
}],
['v8_enable_temporal_support==1', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_temporal_support.*?sources \\+= ")',
],
}],
['v8_enable_sparkplug==1', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_sparkplug.*?sources \\+= ")',