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
11601165parser .add_argument ('--v8-enable-temporal-support' ,
11611166 action = 'store_true' ,
@@ -1450,9 +1455,7 @@ def get_cargo_version(cargo):
14501455 stdin = subprocess .PIPE , stderr = subprocess .PIPE ,
14511456 stdout = subprocess .PIPE )
14521457 except OSError :
1453- error ('''No acceptable cargo found!
1454-
1455- Please make sure you have cargo installed on your system.''' )
1458+ return '0.0'
14561459
14571460 with proc :
14581461 cargo_ret = to_utf8 (proc .communicate ()[0 ])
@@ -1471,11 +1474,7 @@ def get_rustc_version(rustc):
14711474 stdin = subprocess .PIPE , stderr = subprocess .PIPE ,
14721475 stdout = subprocess .PIPE )
14731476 except OSError :
1474- error ('''No acceptable rustc compiler found!
1475-
1476- Please make sure you have a rust compiler installed on your system and/or
1477- consider adjusting the RUSTC environment variable if you have installed
1478- it in a non-standard prefix.''' )
1477+ return '0.0'
14791478
14801479 with proc :
14811480 rustc_ret = to_utf8 (proc .communicate ()[0 ])
@@ -1536,22 +1535,48 @@ def check_compiler(o):
15361535 o ['variables' ]['llvm_version' ] = get_llvm_version (CC ) if is_clang else '0.0'
15371536
15381537 # cargo and rustc are needed for Temporal.
1539- if options .v8_enable_temporal_support and not options .shared_temporal_capi :
1538+ if not options .v8_disable_temporal_support or not options .shared_temporal_capi :
15401539 # Minimum cargo and rustc versions should match values in BUILDING.md.
15411540 min_cargo_ver_tuple = (1 , 82 )
15421541 min_rustc_ver_tuple = (1 , 82 )
15431542 cargo_ver = get_cargo_version ('cargo' )
15441543 print_verbose (f'Detected cargo: { cargo_ver } ' )
1545- cargo_ver_tuple = tuple (map (int , cargo_ver .split ('.' )))
1546- if cargo_ver_tuple < min_cargo_ver_tuple :
1547- warn (f'cargo { cargo_ver } too old, need cargo { "." .join (map (str , min_cargo_ver_tuple ))} ' )
1544+ if cargo_ver == '0.0' :
1545+ # Error if --v8-enable-temporal-support is explicitly set,
1546+ # otherwise disable support for Temporal.
1547+ if options .v8_enable_temporal_support :
1548+ error ('''No acceptable cargo found!
1549+
1550+ Enabling Temporal support requires cargo.
1551+ Please make sure you have cargo installed on your system.''' )
1552+ else :
1553+ warn ('cargo not found! Support for Temporal will be disabled.' )
1554+ options .v8_disable_temporal_support = True
1555+ else :
1556+ cargo_ver_tuple = tuple (map (int , cargo_ver .split ('.' )))
1557+ if cargo_ver_tuple < min_cargo_ver_tuple :
1558+ warn (f'cargo { cargo_ver } too old, need cargo { "." .join (map (str , min_cargo_ver_tuple ))} ' )
15481559 # cargo supports RUSTC environment variable to override "rustc".
15491560 rustc = os .environ .get ('RUSTC' , 'rustc' )
15501561 rustc_ver = get_rustc_version (rustc )
1551- print_verbose (f'Detected rustc (RUSTC={ rustc } ): { rustc_ver } ' )
1552- rust_ver_tuple = tuple (map (int , rustc_ver .split ('.' )))
1553- if rust_ver_tuple < min_rustc_ver_tuple :
1554- warn (f'rustc { rustc_ver } too old, need rustc { "." .join (map (str , min_rustc_ver_tuple ))} ' )
1562+ if rustc_ver == '0.0' :
1563+ # Error if --v8-enable-temporal-support is explicitly set,
1564+ # otherwise disable support for Temporal.
1565+ if options .v8_enable_temporal_support :
1566+ error ('''No acceptable rustc compiler found!
1567+
1568+ Enabling Temporal support requires a Rust toolchain.
1569+ Please make sure you have a Rust compiler installed on your system and/or
1570+ consider adjusting the RUSTC environment variable if you have installed
1571+ it in a non-standard prefix.''' )
1572+ else :
1573+ warn (f'{ rustc } not found! Support for Temporal will be disabled.' )
1574+ options .v8_disable_temporal_support = True
1575+ else :
1576+ print_verbose (f'Detected rustc (RUSTC={ rustc } ): { rustc_ver } ' )
1577+ rust_ver_tuple = tuple (map (int , rustc_ver .split ('.' )))
1578+ if rust_ver_tuple < min_rustc_ver_tuple :
1579+ warn (f'rustc { rustc_ver } too old, need rustc { "." .join (map (str , min_rustc_ver_tuple ))} ' )
15551580
15561581 # Need xcode_version or gas_version when openssl asm files are compiled.
15571582 if options .without_ssl or options .openssl_no_asm or options .shared_openssl :
@@ -2055,7 +2080,7 @@ def configure_v8(o, configs):
20552080 o ['variables' ]['v8_enable_external_code_space' ] = 1 if options .enable_pointer_compression else 0
20562081 o ['variables' ]['v8_enable_31bit_smis_on_64bit_arch' ] = 1 if options .enable_pointer_compression else 0
20572082 o ['variables' ]['v8_enable_extensible_ro_snapshot' ] = 0
2058- o ['variables' ]['v8_enable_temporal_support' ] = 1 if options .v8_enable_temporal_support else 0
2083+ o ['variables' ]['v8_enable_temporal_support' ] = 0 if options .v8_disable_temporal_support else 1
20592084 o ['variables' ]['v8_trace_maps' ] = 1 if options .trace_maps else 0
20602085 o ['variables' ]['node_use_v8_platform' ] = b (not options .without_v8_platform )
20612086 o ['variables' ]['node_use_bundled_v8' ] = b (not options .without_bundled_v8 )
@@ -2081,6 +2106,10 @@ def configure_v8(o, configs):
20812106 raise Exception (
20822107 'Only one of the --v8-enable-object-print or --v8-disable-object-print options '
20832108 'can be specified at a time.' )
2109+ if all (opt in sys .argv for opt in ['--v8-enable-temporal-support' , '--v8-disable-temporal-support' ]):
2110+ raise Exception (
2111+ 'Only one of the --v8-enable-temporal-support or --v8-disable-temporal-support options '
2112+ 'can be specified at a time.' )
20842113 if sys .platform != 'darwin' :
20852114 if o ['variables' ]['v8_enable_webassembly' ] and o ['variables' ]['target_arch' ] == 'x64' :
20862115 o ['variables' ]['v8_enable_wasm_simd256_revec' ] = 1
0 commit comments