Files
op-packages/node/patches/v26.x/999-v8-temporal-baked-zoneinfo64.patch
T

115 lines
3.6 KiB
Diff

From: Martijn van der Ven <martijn@vanderven.se>
Date: Thu Aug 20 09:37:04 2026 +0000
Subject: Enable Temporal with system ICU via baked zoneinfo64 data
V8 loads Temporal's timezone data through the ICU-internal udatamem.h
API, which system ICU does not provide, so configuring with
--with-intl=system-icu leaves Temporal disabled. Always use the baked
zoneinfo64 data path that V8 already uses for builds without intl
instead; the zoneinfo64.res input is vendored in the release tarball
as part of the zoneinfo64 crate.
Patch-Source: https://github.com/nodejs/node/pull/62766
--- a/deps/v8/src/objects/js-temporal-zoneinfo64.h
+++ b/deps/v8/src/objects/js-temporal-zoneinfo64.h
@@ -7,7 +7,7 @@
#include "temporal_rs/Provider.d.hpp"
-#ifdef V8_INTL_SUPPORT
+#if false
#include "unicode/udata.h"
#else
#include <vector>
@@ -37,7 +37,7 @@ class ZoneInfo64Provider {
ZoneInfo64Provider();
~ZoneInfo64Provider();
std::unique_ptr<temporal_rs::Provider> provider;
-#ifdef V8_INTL_SUPPORT
+#if false
UDataMemory* memory;
#endif
};
--- a/deps/v8/src/objects/js-temporal-zoneinfo64.cc
+++ b/deps/v8/src/objects/js-temporal-zoneinfo64.cc
@@ -10,7 +10,7 @@
#include "temporal_rs/Provider.hpp"
#include "temporal_rs/TimeZone.hpp"
-#ifdef V8_INTL_SUPPORT
+#if false
#include "udatamem.h"
#else
// Defined in builtins-temporal-zoneinfo64-data.cc, generated by
@@ -22,7 +22,7 @@ extern "C" size_t zoneinfo64_static_data
namespace v8::internal {
ZoneInfo64Provider::ZoneInfo64Provider() {
-#ifdef V8_INTL_SUPPORT
+#if false
UErrorCode status = U_ZERO_ERROR;
memory = udata_open(0, "res", "zoneinfo64", &status);
if (U_FAILURE(status)) {
@@ -74,7 +74,7 @@ ZoneInfo64Provider::~ZoneInfo64Provider(
// Then clean up memory
// This ideally is a no-op when using static data
-#ifdef V8_INTL_SUPPORT
+#if false
if (memory) {
udata_close(memory);
}
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -1159,6 +1159,9 @@
],
}],
['v8_enable_temporal_support==1', {
+ 'dependencies': [
+ 'make_temporal_zoneinfo_cpp',
+ ],
'conditions': [
['node_shared_temporal_capi=="false"', {
'dependencies': [
@@ -2063,6 +2066,40 @@
],
}, # gen-regexp-special-case
{
+ 'target_name': 'make_temporal_zoneinfo_cpp',
+ 'type': 'none',
+ 'toolsets': ['host', 'target'],
+ 'conditions': [
+ ['v8_enable_temporal_support==1', {
+ 'actions': [
+ {
+ 'action_name': 'make_temporal_zoneinfo_cpp_action',
+ 'inputs': [
+ '<(V8_ROOT)/tools/include-file-as-bytes.py',
+ '<(V8_ROOT)/../crates/vendor/zoneinfo64-v0_3/src/data/zoneinfo64.res',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/src/builtins/builtins-temporal-zoneinfo64-data.cc',
+ ],
+ 'action': [
+ '<(python)',
+ '<(V8_ROOT)/tools/include-file-as-bytes.py',
+ '<(V8_ROOT)/../crates/vendor/zoneinfo64-v0_3/src/data/zoneinfo64.res',
+ '<@(_outputs)',
+ 'zoneinfo64_static_data',
+ ],
+ 'message': 'Generating temporal zoneinfo static data',
+ },
+ ],
+ }],
+ ],
+ 'direct_dependent_settings': {
+ 'sources': [
+ '<(SHARED_INTERMEDIATE_DIR)/src/builtins/builtins-temporal-zoneinfo64-data.cc',
+ ],
+ },
+ }, # make_temporal_zoneinfo_cpp
+ {
'target_name': 'run_gen-regexp-special-case',
'type': 'none',
'toolsets': ['host', 'target'],