| author | |
| committer | |
| log | cee55e13da2262f794f77e3848b2e564e58130b0 |
| tree | 51427daed6f1baa8354f2700f95771c0df9282e2 |
| parent | 827c27ef00d14468fde26506fd4999d96ce7c448 |
8 files changed, 41 insertions(+), 23 deletions(-)
.github/workflows/nightly.yml+1-1| ... | ... | @@ -26,7 +26,7 @@ jobs: |
| 26 | 26 | - name: Setup Zig |
| 27 | 27 | uses: goto-bus-stop/setup-zig@v1 |
| 28 | 28 | with: |
| 29 | version: "0.11.0-dev.874+40ed6ae84" | |
| 29 | version: "0.11.0-dev.1570+693b12f8e" | |
| 30 | 30 | |
| 31 | 31 | - run: zig version |
| 32 | 32 | - run: zig env |
.github/workflows/push.yml+1-1| ... | ... | @@ -19,7 +19,7 @@ jobs: |
| 19 | 19 | - name: Setup Zig |
| 20 | 20 | uses: goto-bus-stop/setup-zig@v1 |
| 21 | 21 | with: |
| 22 | version: "0.11.0-dev.874+40ed6ae84" | |
| 22 | version: "0.11.0-dev.1570+693b12f8e" | |
| 23 | 23 | |
| 24 | 24 | - run: zig version |
| 25 | 25 | - run: zig env |
README.md+1-1| ... | ... | @@ -17,7 +17,7 @@ A package manager for the Zig programming language. |
| 17 | 17 | - https://github.com/nektro/zigmod/releases |
| 18 | 18 | |
| 19 | 19 | ## Built With |
| 20 | - Zig master (at least `0.11.0-dev.874+40ed6ae84`) | |
| 20 | - Zig master (at least `0.11.0-dev.1570+693b12f8e`) | |
| 21 | 21 | - See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock) |
| 22 | 22 | |
| 23 | 23 | ### Build from Source |
build.zig+7-7| ... | ... | @@ -6,16 +6,16 @@ const deps = @import("./deps.zig"); |
| 6 | 6 | pub fn build(b: *std.build.Builder) void { |
| 7 | 7 | b.prominent_compile_errors = true; |
| 8 | 8 | const target = b.standardTargetOptions(.{}); |
| 9 | ||
| 10 | b.setPreferredReleaseMode(.ReleaseSafe); | |
| 11 | const mode = b.standardReleaseOptions(); | |
| 12 | ||
| 9 | const optimize = b.standardOptimizeOption(.{}); | |
| 13 | 10 | const use_full_name = b.option(bool, "use-full-name", "") orelse false; |
| 14 | 11 | const with_arch_os = b.fmt("-{s}-{s}", .{ @tagName(target.cpu_arch orelse builtin.cpu.arch), @tagName(target.os_tag orelse builtin.os.tag) }); |
| 15 | 12 | 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 | }); | |
| 19 | 19 | |
| 20 | 20 | const exe_options = b.addOptions(); |
| 21 | 21 | exe.addOptions("build_options", exe_options); |
deps.zig+10-7| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | // zig fmt: off |
| 2 | 2 | const std = @import("std"); |
| 3 | 3 | const builtin = @import("builtin"); |
| 4 | const Pkg = std.build.Pkg; | |
| 4 | const ModuleDependency = std.build.ModuleDependency; | |
| 5 | 5 | const string = []const u8; |
| 6 | 6 | |
| 7 | 7 | pub const GitExactStep = struct { |
| ... | ... | @@ -87,7 +87,8 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void { |
| 87 | 87 | const b = exe.builder; |
| 88 | 88 | @setEvalBranchQuota(1_000_000); |
| 89 | 89 | for (packages) |pkg| { |
| 90 | exe.addPackage(pkg.zp(b)); | |
| 90 | const moddep = pkg.zp(b); | |
| 91 | exe.addModule(moddep.name, moddep.module); | |
| 91 | 92 | } |
| 92 | 93 | var llc = false; |
| 93 | 94 | var vcpkg = false; |
| ... | ... | @@ -129,21 +130,23 @@ pub const Package = struct { |
| 129 | 130 | frameworks: []const string = &.{}, |
| 130 | 131 | vcpkg: bool = false, |
| 131 | 132 | |
| 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; | |
| 134 | 135 | for (self.deps) |item, i| { |
| 135 | 136 | temp[i] = item.zp(b); |
| 136 | 137 | } |
| 137 | 138 | return .{ |
| 138 | 139 | .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 | }), | |
| 141 | 144 | }; |
| 142 | 145 | } |
| 143 | 146 | }; |
| 144 | 147 | |
| 145 | 148 | fn 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; | |
| 147 | 150 | 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})); |
| 148 | 151 | } |
| 149 | 152 |
docs/README.md+1-1| ... | ... | @@ -10,7 +10,7 @@ The rest of this documentation will assume you already have Zig installed. |
| 10 | 10 | |
| 11 | 11 | As 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. |
| 12 | 12 | |
| 13 | The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.874+40ed6ae84`. | |
| 13 | The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.1570+693b12f8e`. | |
| 14 | 14 | |
| 15 | 15 | ## Download |
| 16 | 16 | You 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"); |
| 5 | 5 | const zigmod = @import("zigmod"); |
| 6 | 6 | const win32 = @import("win32"); |
| 7 | 7 | |
| 8 | pub const u = @import("./util/index.zig"); | |
| 9 | pub const common = @import("./common.zig"); | |
| 10 | ||
| 11 | 8 | // |
| 12 | 9 | // |
| 13 | 10 | |
| ... | ... | @@ -61,9 +58,27 @@ pub fn main() !void { |
| 61 | 58 | const result = std.ChildProcess.exec(.{ .allocator = gpa, .argv = sub_cmd_args.items }) catch |e| switch (e) { |
| 62 | 59 | else => |ee| return ee, |
| 63 | 60 | error.FileNotFound => { |
| 64 | u.fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]}); | |
| 61 | fail("unknown command \"{s}\" for \"zigmod\"", .{args[0]}); | |
| 65 | 62 | }, |
| 66 | 63 | }; |
| 67 | 64 | try std.io.getStdOut().writeAll(result.stdout); |
| 68 | 65 | try std.io.getStdErr().writeAll(result.stderr); |
| 69 | 66 | } |
| 67 | ||
| 68 | // | |
| 69 | // | |
| 70 | ||
| 71 | const ansi_red = "\x1B[31m"; | |
| 72 | const ansi_reset = "\x1B[39m"; | |
| 73 | ||
| 74 | pub 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 | ||
| 81 | pub 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 |
| 3 | 3 | main: src/lib.zig |
| 4 | 4 | license: MIT |
| 5 | 5 | description: A package manager for the Zig programming language. |
| 6 | min_zig_version: 0.11.0-dev.874+40ed6ae84 | |
| 6 | min_zig_version: 0.11.0-dev.1570+693b12f8e | |
| 7 | 7 | dependencies: |
| 8 | 8 | - src: git https://gist.github.com/nektro/d468fea84f8217e4c26ee8fbeeea38cc # yaml |
| 9 | 9 | - src: git https://github.com/nektro/zig-ansi |