Skip to content

Commit 8381d37

Browse files
mookumskrichprollsch
authored andcommitted
use prebuilt v8
1 parent 83140a6 commit 8381d37

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

build.zig

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pub fn build(b: *Build) !void {
4646
b.option([]const u8, "git_commit", "Current git commit") orelse "dev",
4747
);
4848

49+
const prebuilt_v8_path = b.option([]const u8, "prebuilt_v8_path", "Path to prebuilt libc_v8.a");
50+
4951
const target = b.standardTargetOptions(.{});
5052
const optimize = b.standardOptimizeOption(.{});
5153

@@ -59,7 +61,7 @@ pub fn build(b: *Build) !void {
5961
.link_libc = true,
6062
.link_libcpp = true,
6163
});
62-
try addDependencies(b, lightpanda_module, opts);
64+
try addDependencies(b, lightpanda_module, opts, prebuilt_v8_path);
6365

6466
{
6567
// browser
@@ -113,7 +115,7 @@ pub fn build(b: *Build) !void {
113115
.target = target,
114116
.optimize = optimize,
115117
});
116-
try addDependencies(b, wpt_module, opts);
118+
try addDependencies(b, wpt_module, opts, prebuilt_v8_path);
117119

118120
// compile and install
119121
const wpt = b.addExecutable(.{
@@ -133,14 +135,15 @@ pub fn build(b: *Build) !void {
133135
}
134136
}
135137

136-
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !void {
138+
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options, prebuilt_v8_path: ?[]const u8) !void {
137139
try moduleNetSurf(b, mod);
138140
mod.addImport("build_config", opts.createModule());
139141

140142
const target = mod.resolved_target.?;
141143
const dep_opts = .{
142144
.target = target,
143145
.optimize = mod.optimize.?,
146+
.prebuilt_v8_path = prebuilt_v8_path,
144147
};
145148

146149
mod.addIncludePath(b.path("vendor/lightpanda"));
@@ -153,15 +156,6 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
153156
const v8_mod = b.dependency("v8", dep_opts).module("v8");
154157
v8_mod.addOptions("default_exports", v8_opts);
155158
mod.addImport("v8", v8_mod);
156-
157-
switch (target.result.os.tag) {
158-
.macos => {
159-
// v8 has a dependency, abseil-cpp, which, on Mac, uses CoreFoundation
160-
mod.addSystemFrameworkPath(.{ .cwd_relative = "/System/Library/Frameworks" });
161-
mod.linkFramework("CoreFoundation", .{});
162-
},
163-
else => {},
164-
}
165159
}
166160

167161
{

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
.fingerprint = 0xda130f3af836cea0,
66
.dependencies = .{
77
.v8 = .{
8-
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/fbefa84efdf1b5c1401c930cdc5e99aee508a1f9.tar.gz",
9-
.hash = "v8-0.0.0-xddH62UlBAC-QfZy4qD6pF87wF8VjY54IOTu8SnFV4ub",
8+
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/543fb7b40a0e139ebe38e1401942b6506222daf3.tar.gz",
9+
.hash = "v8-0.0.0-xddH6-kmBAAdoG6goGoo3pMwzfL73XiFgcj82vYbLym4",
1010
},
1111
//.v8 = .{ .path = "../zig-v8-fork" }
1212
.@"ada-singleheader" = .{

0 commit comments

Comments
 (0)