Skip to content

Commit 83140a6

Browse files
mookumskrichprollsch
authored andcommitted
build v8 with zig
1 parent 927cbe7 commit 83140a6

File tree

3 files changed

+3
-55
lines changed

3 files changed

+3
-55
lines changed

Makefile

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ help:
4747

4848
# $(ZIG) commands
4949
# ------------
50-
.PHONY: build build-dev run run-release shell test bench download-zig wpt data get-v8 build-v8 build-v8-dev
50+
.PHONY: build build-dev run run-release shell test bench download-zig wpt data
5151
.PHONY: end2end
5252

5353
zig_version = $(shell grep 'recommended_zig_version = "' "vendor/zig-js-runtime/build.zig" | cut -d'"' -f2)
@@ -112,19 +112,6 @@ end2end:
112112
@test -d ../demo
113113
cd ../demo && go run runner/main.go
114114

115-
## v8
116-
get-v8:
117-
@printf "\e[36mGetting v8 source...\e[0m\n"
118-
@$(ZIG) build get-v8
119-
120-
build-v8-dev:
121-
@printf "\e[36mBuilding v8 (dev)...\e[0m\n"
122-
@$(ZIG) build build-v8
123-
124-
build-v8:
125-
@printf "\e[36mBuilding v8...\e[0m\n"
126-
@$(ZIG) build -Doptimize=ReleaseSafe build-v8
127-
128115
# Install and build required dependencies commands
129116
# ------------
130117
.PHONY: install-submodule

build.zig

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,6 @@ pub fn build(b: *Build) !void {
131131
const wpt_step = b.step("wpt", "WPT tests");
132132
wpt_step.dependOn(&wpt_cmd.step);
133133
}
134-
135-
{
136-
// get v8
137-
// -------
138-
const v8 = b.dependency("v8", .{ .target = target, .optimize = optimize });
139-
const get_v8 = b.addRunArtifact(v8.artifact("get-v8"));
140-
const get_step = b.step("get-v8", "Get v8");
141-
get_step.dependOn(&get_v8.step);
142-
}
143-
144-
{
145-
// build v8
146-
// -------
147-
const v8 = b.dependency("v8", .{ .target = target, .optimize = optimize });
148-
const build_v8 = b.addRunArtifact(v8.artifact("build-v8"));
149-
const build_step = b.step("build-v8", "Build v8");
150-
build_step.dependOn(&build_v8.step);
151-
}
152134
}
153135

154136
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !void {
@@ -172,27 +154,6 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
172154
v8_mod.addOptions("default_exports", v8_opts);
173155
mod.addImport("v8", v8_mod);
174156

175-
const release_dir = if (mod.optimize.? == .Debug) "debug" else "release";
176-
const os = switch (target.result.os.tag) {
177-
.linux => "linux",
178-
.macos => "macos",
179-
else => return error.UnsupportedPlatform,
180-
};
181-
var lib_path = try std.fmt.allocPrint(
182-
mod.owner.allocator,
183-
"v8/out/{s}/{s}/obj/zig/libc_v8.a",
184-
.{ os, release_dir },
185-
);
186-
std.fs.cwd().access(lib_path, .{}) catch {
187-
// legacy path
188-
lib_path = try std.fmt.allocPrint(
189-
mod.owner.allocator,
190-
"v8/out/{s}/obj/zig/libc_v8.a",
191-
.{release_dir},
192-
);
193-
};
194-
mod.addObjectFile(mod.owner.path(lib_path));
195-
196157
switch (target.result.os.tag) {
197158
.macos => {
198159
// v8 has a dependency, abseil-cpp, which, on Mac, uses CoreFoundation

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/84cdca7cd9065f67c7933388f2091810fc485bc6.tar.gz",
9-
.hash = "v8-0.0.0-xddH67vcAwCuN2gBsAO8TBzEw523KMroIKGrdZwc-Q-y",
8+
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/fbefa84efdf1b5c1401c930cdc5e99aee508a1f9.tar.gz",
9+
.hash = "v8-0.0.0-xddH62UlBAC-QfZy4qD6pF87wF8VjY54IOTu8SnFV4ub",
1010
},
1111
//.v8 = .{ .path = "../zig-v8-fork" }
1212
.@"ada-singleheader" = .{

0 commit comments

Comments
 (0)