Skip to content

Commit 3de4c51

Browse files
committed
build, v8: fix Temporal compilation with system or no ICU
1 parent 0dceddd commit 3de4c51

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

deps/v8/src/objects/js-temporal-zoneinfo64.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
#include "temporal_rs/Provider.hpp"
1111
#include "temporal_rs/TimeZone.hpp"
1212

13-
#ifdef V8_INTL_SUPPORT
13+
#if defined(V8_INTL_SUPPORT) && defined(__has_include) && __has_include("udatamem.h")
1414
#include "udatamem.h"
15-
#else
15+
#define V8_TEMPORAL_USE_ICU_RAW_MEMORY
16+
#endif
17+
18+
#ifndef V8_TEMPORAL_USE_ICU_RAW_MEMORY
1619
// Defined in builtins-temporal-zoneinfo64-data.cc, generated by
1720
// include-file-as-bytes.py
1821
extern "C" uint32_t zoneinfo64_static_data[];
@@ -22,7 +25,7 @@ extern "C" size_t zoneinfo64_static_data_len;
2225
namespace v8::internal {
2326

2427
ZoneInfo64Provider::ZoneInfo64Provider() {
25-
#ifdef V8_INTL_SUPPORT
28+
#ifdef V8_TEMPORAL_USE_ICU_RAW_MEMORY
2629
UErrorCode status = U_ZERO_ERROR;
2730
memory = udata_open(0, "res", "zoneinfo64", &status);
2831
if (U_FAILURE(status)) {
@@ -74,7 +77,7 @@ ZoneInfo64Provider::~ZoneInfo64Provider() {
7477

7578
// Then clean up memory
7679
// This ideally is a no-op when using static data
77-
#ifdef V8_INTL_SUPPORT
80+
#ifdef V8_TEMPORAL_USE_ICU_RAW_MEMORY
7881
if (memory) {
7982
udata_close(memory);
8083
}

tools/v8_gypfiles/v8.gyp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,9 @@
13791379
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_enable_i18n_support.*?sources -= ")',
13801380
],
13811381
}],
1382+
['v8_enable_temporal_support==1', {
1383+
'dependencies': ['make_temporal_zoneinfo_cpp'],
1384+
}],
13821385
['v8_postmortem_support', {
13831386
'dependencies': ['postmortem-metadata#target'],
13841387
}],
@@ -1955,6 +1958,40 @@
19551958
"<(V8_ROOT)/src/regexp/special-case.h",
19561959
],
19571960
}, # gen-regexp-special-case
1961+
{
1962+
'target_name': 'make_temporal_zoneinfo_cpp',
1963+
'type': 'none',
1964+
'toolsets': ['host', 'target'],
1965+
'conditions': [
1966+
['v8_enable_temporal_support==1', {
1967+
'actions': [
1968+
{
1969+
'action_name': 'make_temporal_zoneinfo_cpp_action',
1970+
'inputs': [
1971+
'<(V8_ROOT)/tools/include-file-as-bytes.py',
1972+
'<(V8_ROOT)/../crates/vendor/zoneinfo64/src/data/zoneinfo64.res',
1973+
],
1974+
'outputs': [
1975+
'<(SHARED_INTERMEDIATE_DIR)/src/builtins/builtins-temporal-zoneinfo64-data.cc',
1976+
],
1977+
'action': [
1978+
'<(python)',
1979+
'<(V8_ROOT)/tools/include-file-as-bytes.py',
1980+
'<(V8_ROOT)/../crates/vendor/zoneinfo64/src/data/zoneinfo64.res',
1981+
'<@(_outputs)',
1982+
'zoneinfo64_static_data',
1983+
],
1984+
'message': 'Generating temporal zoneinfo static data',
1985+
},
1986+
],
1987+
}],
1988+
],
1989+
'direct_dependent_settings': {
1990+
'sources': [
1991+
'<(SHARED_INTERMEDIATE_DIR)/src/builtins/builtins-temporal-zoneinfo64-data.cc',
1992+
],
1993+
},
1994+
},
19581995
{
19591996
'target_name': 'run_gen-regexp-special-case',
19601997
'type': 'none',

0 commit comments

Comments
 (0)