Skip to content

Commit 9be07be

Browse files
committed
Bump zig version
1 parent 8a0db2a commit 9be07be

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
- name: Install libarchive
1616
run: sudo apt update && sudo apt install libarchive-dev
1717
- name: Install zig
18-
run: wget https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1298+da06269d7.tar.xz && tar -xvf zig-linux-x86_64-0.12.0-dev.1298+da06269d7.tar.xz
18+
run: wget https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1856+94c63f31f.tar.xz && tar -xvf zig-linux-x86_64-0.12.0-dev.1856+94c63f31f.tar.xz
1919
- name: Compile
20-
run: ./zig-linux-x86_64-0.12.0-dev.1298+da06269d7/zig build -Doptimize=ReleaseFast -Dcpu=baseline
20+
run: ./zig-linux-x86_64-0.12.0-dev.1856+94c63f31f/zig build -Doptimize=ReleaseFast -Dcpu=baseline
2121
- name: Upload
2222
uses: actions/upload-artifact@v3
2323
with:

build.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pub fn build(b: *std.Build) void {
1212
});
1313
exe.linkLibC();
1414
exe.linkSystemLibrary("archive"); // libarchive
15+
16+
if (optimize != .Debug) {
17+
exe.strip = true;
18+
}
19+
1520
b.installArtifact(exe);
1621

1722
const run_cmd = b.addRunArtifact(exe);

src/C/tar.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Archive = @cImport({
1212
});
1313

1414
pub fn extractTarXZ(archivePath: []const u8) !void {
15-
var a = Archive.archive_read_new();
15+
const a = Archive.archive_read_new();
1616
var entry: ?*Archive.struct_archive_entry = null;
1717

1818
//defer _ = Archive.archive_read_close(a);

src/conf.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn load(allocator: std.mem.Allocator, home: []const u8) !std.StringHashMap([
1212
var z = try homedir.makeOpenPath(".zigd", .{});
1313
z.close();
1414

15-
var cfgfile = homedir.readFileAlloc(allocator, ".zigd/config", 1 << 21) catch |err| blk: {
15+
const cfgfile = homedir.readFileAlloc(allocator, ".zigd/config", 1 << 21) catch |err| blk: {
1616
switch (err) {
1717
error.FileNotFound => {
1818
existed = false;
@@ -62,11 +62,11 @@ pub fn save(home: []const u8, cfgmap: std.StringHashMap([]const u8)) !void {
6262
var l: usize = 0;
6363

6464
while (it.next()) |p| {
65-
var u = try std.fmt.bufPrint(&buf, "{s}={s}\n", .{ p.key_ptr.*, p.value_ptr.* });
65+
const u = try std.fmt.bufPrint(&buf, "{s}={s}\n", .{ p.key_ptr.*, p.value_ptr.* });
6666
l += u.len;
6767
}
6868

69-
var nbuf = buf[0..l];
69+
const nbuf = buf[0..l];
7070

7171
try homedir.writeFile(".zigd/config", nbuf);
7272
return;
@@ -76,15 +76,15 @@ pub fn parse(allocator: std.mem.Allocator, file: []const u8, cfgmap: *std.String
7676
var lines = std.mem.tokenize(u8, file, &[_]u8{'\n'});
7777

7878
while (lines.next()) |line| {
79-
var indexofeq = std.mem.indexOf(u8, line, "=") orelse continue;
79+
const indexofeq = std.mem.indexOf(u8, line, "=") orelse continue;
8080

81-
var key = std.mem.trim(u8, line[0..indexofeq], &std.ascii.whitespace);
82-
var value = std.mem.trim(u8, line[indexofeq + 1 ..], &std.ascii.whitespace);
81+
const key = std.mem.trim(u8, line[0..indexofeq], &std.ascii.whitespace);
82+
const value = std.mem.trim(u8, line[indexofeq + 1 ..], &std.ascii.whitespace);
8383

8484
if (key[0] == '#') continue;
8585

86-
var dupedkey = try allocator.dupe(u8, key);
87-
var dupedvalue = try allocator.dupe(u8, value);
86+
const dupedkey = try allocator.dupe(u8, key);
87+
const dupedvalue = try allocator.dupe(u8, value);
8888

8989
try cfgmap.put(dupedkey, dupedvalue);
9090
}

src/main.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn main() !void {
1212
defer _ = if (mode == .Debug) gpa.deinit();
1313
const allocator = if (mode == .Debug) gpa.allocator() else std.heap.c_allocator;
1414

15-
var home = try std.process.getEnvVarOwned(allocator, "HOME");
15+
const home = try std.process.getEnvVarOwned(allocator, "HOME");
1616
defer allocator.free(home);
1717

1818
const args = try std.process.argsAlloc(allocator);
@@ -53,7 +53,7 @@ pub fn main() !void {
5353
var zig_version = std.fs.cwd().readFileAlloc(allocator, "zigd.ver", 1 << 21) catch blk: {
5454
needtofree_ = false;
5555

56-
var absolutecwd = try std.fs.cwd().realpathAlloc(allocator, ".");
56+
const absolutecwd = try std.fs.cwd().realpathAlloc(allocator, ".");
5757
defer allocator.free(absolutecwd);
5858

5959
if (cfg.contains(absolutecwd)) {
@@ -79,14 +79,14 @@ pub fn main() !void {
7979
defer _ = if (needtofree_) allocator.free(zig_version);
8080

8181
const zig_binary = try try_get_bin: {
82-
var zig_binary_0 = try std.fs.path.join(allocator, &.{ home, ".zigd", "versions", zig_version });
82+
const zig_binary_0 = try std.fs.path.join(allocator, &.{ home, ".zigd", "versions", zig_version });
8383
defer allocator.free(zig_binary_0);
8484
var zig_binary_1 = std.fs.openDirAbsolute(zig_binary_0, .{}) catch {
8585
std.debug.print("Did not find zig binary in zigd cache, installing...\n", .{});
8686
const bin = try zigd.install(allocator, zig_version, home);
8787
break :try_get_bin bin;
8888
};
89-
var zig_binary_a = zig_binary_1.realpathAlloc(allocator, "zig");
89+
const zig_binary_a = zig_binary_1.realpathAlloc(allocator, "zig");
9090
zig_binary_1.close();
9191
break :try_get_bin zig_binary_a;
9292
};
@@ -106,7 +106,7 @@ fn exec(allocator: std.mem.Allocator, zig_binary: []const u8, args: [][:0]u8) !s
106106
try nargs.append(arg);
107107
}
108108

109-
var naargs = try nargs.toOwnedSlice();
109+
const naargs = try nargs.toOwnedSlice();
110110
defer allocator.free(naargs);
111111
return try run(allocator, naargs);
112112
}

src/utils.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn run(allocator: std.mem.Allocator, argv: []const []const u8) !std.ChildPro
77

88
pub fn fromHome(home: []const u8, to: []const u8) !std.fs.Dir {
99
var o1 = try std.fs.openDirAbsolute(home, .{});
10-
var o2 = try o1.makeOpenPath(to, .{});
10+
const o2 = try o1.makeOpenPath(to, .{});
1111
o1.close();
1212
return o2;
1313
}

src/zigd.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn masterFromIndex(allocator: std.mem.Allocator) ![]const u8 {
6363
pub fn install(allocator: std.mem.Allocator, given_version: []const u8, home: []const u8) ![]const u8 {
6464
var free_s: bool = false;
6565

66-
var version = vl: {
66+
const version = vl: {
6767
if (std.mem.eql(u8, given_version, "master")) {
6868
free_s = true;
6969
break :vl try masterFromIndex(allocator);

zigd.ver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.0-dev.1298+da06269d7
1+
0.12.0-dev.1856+94c63f31f

0 commit comments

Comments
 (0)