Skip to content

Commit

Permalink
Update to Zig 0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
mgord9518 committed Jun 18, 2024
1 parent cfbeee8 commit 889eaab
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/setup-go@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.0
version: 0.13.0

- name: Install deps
run: |
Expand Down
14 changes: 4 additions & 10 deletions zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@ pub const LinkOptions = struct {
use_libdeflate: bool = true,
};

pub inline fn thisDir() []const u8 {
return comptime std.fs.path.dirname(@src().file) orelse unreachable;
}

// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const prefix = thisDir();

// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
Expand All @@ -49,15 +43,15 @@ pub fn build(b: *std.Build) void {
.name = "aisap",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = .{ .path = prefix ++ "/lib/c_api.zig" },
.root_source_file = b.path("lib/c_api.zig"),
.target = target,
.optimize = optimize,
});

lib.addIncludePath(.{ .path = prefix ++ "/../include" });
lib.addIncludePath(b.path("../include"));

const known_folders_module = b.addModule("known-folders", .{
.root_source_file = .{ .path = "known-folders/known-folders.zig" },
.root_source_file = b.path("known-folders/known-folders.zig"),
});

const squashfuse_dep = b.dependency("squashfuse", .{
Expand Down Expand Up @@ -110,7 +104,7 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const main_tests = b.addTest(.{
.root_source_file = .{ .path = "lib.zig" },
.root_source_file = b.path("lib.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
4 changes: 2 additions & 2 deletions zig/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
.dependencies = .{
.squashfuse = .{
.url = "https://github.com/mgord9518/squashfuse-zig/archive/refs/tags/continuous.tar.gz",
.hash = "1220558ae6e303460037e63523a874f06c434f109897c75d0f5a3512ffe44fffaa23",
.hash = "12209f047e1b7dcaaa3335cb2ae4167b1062f308c409d8be24ce99edd17e1a0fc7d1",
},
.fuse = .{
.url = "https://github.com/mgord9518/libfuse-zig/archive/refs/tags/continuous.tar.gz",
.hash = "1220c5f5640bdf55d07c1cd67986a39df1c41fff641f58e975a7cf6a470ae5b2461b",
.hash = "12205592f7dc4b4c7256abd657a50bd9784459a0e9b8bfe8b0d1bbcc153a6d0f650a",
},
},
}
7 changes: 3 additions & 4 deletions zig/lib/appimage.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const span = std.mem.span;
const expect = std.testing.expect;
const os = std.os;
const posix = std.posix;
const ChildProcess = std.ChildProcess;

const Md5 = std.crypto.hash.Md5;

Expand Down Expand Up @@ -1161,7 +1160,7 @@ pub const AppImage = struct {
);
defer ai.allocator.free(offset_string);

var proc = ChildProcess.init(&[_][]const u8{
var proc = std.process.Child.init(&[_][]const u8{
"squashfuse",
offset_string,
ai.path,
Expand Down Expand Up @@ -1221,7 +1220,7 @@ pub const AppImage = struct {

pub fn unmount(ai: *AppImage) !void {
if (ai.mount_dir) |mount_dir| {
var umount = ChildProcess.init(&[_][]const u8{
var umount = std.process.Child.init(&[_][]const u8{
"fusermount",
"-u",
mount_dir,
Expand Down Expand Up @@ -1388,7 +1387,7 @@ pub fn bwrap(allocator: std.mem.Allocator, args: []const []const u8) !void {
const stdout = std.io.getStdOut();
const stderr = std.io.getStdErr();

var child = ChildProcess.init(args, allocator);
var child = std.process.Child.init(args, allocator);
child.stdout = stdout;
child.stderr = stderr;
_ = try child.spawnAndWait();
Expand Down

0 comments on commit 889eaab

Please sign in to comment.