mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Compare commits
2 Commits
55e9d8d166
...
v8-build-w
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5190ca06c4 | ||
|
|
5679595a6c |
15
Makefile
15
Makefile
@@ -47,7 +47,7 @@ help:
|
|||||||
|
|
||||||
# $(ZIG) commands
|
# $(ZIG) commands
|
||||||
# ------------
|
# ------------
|
||||||
.PHONY: build build-dev run run-release shell test bench download-zig wpt data get-v8 build-v8 build-v8-dev
|
.PHONY: build build-dev run run-release shell test bench download-zig wpt data
|
||||||
.PHONY: end2end
|
.PHONY: end2end
|
||||||
|
|
||||||
zig_version = $(shell grep 'recommended_zig_version = "' "vendor/zig-js-runtime/build.zig" | cut -d'"' -f2)
|
zig_version = $(shell grep 'recommended_zig_version = "' "vendor/zig-js-runtime/build.zig" | cut -d'"' -f2)
|
||||||
@@ -112,19 +112,6 @@ end2end:
|
|||||||
@test -d ../demo
|
@test -d ../demo
|
||||||
cd ../demo && go run runner/main.go
|
cd ../demo && go run runner/main.go
|
||||||
|
|
||||||
## v8
|
|
||||||
get-v8:
|
|
||||||
@printf "\e[36mGetting v8 source...\e[0m\n"
|
|
||||||
@$(ZIG) build get-v8
|
|
||||||
|
|
||||||
build-v8-dev:
|
|
||||||
@printf "\e[36mBuilding v8 (dev)...\e[0m\n"
|
|
||||||
@$(ZIG) build build-v8
|
|
||||||
|
|
||||||
build-v8:
|
|
||||||
@printf "\e[36mBuilding v8...\e[0m\n"
|
|
||||||
@$(ZIG) build -Doptimize=ReleaseSafe build-v8
|
|
||||||
|
|
||||||
# Install and build required dependencies commands
|
# Install and build required dependencies commands
|
||||||
# ------------
|
# ------------
|
||||||
.PHONY: install-submodule
|
.PHONY: install-submodule
|
||||||
|
|||||||
57
build.zig
57
build.zig
@@ -46,6 +46,8 @@ pub fn build(b: *Build) !void {
|
|||||||
b.option([]const u8, "git_commit", "Current git commit") orelse "dev",
|
b.option([]const u8, "git_commit", "Current git commit") orelse "dev",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const prebuilt_v8_path = b.option([]const u8, "prebuilt_v8_path", "Path to prebuilt libc_v8.a");
|
||||||
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ pub fn build(b: *Build) !void {
|
|||||||
.link_libc = true,
|
.link_libc = true,
|
||||||
.link_libcpp = true,
|
.link_libcpp = true,
|
||||||
});
|
});
|
||||||
try addDependencies(b, lightpanda_module, opts);
|
try addDependencies(b, lightpanda_module, opts, prebuilt_v8_path);
|
||||||
|
|
||||||
{
|
{
|
||||||
// browser
|
// browser
|
||||||
@@ -113,7 +115,7 @@ pub fn build(b: *Build) !void {
|
|||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
try addDependencies(b, wpt_module, opts);
|
try addDependencies(b, wpt_module, opts, prebuilt_v8_path);
|
||||||
|
|
||||||
// compile and install
|
// compile and install
|
||||||
const wpt = b.addExecutable(.{
|
const wpt = b.addExecutable(.{
|
||||||
@@ -131,27 +133,9 @@ pub fn build(b: *Build) !void {
|
|||||||
const wpt_step = b.step("wpt", "WPT tests");
|
const wpt_step = b.step("wpt", "WPT tests");
|
||||||
wpt_step.dependOn(&wpt_cmd.step);
|
wpt_step.dependOn(&wpt_cmd.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
// get v8
|
|
||||||
// -------
|
|
||||||
const v8 = b.dependency("v8", .{ .target = target, .optimize = optimize });
|
|
||||||
const get_v8 = b.addRunArtifact(v8.artifact("get-v8"));
|
|
||||||
const get_step = b.step("get-v8", "Get v8");
|
|
||||||
get_step.dependOn(&get_v8.step);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// build v8
|
|
||||||
// -------
|
|
||||||
const v8 = b.dependency("v8", .{ .target = target, .optimize = optimize });
|
|
||||||
const build_v8 = b.addRunArtifact(v8.artifact("build-v8"));
|
|
||||||
const build_step = b.step("build-v8", "Build v8");
|
|
||||||
build_step.dependOn(&build_v8.step);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !void {
|
fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options, prebuilt_v8_path: ?[]const u8) !void {
|
||||||
try moduleNetSurf(b, mod);
|
try moduleNetSurf(b, mod);
|
||||||
mod.addImport("build_config", opts.createModule());
|
mod.addImport("build_config", opts.createModule());
|
||||||
|
|
||||||
@@ -159,6 +143,7 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
|
|||||||
const dep_opts = .{
|
const dep_opts = .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = mod.optimize.?,
|
.optimize = mod.optimize.?,
|
||||||
|
.prebuilt_v8_path = prebuilt_v8_path,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.addIncludePath(b.path("vendor/lightpanda"));
|
mod.addIncludePath(b.path("vendor/lightpanda"));
|
||||||
@@ -171,36 +156,6 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
|
|||||||
const v8_mod = b.dependency("v8", dep_opts).module("v8");
|
const v8_mod = b.dependency("v8", dep_opts).module("v8");
|
||||||
v8_mod.addOptions("default_exports", v8_opts);
|
v8_mod.addOptions("default_exports", v8_opts);
|
||||||
mod.addImport("v8", v8_mod);
|
mod.addImport("v8", v8_mod);
|
||||||
|
|
||||||
const release_dir = if (mod.optimize.? == .Debug) "debug" else "release";
|
|
||||||
const os = switch (target.result.os.tag) {
|
|
||||||
.linux => "linux",
|
|
||||||
.macos => "macos",
|
|
||||||
else => return error.UnsupportedPlatform,
|
|
||||||
};
|
|
||||||
var lib_path = try std.fmt.allocPrint(
|
|
||||||
mod.owner.allocator,
|
|
||||||
"v8/out/{s}/{s}/obj/zig/libc_v8.a",
|
|
||||||
.{ os, release_dir },
|
|
||||||
);
|
|
||||||
std.fs.cwd().access(lib_path, .{}) catch {
|
|
||||||
// legacy path
|
|
||||||
lib_path = try std.fmt.allocPrint(
|
|
||||||
mod.owner.allocator,
|
|
||||||
"v8/out/{s}/obj/zig/libc_v8.a",
|
|
||||||
.{release_dir},
|
|
||||||
);
|
|
||||||
};
|
|
||||||
mod.addObjectFile(mod.owner.path(lib_path));
|
|
||||||
|
|
||||||
switch (target.result.os.tag) {
|
|
||||||
.macos => {
|
|
||||||
// v8 has a dependency, abseil-cpp, which, on Mac, uses CoreFoundation
|
|
||||||
mod.addSystemFrameworkPath(.{ .cwd_relative = "/System/Library/Frameworks" });
|
|
||||||
mod.linkFramework("CoreFoundation", .{});
|
|
||||||
},
|
|
||||||
else => {},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
.fingerprint = 0xda130f3af836cea0,
|
.fingerprint = 0xda130f3af836cea0,
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.v8 = .{
|
.v8 = .{
|
||||||
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/305bb3706716d32d59b2ffa674731556caa1002b.tar.gz",
|
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/543fb7b40a0e139ebe38e1401942b6506222daf3.tar.gz",
|
||||||
.hash = "v8-0.0.0-xddH63bVAwBSEobaUok9J0er1FqsvEujCDDVy6ItqKQ5",
|
.hash = "v8-0.0.0-xddH6-kmBAAdoG6goGoo3pMwzfL73XiFgcj82vYbLym4",
|
||||||
},
|
},
|
||||||
//.v8 = .{ .path = "../zig-v8-fork" }
|
// .v8 = .{ .path = "../zig-v8-fork" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user