Skip to content

Commit bff81fc

Browse files
richardlauRafaelGSS
authored andcommitted
build: enable Temporal by default
Enabling Temporal support requires `cargo` and `rustc`, which are new build toolchain requirements. Add a `--v8-disable-temporal-support` option to `configure.py` to explicitly opt-out of Temporal support (i.e. no need for Rust). If the existing `--v8-enable-temporal-support` option is not explicitly passed to `configure.py`: - Attempt to detect `cargo` and `rustc`. - If neither `cargo` and `rustc` are detected, print a warning and disable Temporal support. - If both `cargo` and `rustc` are detected, enable Temporal support. If `--v8-enable-temporal-support` is passed to `configure.py`, then the build will error and stop if `cargo` and/or `rustc` are not detected. To avoid ambiguity, `configure.py` will error and stop if both `--v8-disable-temporal-support` and `--v8-enable-temporal-support` are used. Signed-off-by: Richard Lau <richard.lau@ibm.com> PR-URL: #61806Fixes: #57127 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> (cherry picked from commit fc4b334)
1 parent f9bd016 commit bff81fc

1 file changed

Lines changed: 61 additions & 20 deletions

File tree

‎configure.py‎

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,11 @@
11561156
default=None,
11571157
help='Enable the built-in snapshot compression in V8.')
11581158

1159+
parser.add_argument('--v8-disable-temporal-support',
1160+
action='store_true',
1161+
dest='v8_disable_temporal_support',
1162+
default=None,
1163+
help='Disable Temporal support in V8.')
11591164

11601165
parser.add_argument('--v8-enable-temporal-support',
11611166
action='store_true',
@@ -1450,11 +1455,7 @@ def get_cargo_version(cargo):
14501455
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
14511456
stdout=subprocess.PIPE)
14521457
exceptOSError:
1453-
error('''No acceptable cargo found!
1454-
1455-
Please make sure you have cargo installed on your system and/or
1456-
consider adjusting the CARGO environment variable if you have installed
1457-
it in a non-standard prefix.''')
1458+
return'0.0'
14581459

14591460
withproc:
14601461
cargo_ret=to_utf8(proc.communicate()[0])
@@ -1473,11 +1474,7 @@ def get_rustc_version(rustc):
14731474
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
14741475
stdout=subprocess.PIPE)
14751476
exceptOSError:
1476-
error('''No acceptable rustc compiler found!
1477-
1478-
Please make sure you have a rust compiler installed on your system and/or
1479-
consider adjusting the RUSTC environment variable if you have installed
1480-
it in a non-standard prefix.''')
1477+
return'0.0'
14811478

14821479
withproc:
14831480
rustc_ret=to_utf8(proc.communicate()[0])
@@ -1538,23 +1535,51 @@ def check_compiler(o):
15381535
o['variables']['llvm_version'] =get_llvm_version(CC) ifis_clangelse'0.0'
15391536

15401537
# cargo and rustc are needed for Temporal.
1541-
ifoptions.v8_enable_temporal_supportandnotoptions.shared_temporal_capi:
1538+
ifnotoptions.v8_disable_temporal_supportornotoptions.shared_temporal_capi:
15421539
# Minimum cargo and rustc versions should match values in BUILDING.md.
15431540
min_cargo_ver_tuple= (1, 82)
15441541
min_rustc_ver_tuple= (1, 82)
15451542
cargo=os.environ.get('CARGO', 'cargo')
15461543
cargo_ver=get_cargo_version(cargo)
15471544
print_verbose(f'Detected cargo (CARGO={cargo}): {cargo_ver}')
1548-
cargo_ver_tuple=tuple(map(int, cargo_ver.split('.')))
1549-
ifcargo_ver_tuple<min_cargo_ver_tuple:
1550-
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
1545+
ifcargo_ver=='0.0':
1546+
# Error if --v8-enable-temporal-support is explicitly set,
1547+
# otherwise disable support for Temporal.
1548+
ifoptions.v8_enable_temporal_support:
1549+
error('''No acceptable cargo found!
1550+
1551+
Enabling Temporal support requires cargo.
1552+
Please make sure you have cargo installed on your system and/or
1553+
consider adjusting the CARGO environment variable if you have installed
1554+
it in a non-standard prefix.''')
1555+
else:
1556+
warn('cargo not found! Support for Temporal will be disabled.')
1557+
options.v8_disable_temporal_support=True
1558+
else:
1559+
cargo_ver_tuple=tuple(map(int, cargo_ver.split('.')))
1560+
ifcargo_ver_tuple<min_cargo_ver_tuple:
1561+
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
15511562
# cargo supports RUSTC environment variable to override "rustc".
15521563
rustc=os.environ.get('RUSTC', 'rustc')
15531564
rustc_ver=get_rustc_version(rustc)
1554-
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
1555-
rust_ver_tuple=tuple(map(int, rustc_ver.split('.')))
1556-
ifrust_ver_tuple<min_rustc_ver_tuple:
1557-
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')
1565+
ifrustc_ver=='0.0':
1566+
# Error if --v8-enable-temporal-support is explicitly set,
1567+
# otherwise disable support for Temporal.
1568+
ifoptions.v8_enable_temporal_support:
1569+
error('''No acceptable rustc compiler found!
1570+
1571+
Enabling Temporal support requires a Rust toolchain.
1572+
Please make sure you have a Rust compiler installed on your system and/or
1573+
consider adjusting the RUSTC environment variable if you have installed
1574+
it in a non-standard prefix.''')
1575+
else:
1576+
warn(f'{rustc} not found! Support for Temporal will be disabled.')
1577+
options.v8_disable_temporal_support=True
1578+
else:
1579+
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
1580+
rust_ver_tuple=tuple(map(int, rustc_ver.split('.')))
1581+
ifrust_ver_tuple<min_rustc_ver_tuple:
1582+
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')
15581583

15591584
# Need xcode_version or gas_version when openssl asm files are compiled.
15601585
ifoptions.without_ssloroptions.openssl_no_asmoroptions.shared_openssl:
@@ -2065,7 +2090,19 @@ def configure_v8(o, configs):
20652090
o['variables']['v8_enable_external_code_space'] =1ifoptions.enable_pointer_compressionelse0
20662091
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] =1ifoptions.enable_pointer_compressionelse0
20672092
o['variables']['v8_enable_extensible_ro_snapshot'] =0
2068-
o['variables']['v8_enable_temporal_support'] =1ifoptions.v8_enable_temporal_supportelse0
2093+
# TODO(richardlau): Temporal objects in V8 currently reference a private
2094+
# ICU header file and fail to compile with shared ICU or no ICU. For now,
2095+
# if auto-detecting, warn and disable Temporal in those cases.
2096+
# Refs: https://github.com/nodejs/node/issues/62676
2097+
if (notoptions.v8_disable_temporal_supportandnotoptions.v8_enable_temporal_support):
2098+
matchoptions.with_intl:
2099+
case'none':
2100+
warn('Temporal support disabled when compiling without ICU')
2101+
options.v8_disable_temporal_support=True
2102+
case'system-icu':
2103+
warn('Temporal support disabled when compiling with a shared ICU library')
2104+
options.v8_disable_temporal_support=True
2105+
o['variables']['v8_enable_temporal_support'] =0ifoptions.v8_disable_temporal_supportelse1
20692106
o['variables']['v8_trace_maps'] =1ifoptions.trace_mapselse0
20702107
o['variables']['node_use_v8_platform'] =b(notoptions.without_v8_platform)
20712108
o['variables']['node_use_bundled_v8'] =b(notoptions.without_bundled_v8)
@@ -2097,6 +2134,10 @@ def configure_v8(o, configs):
20972134
raiseException(
20982135
'Only one of the --v8-enable-object-print or --v8-disable-object-print options '
20992136
'can be specified at a time.')
2137+
ifall(optinsys.argvforoptin ['--v8-enable-temporal-support', '--v8-disable-temporal-support']):
2138+
raiseException(
2139+
'Only one of the --v8-enable-temporal-support or --v8-disable-temporal-support options '
2140+
'can be specified at a time.')
21002141
ifsys.platform!='darwin':
21012142
ifo['variables']['v8_enable_webassembly'] ando['variables']['target_arch'] =='x64':
21022143
o['variables']['v8_enable_wasm_simd256_revec'] =1
@@ -2762,7 +2803,7 @@ def make_bin_override():
27622803
# will fail to run python scripts.
27632804
gyp_args+= ['-Dpython='+python]
27642805

2765-
ifoptions.v8_enable_temporal_supportandnotoptions.shared_temporal_capi:
2806+
ifnotoptions.v8_disable_temporal_supportornotoptions.shared_temporal_capi:
27662807
cargo=os.environ.get('CARGO')
27672808
ifcargo:
27682809
gyp_args+= ['-Dcargo='+cargo]

0 commit comments

Comments
 (0)