Merge pull request #726 from mitchellh/update-zig

update zig
This commit is contained in:
Mitchell Hashimoto
2023-10-24 15:11:35 -07:00
committed by GitHub
4 changed files with 15 additions and 15 deletions

View File

@ -5,8 +5,8 @@
.dependencies = .{ .dependencies = .{
// Zig libs // Zig libs
.libxev = .{ .libxev = .{
.url = "https://github.com/mitchellh/libxev/archive/ecbc161a5dace26a1fd47e494f8be2cfd051cbfb.tar.gz", .url = "https://github.com/mitchellh/libxev/archive/5ecbc871f3bfa80fb7bf0fa853866cb93b99bc18.tar.gz",
.hash = "1220f34357168affd9aab1a3fcafcaff093c44beb75ce1d4d4b75490e90729221771", .hash = "1220416854e424601ecc9814afb461a5dc9cf95db5917d82f794594a58ffc723b82c",
}, },
.mach_glfw = .{ .mach_glfw = .{
.url = "https://github.com/hexops/mach-glfw/archive/16dc95cc7f74ebbbdd848d9a2c3cc4afc5717708.tar.gz", .url = "https://github.com/hexops/mach-glfw/archive/16dc95cc7f74ebbbdd848d9a2c3cc4afc5717708.tar.gz",

6
flake.lock generated
View File

@ -276,11 +276,11 @@
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1697934218, "lastModified": 1698149298,
"narHash": "sha256-6cNN6LGyv0d2pDetK+b73U0x73w7jhFrWvw6LwH1GAw=", "narHash": "sha256-c+o5oUprm8wnJWV8wpBVMlSptSIYy7hCk/vJHjVH4KU=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "bdb27f39c9e0fe27d1bc24e4929170b03aa917a4", "rev": "bbc407a319659eed86d97989ef50cc82e3677c45",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -19,19 +19,19 @@ branch: []const u8,
pub fn detect(b: *std.Build) !Version { pub fn detect(b: *std.Build) !Version {
// Execute a bunch of git commands to determine the automatic version. // Execute a bunch of git commands to determine the automatic version.
var code: u8 = 0; var code: u8 = 0;
const branch = try b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--abbrev-ref", "HEAD" }, &code, .Ignore); const branch = try b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--abbrev-ref", "HEAD" }, &code, .Ignore);
const short_hash = short_hash: { const short_hash = short_hash: {
const output = try b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "log", "--pretty=format:%h", "-n", "1" }, &code, .Ignore); const output = try b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "log", "--pretty=format:%h", "-n", "1" }, &code, .Ignore);
break :short_hash std.mem.trimRight(u8, output, "\r\n "); break :short_hash std.mem.trimRight(u8, output, "\r\n ");
}; };
const tag = b.execAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "describe", "--exact-match", "--tags" }, &code, .Ignore) catch |err| switch (err) { const tag = b.runAllowFail(&[_][]const u8{ "git", "-C", b.build_root.path orelse ".", "describe", "--exact-match", "--tags" }, &code, .Ignore) catch |err| switch (err) {
error.ExitCodeFailure => "", // expected error.ExitCodeFailure => "", // expected
else => return err, else => return err,
}; };
_ = b.execAllowFail(&[_][]const u8{ _ = b.runAllowFail(&[_][]const u8{
"git", "git",
"-C", "-C",
b.build_root.path orelse ".", b.build_root.path orelse ".",

View File

@ -33,7 +33,7 @@ fn homeUnix(buf: []u8) !?[]u8 {
// If we're on darwin, we try the directory service. I'm not sure if there // If we're on darwin, we try the directory service. I'm not sure if there
// is a Mac API to do this but if so we can link to that... // is a Mac API to do this but if so we can link to that...
if (builtin.os.tag == .macos) { if (builtin.os.tag == .macos) {
const exec = try std.ChildProcess.exec(.{ const run = try std.ChildProcess.run(.{
.allocator = fba.allocator(), .allocator = fba.allocator(),
.argv = &[_][]const u8{ .argv = &[_][]const u8{
"/bin/sh", "/bin/sh",
@ -43,8 +43,8 @@ fn homeUnix(buf: []u8) !?[]u8 {
.max_output_bytes = fba.buffer.len / 2, .max_output_bytes = fba.buffer.len / 2,
}); });
if (exec.term == .Exited and exec.term.Exited == 0) { if (run.term == .Exited and run.term.Exited == 0) {
const result = trimSpace(exec.stdout); const result = trimSpace(run.stdout);
if (buf.len < result.len) return Error.BufferTooSmall; if (buf.len < result.len) return Error.BufferTooSmall;
std.mem.copy(u8, buf, result); std.mem.copy(u8, buf, result);
return buf[0..result.len]; return buf[0..result.len];
@ -62,14 +62,14 @@ fn homeUnix(buf: []u8) !?[]u8 {
// If all else fails, have the shell tell us... // If all else fails, have the shell tell us...
fba.reset(); fba.reset();
const exec = try std.ChildProcess.exec(.{ const run = try std.ChildProcess.run(.{
.allocator = fba.allocator(), .allocator = fba.allocator(),
.argv = &[_][]const u8{ "/bin/sh", "-c", "cd && pwd" }, .argv = &[_][]const u8{ "/bin/sh", "-c", "cd && pwd" },
.max_output_bytes = fba.buffer.len / 2, .max_output_bytes = fba.buffer.len / 2,
}); });
if (exec.term == .Exited and exec.term.Exited == 0) { if (run.term == .Exited and run.term.Exited == 0) {
const result = trimSpace(exec.stdout); const result = trimSpace(run.stdout);
if (buf.len < result.len) return Error.BufferTooSmall; if (buf.len < result.len) return Error.BufferTooSmall;
std.mem.copy(u8, buf, result); std.mem.copy(u8, buf, result);
return buf[0..result.len]; return buf[0..result.len];