Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ console.log(p.name()); // 'Doe'

### Prerequisites

jsruntime-lib is written with [Zig](https://ziglang.org/) `0.10.1`. You have to
jsruntime-lib is written with [Zig](https://ziglang.org/) `0.12`. You have to
install it with the right version in order to build the project.

To be able to build the v8 engine, you have to install some libs:
Expand Down
16 changes: 7 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub fn build(b: *std.Build) !void {

// run
const bench_cmd = b.addRunArtifact(bench);
bench_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
bench_cmd.addArgs(args);
}
Expand Down Expand Up @@ -81,7 +80,6 @@ pub fn build(b: *std.Build) !void {

// run
const shell_cmd = b.addRunArtifact(shell);
shell_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
shell_cmd.addArgs(args);
}
Expand Down Expand Up @@ -115,7 +113,7 @@ const Engine = enum {

pub const Options = struct {
engine: Engine,
opts: *std.Build.OptionsStep,
opts: *std.Build.Step.Options,
};

pub fn buildOptions(b: *std.Build) !Options {
Expand All @@ -137,7 +135,7 @@ pub fn buildOptions(b: *std.Build) !Options {
}

fn common(
step: *std.Build.CompileStep,
step: *std.Build.Step.Compile,
mode: std.builtin.Mode,
options: Options,
) !void {
Expand All @@ -155,21 +153,21 @@ pub fn packages(comptime vendor_path: []const u8) type {

const vendor = vendor_path ++ "vendor";

fn tigerbeetle_io(step: *std.Build.CompileStep) *std.Build.Module {
fn tigerbeetle_io(step: *std.Build.Step.Compile) *std.Build.Module {
return step.step.owner.createModule(.{
.source_file = .{ .path = vendor ++ "/tigerbeetle-io/io.zig" },
});
}

fn zig_v8(step: *std.Build.CompileStep) *std.Build.Module {
fn zig_v8(step: *std.Build.Step.Compile) *std.Build.Module {
step.addIncludePath(.{ .path = vendor ++ "/zig-v8/src" });

return step.step.owner.createModule(.{
.source_file = .{ .path = vendor ++ "/zig-v8/src/v8.zig" },
});
}

fn v8(step: *std.Build.CompileStep, mode: std.builtin.Mode) !void {
fn v8(step: *std.Build.Step.Compile, mode: std.builtin.Mode) !void {
const mode_str: []const u8 = if (mode == .Debug) "debug" else "release";
// step.linkLibC(); // TODO: do we need to link libc?

Expand Down Expand Up @@ -202,7 +200,7 @@ pub fn packages(comptime vendor_path: []const u8) type {
step.addObjectFile(.{ .path = lib_path });
}

pub fn add_shell(step: *std.Build.CompileStep) !void {
pub fn add_shell(step: *std.Build.Step.Compile) !void {
step.addIncludePath(.{ .path = vendor ++ "/linenoise-mob" });
const lib = step.step.owner.addStaticLibrary(.{
.name = "linenoise",
Expand All @@ -220,7 +218,7 @@ pub fn packages(comptime vendor_path: []const u8) type {
}

pub fn add(
step: *std.build.CompileStep,
step: *std.build.Step.Compile,
options: Options,
) !void {
const jsruntime_mod = step.step.owner.createModule(.{
Expand Down
4 changes: 2 additions & 2 deletions src/reflect.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ pub fn do(comptime types: anytype) Error![]Struct {

// reflect each type
var all: [types_fields.len]Struct = undefined;
inline for (types_fields, 0..) |field, i| {
for (types_fields, 0..) |field, i| {
const T = @field(types, field.name);
all[i] = try Struct.reflect(T, i);
}
Expand All @@ -1463,7 +1463,7 @@ pub fn do(comptime types: anytype) Error![]Struct {
try lookupException(&all);

// look Types for corresponding Struct
inline for (&all) |*s| {
for (&all) |*s| {
try s.lookupTypes(&all);
}

Expand Down