Skip to content

Commit 5d46f15

Browse files
authored
Merge pull request #60 from lightpanda-io/embed_icu
Embed ICU into libc_v8.a and expose InitializeICU calls
2 parents 168008d + d518faa commit 5d46f15

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

build.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ fn createV8_Build(b: *std.Build, target: std.Build.ResolvedTarget, mode: std.bui
133133
if (!icu) {
134134
// Don't add i18n for now. It has a large dependency on third_party/icu.
135135
try gn_args.append("v8_enable_i18n_support=false");
136+
} else {
137+
try gn_args.append("icu_use_data_file=false");
136138
}
137139

138140
if (mode != .Debug) {

src/binding.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ void v8__V8__InitializePlatform(v8::Platform* platform) {
162162

163163
void v8__V8__Initialize() { v8::V8::Initialize(); }
164164

165+
bool v8__V8__InitializeICU() { return v8::V8::InitializeICU(); }
166+
165167
int v8__V8__Dispose() { return v8::V8::Dispose(); }
166168

167169
void v8__V8__DisposePlatform() { v8::V8::DisposePlatform(); }

src/binding.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const Uint8Array* v8__Uint8Array__New(
128128
// V8
129129
void v8__V8__InitializePlatform(Platform* platform);
130130
void v8__V8__Initialize();
131+
bool v8__V8__InitializeICU();
131132
int v8__V8__Dispose();
132133
void v8__V8__DisposePlatform();
133134
const char* v8__V8__GetVersion();

src/v8.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ pub fn initV8() void {
171171
c.v8__V8__Initialize();
172172
}
173173

174+
/// [v8]
175+
/// Initializes the ICU bundled with v8.
176+
pub fn initV8ICU() bool {
177+
return c.v8__V8__InitializeICU();
178+
}
179+
174180
/// [v8]
175181
/// Releases any resources used by v8 and stops any utility thread
176182
/// that may be running. Note that disposing v8 is permanent, it

0 commit comments

Comments
 (0)