summaryrefslogtreecommitdiff
path: root/pkgs/development/web/nodejs/fix-temporal-integration-with-shared-icu.patch
blob: 5a4ed7301f8f14fecbe885eafacf535cd99cc580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From https://chromium-review.googlesource.com/c/v8/v8/+/7769990
From: Tmalone1250 <malonetrevor12@gmail.com>
Date: Wed, 15 Apr 2026 21:07:53 -0500
Subject: [PATCH] build, v8: fix Temporal compilation with system or no ICU

---
 deps/v8/src/objects/js-temporal-zoneinfo64.cc | 11 ++++--
 tools/v8_gypfiles/v8.gyp                      | 37 +++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/deps/v8/src/objects/js-temporal-zoneinfo64.cc b/deps/v8/src/objects/js-temporal-zoneinfo64.cc
index 99dd3a84c1e54f..149138671e0770 100644
--- a/deps/v8/src/objects/js-temporal-zoneinfo64.cc
+++ b/deps/v8/src/objects/js-temporal-zoneinfo64.cc
@@ -10,9 +10,12 @@
 #include "temporal_rs/Provider.hpp"
 #include "temporal_rs/TimeZone.hpp"
 
-#ifdef V8_INTL_SUPPORT
+#if defined(V8_INTL_SUPPORT) && defined(__has_include) && __has_include("udatamem.h")
 #include "udatamem.h"
-#else
+#define V8_TEMPORAL_USE_ICU_RAW_MEMORY
+#endif
+
+#ifndef V8_TEMPORAL_USE_ICU_RAW_MEMORY
 // Defined in builtins-temporal-zoneinfo64-data.cc, generated by
 // include-file-as-bytes.py
 extern "C" uint32_t zoneinfo64_static_data[];
@@ -22,7 +25,7 @@ extern "C" size_t zoneinfo64_static_data_len;
 namespace v8::internal {
 
 ZoneInfo64Provider::ZoneInfo64Provider() {
-#ifdef V8_INTL_SUPPORT
+#ifdef V8_TEMPORAL_USE_ICU_RAW_MEMORY
   UErrorCode status = U_ZERO_ERROR;
   memory = udata_open(0, "res", "zoneinfo64", &status);
   if (U_FAILURE(status)) {
@@ -74,7 +77,7 @@ ZoneInfo64Provider::~ZoneInfo64Provider() {
 
   // Then clean up memory
   // This ideally is a no-op when using static data
-#ifdef V8_INTL_SUPPORT
+#ifdef V8_TEMPORAL_USE_ICU_RAW_MEMORY
   if (memory) {
     udata_close(memory);
   }
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index e09fcc1ce8c59f..2f0fd30771881b 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -1379,6 +1379,9 @@
              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_i18n_support.*?sources -= ")',
            ],
          }],
+        ['v8_enable_temporal_support==1', {
+          'dependencies': ['make_temporal_zoneinfo_cpp'],
+        }],
         ['v8_postmortem_support', {
           'dependencies': ['postmortem-metadata#target'],
         }],
@@ -1955,6 +1958,40 @@
         "<(V8_ROOT)/src/regexp/special-case.h",
       ],
     },  # 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/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/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',
+        ],
+      },
+    },
     {
       'target_name': 'run_gen-regexp-special-case',
       'type': 'none',