authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-26 12:43:48 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-26 12:43:48 -07:00
log046eb90846a97391398a469bad3e0bf37c96c700
tree7283684a111ebcba098cb08774de08ad37494097
parentbe789458ab55d45d818c1eee30bf99a9ab4ff755

meta: update to zig master


9 files changed, 35 insertions(+), 24 deletions(-)

.github/workflows/nightly.yml+1-1
......@@ -26,7 +26,7 @@ jobs:
2626 - name: Setup Zig
2727 uses: goto-bus-stop/setup-zig@v1
2828 with:
29 version: "0.11.0-dev.1898+1a4a0b5e9"
29 version: "0.11.0-dev.2777+b95cdf0ae"
3030
3131 - run: zig version
3232 - run: zig env
.github/workflows/push.yml+1-1
......@@ -19,7 +19,7 @@ jobs:
1919 - name: Setup Zig
2020 uses: goto-bus-stop/setup-zig@v1
2121 with:
22 version: "0.11.0-dev.1898+1a4a0b5e9"
22 version: "0.11.0-dev.2777+b95cdf0ae"
2323
2424 - run: zig version
2525 - run: zig env
README.md+1-1
......@@ -17,7 +17,7 @@ A package manager for the Zig programming language.
1717- https://github.com/nektro/zigmod/releases
1818
1919## Built With
20- Zig master (at least `0.11.0-dev.1898+1a4a0b5e9`)
20- Zig master (at least `0.11.0-dev.2777+b95cdf0ae`)
2121- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)
2222
2323### Build from Source
build.zig+2-3
......@@ -4,7 +4,6 @@ const builtin = @import("builtin");
44const deps = @import("./deps.zig");
55
66pub fn build(b: *std.build.Builder) void {
7 b.prominent_compile_errors = true;
87 const target = b.standardTargetOptions(.{});
98 const optimize = b.standardOptimizeOption(.{});
109 const use_full_name = b.option(bool, "use-full-name", "") orelse false;
......@@ -17,9 +16,9 @@ pub fn build(b: *std.build.Builder) void {
1716 exe_options.addOption(string, "version", b.option(string, "tag", "") orelse "dev");
1817
1918 deps.addAllTo(exe);
20 exe.install();
19 b.installArtifact(exe);
2120
22 const run_cmd = exe.run();
21 const run_cmd = b.addRunArtifact(exe);
2322 run_cmd.step.dependOn(b.getInstallStep());
2423 if (b.args) |args| {
2524 run_cmd.addArgs(args);
deps.zig+13-7
......@@ -13,7 +13,12 @@ pub const GitExactStep = struct {
1313 pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep {
1414 var result = b.allocator.create(GitExactStep) catch @panic("memory");
1515 result.* = GitExactStep{
16 .step = std.build.Step.init(.custom, b.fmt("git clone {s} @ {s}", .{ url, commit }), b.allocator, make),
16 .step = std.build.Step.init(.{
17 .id = .custom,
18 .name = b.fmt("git clone {s} @ {s}", .{ url, commit }),
19 .owner = b,
20 .makeFn = make,
21 }),
1722 .builder = b,
1823 .url = url,
1924 .commit = commit,
......@@ -36,13 +41,14 @@ pub const GitExactStep = struct {
3641 return result;
3742 }
3843
39 fn make(step: *std.build.Step) !void {
44 fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void {
4045 _ = step;
46 _ = prog_node;
4147 }
4248};
4349
4450pub fn fetch(exe: *std.build.LibExeObjStep) void {
45 const b = exe.builder;
51 const b = exe.step.owner;
4652 inline for (comptime std.meta.declarations(package_data)) |decl| {
4753 const path = &@field(package_data, decl.name).entry;
4854 const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else ".";
......@@ -84,7 +90,7 @@ fn flip(foo: anytype) !void {
8490pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
8591 checkMinZig(builtin.zig_version, exe);
8692 fetch(exe);
87 const b = exe.builder;
93 const b = exe.step.owner;
8894 @setEvalBranchQuota(1_000_000);
8995 for (packages) |pkg| {
9096 const moddep = pkg.zp(b);
......@@ -100,7 +106,7 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
100106 llc = true;
101107 }
102108 for (pkg.frameworks) |item| {
103 if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
109 if (!builtin.target.isDarwin()) @panic(exe.step.owner.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
104110 exe.linkFramework(item);
105111 llc = true;
106112 }
......@@ -152,8 +158,8 @@ pub const Package = struct {
152158};
153159
154160fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {
155 const min = std.SemanticVersion.parse("0.11.0-dev.1681+0bb178bbb") catch return;
156 if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));
161 const min = std.SemanticVersion.parse("0.11.0-dev.2777+b95cdf0ae") catch return;
162 if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current, min}));
157163}
158164
159165pub const package_data = struct {
docs/README.md+1-1
......@@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed.
1010
1111As Zig is still in development itself, if you plan to contribute to Zigmod you will need a master download of Zig. Those can be obtained from https://ziglang.org/download/#release-master.
1212
13The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.1898+1a4a0b5e9`.
13The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.2777+b95cdf0ae`.
1414
1515## Download
1616You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.
src/cmd/fetch.zig+3-3
......@@ -49,7 +49,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
4949 try w.writeAll(
5050 \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
5151 \\ checkMinZig(builtin.zig_version, exe);
52 \\ const b = exe.builder;
52 \\ const b = exe.step.owner;
5353 \\ @setEvalBranchQuota(1_000_000);
5454 \\ for (packages) |pkg| {
5555 \\ const moddep = pkg.zp(b);
......@@ -64,7 +64,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
6464 \\ llc = true;
6565 \\ }
6666 \\ for (pkg.frameworks) |item| {
67 \\ if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
67 \\ if (!builtin.target.isDarwin()) @panic(b.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
6868 \\ exe.linkFramework(item);
6969 \\ llc = true;
7070 \\ }
......@@ -126,7 +126,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
126126 try w.print(
127127 \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{
128128 \\ const min = std.SemanticVersion.parse("{?}") catch return;
129 \\ if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}}));
129 \\ if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}}));
130130 \\}}
131131 \\
132132 \\
src/cmd/generate.zig+12-6
......@@ -52,7 +52,12 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
5252 \\ pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep {
5353 \\ var result = b.allocator.create(GitExactStep) catch @panic("memory");
5454 \\ result.* = GitExactStep{
55 \\ .step = std.build.Step.init(.custom, b.fmt("git clone {s} @ {s}", .{ url, commit }), b.allocator, make),
55 \\ .step = std.build.Step.init(.{
56 \\ .id = .custom,
57 \\ .name = b.fmt("git clone {s} @ {s}", .{ url, commit }),
58 \\ .owner = b,
59 \\ .makeFn = make,
60 \\ }),
5661 \\ .builder = b,
5762 \\ .url = url,
5863 \\ .commit = commit,
......@@ -77,13 +82,14 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
7782 \\ return result;
7883 \\ }
7984 \\
80 \\ fn make(step: *std.build.Step) !void {
85 \\ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void {
8186 \\ _ = step;
87 \\ _ = prog_node;
8288 \\ }
8389 \\};
8490 \\
8591 \\pub fn fetch(exe: *std.build.LibExeObjStep) void {
86 \\ const b = exe.builder;
92 \\ const b = exe.step.owner;
8793 \\ inline for (comptime std.meta.declarations(package_data)) |decl| {
8894 \\ const path = &@field(package_data, decl.name).entry;
8995 \\ const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else ".";
......@@ -119,7 +125,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
119125 \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
120126 \\ checkMinZig(builtin.zig_version, exe);
121127 \\ fetch(exe);
122 \\ const b = exe.builder;
128 \\ const b = exe.step.owner;
123129 \\ @setEvalBranchQuota(1_000_000);
124130 \\ for (packages) |pkg| {
125131 \\ const moddep = pkg.zp(b);
......@@ -135,7 +141,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
135141 \\ llc = true;
136142 \\ }
137143 \\ for (pkg.frameworks) |item| {
138 \\ if (!builtin.target.isDarwin()) @panic(exe.builder.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
144 \\ if (!builtin.target.isDarwin()) @panic(exe.step.owner.fmt("a dependency is attempting to link to the framework {s}, which is only possible under Darwin", .{item}));
139145 \\ exe.linkFramework(item);
140146 \\ llc = true;
141147 \\ }
......@@ -192,7 +198,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D
192198 try w.print(
193199 \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{
194200 \\ const min = std.SemanticVersion.parse("{?}") catch return;
195 \\ if (current.order(min).compare(.lt)) @panic(exe.builder.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}}));
201 \\ if (current.order(min).compare(.lt)) @panic(exe.step.owner.fmt("Your Zig version v{{}} does not meet the minimum build requirement of v{{}}", .{{current, min}}));
196202 \\}}
197203 \\
198204 \\
zig.mod+1-1
......@@ -3,7 +3,7 @@ name: zigmod
33main: src/lib.zig
44license: MIT
55description: A package manager for the Zig programming language.
6min_zig_version: 0.11.0-dev.1898+1a4a0b5e9
6min_zig_version: 0.11.0-dev.2777+b95cdf0ae
77dependencies:
88 - src: git https://github.com/nektro/zig-yaml
99 - src: git https://github.com/nektro/zig-ansi