|
1156 | 1156 | default=None, |
1157 | 1157 | help='Enable the built-in snapshot compression in V8.') |
1158 | 1158 |
|
| 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.') |
1159 | 1164 |
|
1160 | 1165 | parser.add_argument('--v8-enable-temporal-support', |
1161 | 1166 | action='store_true', |
@@ -1450,11 +1455,7 @@ def get_cargo_version(cargo): |
1450 | 1455 | stdin=subprocess.PIPE, stderr=subprocess.PIPE, |
1451 | 1456 | stdout=subprocess.PIPE) |
1452 | 1457 | except OSError: |
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' |
1458 | 1459 |
|
1459 | 1460 | with proc: |
1460 | 1461 | cargo_ret = to_utf8(proc.communicate()[0]) |
@@ -1473,11 +1474,7 @@ def get_rustc_version(rustc): |
1473 | 1474 | stdin=subprocess.PIPE, stderr=subprocess.PIPE, |
1474 | 1475 | stdout=subprocess.PIPE) |
1475 | 1476 | except OSError: |
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' |
1481 | 1478 |
|
1482 | 1479 | with proc: |
1483 | 1480 | rustc_ret = to_utf8(proc.communicate()[0]) |
@@ -1538,23 +1535,51 @@ def check_compiler(o): |
1538 | 1535 | o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0' |
1539 | 1536 |
|
1540 | 1537 | # cargo and rustc are needed for Temporal. |
1541 | | - 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: |
1542 | 1539 | # Minimum cargo and rustc versions should match values in BUILDING.md. |
1543 | 1540 | min_cargo_ver_tuple = (1, 82) |
1544 | 1541 | min_rustc_ver_tuple = (1, 82) |
1545 | 1542 | cargo = os.environ.get('CARGO', 'cargo') |
1546 | 1543 | cargo_ver = get_cargo_version(cargo) |
1547 | 1544 | print_verbose(f'Detected cargo (CARGO={cargo}): {cargo_ver}') |
1548 | | - cargo_ver_tuple = tuple(map(int, cargo_ver.split('.'))) |
1549 | | - if cargo_ver_tuple < min_cargo_ver_tuple: |
1550 | | - warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}') |
| 1545 | + if cargo_ver == '0.0': |
| 1546 | + # Error if --v8-enable-temporal-support is explicitly set, |
| 1547 | + # otherwise disable support for Temporal. |
| 1548 | + if options.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 | + if cargo_ver_tuple < min_cargo_ver_tuple: |
| 1561 | + warn(f'cargo {cargo_ver} too old, need cargo {".".join(map(str, min_cargo_ver_tuple))}') |
1551 | 1562 | # cargo supports RUSTC environment variable to override "rustc". |
1552 | 1563 | rustc = os.environ.get('RUSTC', 'rustc') |
1553 | 1564 | 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 | | - if rust_ver_tuple < min_rustc_ver_tuple: |
1557 | | - warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}') |
| 1565 | + if rustc_ver == '0.0': |
| 1566 | + # Error if --v8-enable-temporal-support is explicitly set, |
| 1567 | + # otherwise disable support for Temporal. |
| 1568 | + if options.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 | + if rust_ver_tuple < min_rustc_ver_tuple: |
| 1582 | + warn(f'rustc {rustc_ver} too old, need rustc {".".join(map(str, min_rustc_ver_tuple))}') |
1558 | 1583 |
|
1559 | 1584 | # Need xcode_version or gas_version when openssl asm files are compiled. |
1560 | 1585 | if options.without_ssl or options.openssl_no_asm or options.shared_openssl: |
@@ -2065,7 +2090,19 @@ def configure_v8(o, configs): |
2065 | 2090 | o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0 |
2066 | 2091 | o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 |
2067 | 2092 | o['variables']['v8_enable_extensible_ro_snapshot'] = 0 |
2068 | | - o['variables']['v8_enable_temporal_support'] = 1 if options.v8_enable_temporal_support else 0 |
| 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 (not options.v8_disable_temporal_support and not options.v8_enable_temporal_support): |
| 2098 | + match options.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'] = 0 if options.v8_disable_temporal_support else 1 |
2069 | 2106 | o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 |
2070 | 2107 | o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) |
2071 | 2108 | o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) |
@@ -2097,6 +2134,10 @@ def configure_v8(o, configs): |
2097 | 2134 | raise Exception( |
2098 | 2135 | 'Only one of the --v8-enable-object-print or --v8-disable-object-print options ' |
2099 | 2136 | 'can be specified at a time.') |
| 2137 | + if all(opt in sys.argv for opt in ['--v8-enable-temporal-support', '--v8-disable-temporal-support']): |
| 2138 | + raise Exception( |
| 2139 | + 'Only one of the --v8-enable-temporal-support or --v8-disable-temporal-support options ' |
| 2140 | + 'can be specified at a time.') |
2100 | 2141 | if sys.platform != 'darwin': |
2101 | 2142 | if o['variables']['v8_enable_webassembly'] and o['variables']['target_arch'] == 'x64': |
2102 | 2143 | o['variables']['v8_enable_wasm_simd256_revec'] = 1 |
@@ -2762,7 +2803,7 @@ def make_bin_override(): |
2762 | 2803 | # will fail to run python scripts. |
2763 | 2804 | gyp_args += ['-Dpython=' + python] |
2764 | 2805 |
|
2765 | | -if options.v8_enable_temporal_support and not options.shared_temporal_capi: |
| 2806 | +if not options.v8_disable_temporal_support or not options.shared_temporal_capi: |
2766 | 2807 | cargo = os.environ.get('CARGO') |
2767 | 2808 | if cargo: |
2768 | 2809 | gyp_args += ['-Dcargo=' + cargo] |
|