authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-02-08 00:23:09 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-02-08 00:23:09 -08:00
logcee55e13da2262f794f77e3848b2e564e58130b0
tree51427daed6f1baa8354f2700f95771c0df9282e2
parent827c27ef00d14468fde26506fd4999d96ce7c448

update for zig master 0.11.0-dev.1570+693b12f8e


8 files changed, 41 insertions(+), 23 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.874+40ed6ae84"
29 version: "0.11.0-dev.1570+693b12f8e"
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.874+40ed6ae84"
22 version: "0.11.0-dev.1570+693b12f8e"
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.874+40ed6ae84`)
20- Zig master (at least `0.11.0-dev.1570+693b12f8e`)
2121- See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock)
2222
2323### Build from Source
build.zig+7-7
......@@ -6,16 +6,16 @@ const deps = @import("./deps.zig");
66pub fn build(b: *std.build.Builder) void {
77 b.prominent_compile_errors = true;
88 const target = b.standardTargetOptions(.{});
9
10 b.setPreferredReleaseMode(.ReleaseSafe);
11 const mode = b.standardReleaseOptions();
12
9 const optimize = b.standardOptimizeOption(.{});
1310 const use_full_name = b.option(bool, "use-full-name", "") orelse false;
1411 const with_arch_os = b.fmt("-{s}-{s}", .{ @tagName(target.cpu_arch orelse builtin.cpu.arch), @tagName(target.os_tag orelse builtin.os.tag) });
1512 const exe_name = b.fmt("{s}{s}", .{ "zigmod", if (use_full_name) with_arch_os else "" });
16 const exe = b.addExecutable(exe_name, "src/main.zig");
17 exe.setTarget(target);
18 exe.setBuildMode(mode);
13 const exe = b.addExecutable(.{
14 .name = exe_name,
15 .root_source_file = .{ .path = "src/main.zig" },
16 .target = target,
17 .optimize = optimize,
18 });
1919
2020 const exe_options = b.addOptions();
2121 exe.addOptions("build_options", exe_options);
deps.zig+10-7
......@@ -1,7 +1,7 @@
11// zig fmt: off
22const std = @import("std");
33const builtin = @import("builtin");
4const Pkg = std.build.Pkg;
4const ModuleDependency = std.build.ModuleDependency;
55const string = []const u8;
66
77pub const GitExactStep = struct {
......@@ -87,7 +87,8 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void {
8787 const b = exe.builder;
8888 @setEvalBranchQuota(1_000_000);
8989 for (packages) |pkg| {
90 exe.addPackage(pkg.zp(b));
90 const moddep = pkg.zp(b);
91 exe.addModule(moddep.name, moddep.module);
9192 }
9293 var llc = false;
9394 var vcpkg = false;
......@@ -129,21 +130,23 @@ pub const Package = struct {
129130 frameworks: []const string = &.{},
130131 vcpkg: bool = false,
131132
132 pub fn zp(self: *const Package, b: *std.build.Builder) Pkg {
133 var temp: [100]Pkg = undefined;
133 pub fn zp(self: *const Package, b: *std.build.Builder) ModuleDependency {
134 var temp: [100]ModuleDependency = undefined;
134135 for (self.deps) |item, i| {
135136 temp[i] = item.zp(b);
136137 }
137138 return .{
138139 .name = self.name,
139 .source = .{ .path = self.entry.? },
140 .dependencies = b.allocator.dupe(Pkg, temp[0..self.deps.len]) catch @panic("oom"),
140 .module = b.createModule(.{
141 .source_file = .{ .path = self.entry.? },
142 .dependencies = b.allocator.dupe(ModuleDependency, temp[0..self.deps.len]) catch @panic("oom"),
143 }),
141144 };
142145 }
143146};
144147
145148fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {
146 const min = std.SemanticVersion.parse("0.11.0-dev.874+40ed6ae84") catch return;
149 const min = std.SemanticVersion.parse("0.11.0-dev.1570+693b12f8e") catch return;
147150 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}));
148151}
149152
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.874+40ed6ae84`.
13The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.1570+693b12f8e`.
1414
1515## Download
1616You may download a precompiled binary from https://github.com/nektro/zigmod/releases or build the project from source.
src/main.zig+19-4
......@@ -5,9 +5,6 @@ pub const build_options = @import("build_options");
55const zigmod = @import("zigmod");
66const win32 = @import("win32");
77
8pub const u = @import("./util/index.zig");
9pub const common = @import("./common.zig");
10
118//
129//
1310
......@@ -61,9 +58,27 @@ pub fn main() !void {
6158 const result = std.ChildProcess.exec(.{ .allocator = gpa, .argv = sub_cmd_args.items }) catch |e| switch (e) {
6259 else => |ee| return ee,
6360 error.FileNotFound => {
64 u.fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]});
61 fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]});
6562 },
6663 };
6764 try std.io.getStdOut().writeAll(result.stdout);
6865 try std.io.getStdErr().writeAll(result.stderr);
6966}
67
68//
69//
70
71const ansi_red = "\x1B[31m";
72const ansi_reset = "\x1B[39m";
73
74pub fn assert(ok: bool, comptime fmt: string, args: anytype) void {
75 if (!ok) {
76 std.debug.print(ansi_red ++ fmt ++ ansi_reset ++ "\n", args);
77 std.os.exit(1);
78 }
79}
80
81pub fn fail(comptime fmt: string, args: anytype) noreturn {
82 assert(false, fmt, args);
83 unreachable;
84}
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.874+40ed6ae84
6min_zig_version: 0.11.0-dev.1570+693b12f8e
77dependencies:
88 - src: git https://gist.github.com/nektro/d468fea84f8217e4c26ee8fbeeea38cc # yaml
99 - src: git https://github.com/nektro/zig-ansi