Skip to content

Commit c2fd822

Browse files
aduh95targos
andcommitted
build: add flag to compile V8 with Temporal support
Refs: #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: #60701 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 014852a commit c2fd822

File tree

5 files changed

+63
-2
lines changed

5 files changed

+63
-2
lines changed

configure.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,28 @@
573573
dest='shared_sqlite_libpath',
574574
help='a directory to search for the shared sqlite DLL')
575575

576+
shared_optgroup.add_argument('--shared-temporal_capi',
577+
action='store_true',
578+
dest='shared_temporal_capi',
579+
default=None,
580+
help='link to a shared temporal_capi DLL instead of static linking')
581+
582+
shared_optgroup.add_argument('--shared-temporal_capi-includes',
583+
action='store',
584+
dest='shared_temporal_capi_includes',
585+
help='directory containing temporal_capi header files')
586+
587+
shared_optgroup.add_argument('--shared-temporal_capi-libname',
588+
action='store',
589+
dest='shared_temporal_capi_libname',
590+
default='temporal_capi',
591+
help='alternative lib name to link to [default: %(default)s]')
592+
593+
shared_optgroup.add_argument('--shared-temporal_capi-libpath',
594+
action='store',
595+
dest='shared_temporal_capi_libpath',
596+
help='a directory to search for the shared temporal_capi DLL')
597+
576598
shared_optgroup.add_argument('--shared-zstd',
577599
action='store_true',
578600
dest='shared_zstd',
@@ -1009,6 +1031,13 @@
10091031
default=None,
10101032
help='Enable the built-in snapshot compression in V8.')
10111033

1034+
1035+
parser.add_argument('--v8-enable-temporal-support',
1036+
action='store_true',
1037+
dest='v8_enable_temporal_support',
1038+
default=None,
1039+
help='Enable Temporal support in V8.')
1040+
10121041
parser.add_argument('--node-builtin-modules-path',
10131042
action='store',
10141043
dest='node_builtin_modules_path',
@@ -1802,6 +1831,7 @@ def configure_v8(o, configs):
18021831
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
18031832
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
18041833
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
1834+
o['variables']['v8_enable_temporal_support'] = 1 if options.v8_enable_temporal_support else 0
18051835
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
18061836
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
18071837
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
@@ -2357,6 +2387,7 @@ def make_bin_override():
23572387
configure_library('nghttp3', output, pkgname='libnghttp3')
23582388
configure_library('ngtcp2', output, pkgname='libngtcp2')
23592389
configure_sqlite(output);
2390+
configure_library('temporal_capi', output)
23602391
configure_library('uvwasi', output)
23612392
configure_library('zstd', output, pkgname='libzstd')
23622393
configure_v8(output, configurations)

shell.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
22
pkgs ? import ./tools/nix/pkgs.nix { },
33
loadJSBuiltinsDynamically ? true, # Load `lib/**.js` from disk instead of embedding
4+
withTemporal ? false,
45
ncu-path ? null, # Provide this if you want to use a local version of NCU
56
icu ? pkgs.icu,
6-
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs; },
7+
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix { inherit pkgs withTemporal; },
78
ccache ? pkgs.ccache,
89
ninja ? pkgs.ninja,
910
devTools ? import ./tools/nix/devTools.nix { inherit pkgs ncu-path; },
1011
benchmarkTools ? import ./tools/nix/benchmarkTools.nix { inherit pkgs; },
1112
extraConfigFlags ? [
1213
"--without-npm"
1314
"--debug-node"
15+
]
16+
++ pkgs.lib.optionals withTemporal [
17+
"--v8-enable-temporal-support"
1418
],
1519
}:
1620

@@ -22,7 +26,7 @@ in
2226
pkgs.mkShell {
2327
inherit (pkgs.nodejs_latest) nativeBuildInputs;
2428

25-
buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optionals useSharedICU [ icu ];
29+
buildInputs = builtins.attrValues sharedLibDeps ++ pkgs.lib.optional useSharedICU icu;
2630

2731
packages = [
2832
ccache

tools/nix/sharedLibDeps.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
pkgs ? import ./pkgs.nix { },
3+
withTemporal ? false,
34
}:
45
{
56
inherit (pkgs)
@@ -36,3 +37,6 @@
3637
];
3738
});
3839
}
40+
// (pkgs.lib.optionalAttrs withTemporal {
41+
inherit (pkgs) temporal_capi;
42+
})

tools/v8_gypfiles/features.gypi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@
295295
# add a dependency on the ICU library.
296296
'v8_enable_i18n_support%': 1,
297297

298+
# Enable Temporal API. Enabling this feature will
299+
# add a dependency on the temporal_rs library.
300+
'v8_enable_temporal_support%': 0,
301+
298302
# Lite mode disables a number of performance optimizations to reduce memory
299303
# at the cost of performance.
300304
# Sets --DV8_LITE_MODE.
@@ -410,6 +414,9 @@
410414
['v8_enable_i18n_support==1', {
411415
'defines': ['V8_INTL_SUPPORT',],
412416
}],
417+
['v8_enable_temporal_support==1', {
418+
'defines': ['V8_TEMPORAL_SUPPORT',],
419+
}],
413420
# Refs: https://github.com/nodejs/node/pull/23801
414421
# ['v8_enable_handle_zapping==1', {
415422
# 'defines': ['ENABLE_HANDLE_ZAPPING',],

tools/v8_gypfiles/v8.gyp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_i18n_support.*?torque_files \\+= ")',
2828
],
2929
}],
30+
['v8_enable_temporal_support==1', {
31+
'torque_files': [
32+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_temporal_support.*?torque_files \\+= ")',
33+
],
34+
}],
3035
['v8_enable_webassembly==1', {
3136
'torque_files': [
3237
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "torque_files =.*?v8_enable_webassembly.*?torque_files \\+= ")',
@@ -660,6 +665,11 @@
660665
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_snapshot_compression.*?sources \\+= ")',
661666
],
662667
}],
668+
['v8_enable_temporal_support==1', {
669+
'sources': [
670+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_temporal_support.*?sources \\+= ")',
671+
],
672+
}],
663673
['v8_enable_sparkplug==1', {
664674
'sources': [
665675
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_sparkplug.*?sources \\+= ")',
@@ -1117,6 +1127,11 @@
11171127
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_snapshot_compression.*?sources \\+= ")',
11181128
],
11191129
}],
1130+
['v8_enable_temporal_support==1', {
1131+
'sources': [
1132+
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_temporal_support.*?sources \\+= ")',
1133+
],
1134+
}],
11201135
['v8_enable_sparkplug==1', {
11211136
'sources': [
11221137
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_sparkplug.*?sources \\+= ")',

0 commit comments

Comments
 (0)