Skip to content
Open
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
63 changes: 46 additions & 17 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,11 @@
default=None,
help='Enable the built-in snapshot compression in V8.')

parser.add_argument('--v8-disable-temporal-support',
action='store_true',
dest='v8_disable_temporal_support',
default=None,
help='Disable Temporal support in V8.')

parser.add_argument('--v8-enable-temporal-support',
action='store_true',
Expand Down Expand Up @@ -1450,9 +1455,7 @@ def get_cargo_version(cargo):
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
except OSError:
error('''No acceptable cargo found!
Please make sure you have cargo installed on your system.''')
return '0.0'

with proc:
cargo_ret = to_utf8(proc.communicate()[0])
Expand All @@ -1471,11 +1474,7 @@ def get_rustc_version(rustc):
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
except OSError:
error('''No acceptable rustc compiler found!
Please make sure you have a rust compiler installed on your system and/or
consider adjusting the RUSTC environment variable if you have installed
it in a non-standard prefix.''')
return '0.0'

with proc:
rustc_ret = to_utf8(proc.communicate()[0])
Expand Down Expand Up @@ -1536,22 +1535,48 @@ def check_compiler(o):
o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0'

# cargo and rustc are needed for Temporal.
if options.v8_enable_temporal_support and not options.shared_temporal_capi:
if not options.v8_disable_temporal_support or not options.shared_temporal_capi:
# Minimum cargo and rustc versions should match values in BUILDING.md.
min_cargo_ver_tuple = (1, 82)
min_rustc_ver_tuple = (1, 82)
cargo_ver = get_cargo_version('cargo')
print_verbose(f'Detected cargo: {cargo_ver}')
cargo_ver_tuple = tuple(map(int, cargo_ver.split('.')))
if cargo_ver_tuple < min_cargo_ver_tuple:
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
if cargo_ver == '0.0':
# Error if --v8-enable-temporal-support is explicitly set,
# otherwise disable support for Temporal.
if options.v8_enable_temporal_support:
error('''No acceptable cargo found!
Enabling Temporal support requires cargo.
Please make sure you have cargo installed on your system.''')
else:
warn('cargo not found! Support for Temporal will be disabled.')
options.v8_disable_temporal_support = True
else:
cargo_ver_tuple = tuple(map(int, cargo_ver.split('.')))
if cargo_ver_tuple < min_cargo_ver_tuple:
warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}')
# cargo supports RUSTC environment variable to override "rustc".
rustc = os.environ.get('RUSTC', 'rustc')
rustc_ver = get_rustc_version(rustc)
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
rust_ver_tuple = tuple(map(int, rustc_ver.split('.')))
if rust_ver_tuple < min_rustc_ver_tuple:
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')
if rustc_ver == '0.0':
# Error if --v8-enable-temporal-support is explicitly set,
# otherwise disable support for Temporal.
if options.v8_enable_temporal_support:
error('''No acceptable rustc compiler found!
Enabling Temporal support requires a Rust toolchain.
Please make sure you have a Rust compiler installed on your system and/or
consider adjusting the RUSTC environment variable if you have installed
it in a non-standard prefix.''')
else:
warn(f'{rustc} not found! Support for Temporal will be disabled.')
options.v8_disable_temporal_support = True
else:
print_verbose(f'Detected rustc (RUSTC={rustc}): {rustc_ver}')
rust_ver_tuple = tuple(map(int, rustc_ver.split('.')))
if rust_ver_tuple < min_rustc_ver_tuple:
warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}')

# Need xcode_version or gas_version when openssl asm files are compiled.
if options.without_ssl or options.openssl_no_asm or options.shared_openssl:
Expand Down Expand Up @@ -2055,7 +2080,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_enable_temporal_support'] = 0 if options.v8_disable_temporal_support else 1
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)
Expand All @@ -2081,6 +2106,10 @@ def configure_v8(o, configs):
raise Exception(
'Only one of the --v8-enable-object-print or --v8-disable-object-print options '
'can be specified at a time.')
if all(opt in sys.argv for opt in ['--v8-enable-temporal-support', '--v8-disable-temporal-support']):
raise Exception(
'Only one of the --v8-enable-temporal-support or --v8-disable-temporal-support options '
'can be specified at a time.')
if sys.platform != 'darwin':
if o['variables']['v8_enable_webassembly'] and o['variables']['target_arch'] == 'x64':
o['variables']['v8_enable_wasm_simd256_revec'] = 1
Expand Down
Loading