Skip to content

Commit

Permalink
Merge pull request #26 from lightpanda-io/zig0.13
Browse files Browse the repository at this point in the history
upgrade to zig 0.13
  • Loading branch information
krichprollsch authored Jul 19, 2024
2 parents cd33e26 + f9d3167 commit 1559b03
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/zig-out/
/vendor
/libc_v8.a
/.zig-cache/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This dockerfile is used to build v8.
ARG ZIG_DOCKER_VERSION=0.12.1
ARG ZIG_DOCKER_VERSION=0.13.0
FROM ghcr.io/lightpanda-io/zig:${ZIG_DOCKER_VERSION} as build

ARG OS=linux
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Static libs are built and released with [Github Actions](https://github.com/fuba
\* Time is measured on standard Github instances.

## System Requirements
- Zig compiler (0.12.1). You can get that [here](https://ziglang.org/download/).
- Zig compiler (0.13.0). You can get that [here](https://ziglang.org/download/).
- Python 3 (2.7 seems to work as well)
- For native macOS builds:
- XCode (You won't need this when using zig's c++ toolchain!)<br/>
Expand Down
20 changes: 10 additions & 10 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ const MakePathStep = struct {
return new;
}

fn make(step: *Step, prog_node: *std.Progress.Node) anyerror!void {
fn make(step: *Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
const self: *Self = @fieldParentPtr("step", step);
try std.fs.cwd().makePath(self.b.pathFromRoot(self.path));
Expand Down Expand Up @@ -470,7 +470,7 @@ const CopyFileStep = struct {
return new;
}

fn make(step: *Step, prog_node: *std.Progress.Node) anyerror!void {
fn make(step: *Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
const self: *Self = @fieldParentPtr("step", step);
try std.fs.copyFileAbsolute(self.src_path, self.dst_path, .{});
Expand All @@ -489,7 +489,7 @@ fn linkV8(b: *std.Build, step: *std.Build.Step.Compile, use_zig_tc: bool) void {
mode_str,
lib,
}) catch unreachable;
step.addAssemblyFile(.{ .path = lib_path });
step.addAssemblyFile(b.path(lib_path));
if (builtin.os.tag == .linux) {
if (use_zig_tc) {
// TODO: This should be linked already when we built v8.
Expand All @@ -515,12 +515,12 @@ fn linkV8(b: *std.Build, step: *std.Build.Step.Compile, use_zig_tc: bool) void {

fn createTest(b: *std.Build, target: std.Build.ResolvedTarget, mode: std.builtin.Mode, use_zig_tc: bool) *std.Build.Step.Compile {
const step = b.addTest(.{
.root_source_file = .{ .path = "./src/test.zig" },
.root_source_file = b.path("./src/test.zig"),
.target = target,
.optimize = mode,
.link_libc = true,
});
step.addIncludePath(.{ .path = "./src" });
step.addIncludePath(b.path("./src"));
linkV8(b, step, use_zig_tc);
return step;
}
Expand Down Expand Up @@ -624,7 +624,7 @@ pub const GetV8SourceStep = struct {
try step.handleChildProcUnsupported(cwd, args.items);
try Step.handleVerbose(step.owner, cwd, args.items);

const result = std.ChildProcess.run(.{
const result = std.process.Child.run(.{
.cwd = cwd,
.allocator = arena,
.argv = args.items,
Expand All @@ -641,7 +641,7 @@ pub const GetV8SourceStep = struct {
}
}

fn make(step: *Step, prog_node: *std.Progress.Node) anyerror!void {
fn make(step: *Step, prog_node: std.Progress.Node) anyerror!void {
_ = prog_node;
const self: *Self = @fieldParentPtr("step", step);

Expand All @@ -661,7 +661,7 @@ pub const GetV8SourceStep = struct {

// Get DEPS in json.
const argv = &.{ "python3", "tools/parse_deps.py", "v8/DEPS" };
const result = std.ChildProcess.run(.{
const result = std.process.Child.run(.{
.allocator = step.owner.allocator,
.argv = argv,
}) catch |err| return step.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });
Expand Down Expand Up @@ -744,12 +744,12 @@ fn createCompileStep(b: *std.Build, path: []const u8, target: std.Build.Resolved

const step = b.addExecutable(.{
.name = name,
.root_source_file = .{ .path = path },
.root_source_file = b.path(path),
.optimize = mode,
.target = target,
.link_libc = true,
});
step.addIncludePath(.{ .path = "src" });
step.addIncludePath(b.path("src"));

if (mode == .ReleaseSafe) {
step.root_module.strip = true;
Expand Down

0 comments on commit 1559b03

Please sign in to comment.