| author | |
| committer | |
| log | 046eb90846a97391398a469bad3e0bf37c96c700 |
| tree | 7283684a111ebcba098cb08774de08ad37494097 |
| parent | be789458ab55d45d818c1eee30bf99a9ab4ff755 |
9 files changed, 35 insertions(+), 24 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.1898+1a4a0b5e9" | |
| 29 | version: "0.11.0-dev.2777+b95cdf0ae" | |
| 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.1898+1a4a0b5e9" | |
| 22 | version: "0.11.0-dev.2777+b95cdf0ae" | |
| 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.1898+1a4a0b5e9`) | |
| 20 | - Zig master (at least `0.11.0-dev.2777+b95cdf0ae`) | |
| 21 | 21 | - See [`zig.mod`](./zig.mod) and [`zigmod.lock`](./zigmod.lock) |
| 22 | 22 | |
| 23 | 23 | ### Build from Source |
build.zig+2-3| ... | ... | @@ -4,7 +4,6 @@ const builtin = @import("builtin"); |
| 4 | 4 | const deps = @import("./deps.zig"); |
| 5 | 5 | |
| 6 | 6 | pub fn build(b: *std.build.Builder) void { |
| 7 | b.prominent_compile_errors = true; | |
| 8 | 7 | const target = b.standardTargetOptions(.{}); |
| 9 | 8 | const optimize = b.standardOptimizeOption(.{}); |
| 10 | 9 | const use_full_name = b.option(bool, "use-full-name", "") orelse false; |
| ... | ... | @@ -17,9 +16,9 @@ pub fn build(b: *std.build.Builder) void { |
| 17 | 16 | exe_options.addOption(string, "version", b.option(string, "tag", "") orelse "dev"); |
| 18 | 17 | |
| 19 | 18 | deps.addAllTo(exe); |
| 20 | exe.install(); | |
| 19 | b.installArtifact(exe); | |
| 21 | 20 | |
| 22 | const run_cmd = exe.run(); | |
| 21 | const run_cmd = b.addRunArtifact(exe); | |
| 23 | 22 | run_cmd.step.dependOn(b.getInstallStep()); |
| 24 | 23 | if (b.args) |args| { |
| 25 | 24 | run_cmd.addArgs(args); |
deps.zig+13-7| ... | ... | @@ -13,7 +13,12 @@ pub const GitExactStep = struct { |
| 13 | 13 | pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep { |
| 14 | 14 | var result = b.allocator.create(GitExactStep) catch @panic("memory"); |
| 15 | 15 | 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 | }), | |
| 17 | 22 | .builder = b, |
| 18 | 23 | .url = url, |
| 19 | 24 | .commit = commit, |
| ... | ... | @@ -36,13 +41,14 @@ pub const GitExactStep = struct { |
| 36 | 41 | return result; |
| 37 | 42 | } |
| 38 | 43 | |
| 39 | fn make(step: *std.build.Step) !void { | |
| 44 | fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { | |
| 40 | 45 | _ = step; |
| 46 | _ = prog_node; | |
| 41 | 47 | } |
| 42 | 48 | }; |
| 43 | 49 | |
| 44 | 50 | pub fn fetch(exe: *std.build.LibExeObjStep) void { |
| 45 | const b = exe.builder; | |
| 51 | const b = exe.step.owner; | |
| 46 | 52 | inline for (comptime std.meta.declarations(package_data)) |decl| { |
| 47 | 53 | const path = &@field(package_data, decl.name).entry; |
| 48 | 54 | const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; |
| ... | ... | @@ -84,7 +90,7 @@ fn flip(foo: anytype) !void { |
| 84 | 90 | pub fn addAllTo(exe: *std.build.LibExeObjStep) void { |
| 85 | 91 | checkMinZig(builtin.zig_version, exe); |
| 86 | 92 | fetch(exe); |
| 87 | const b = exe.builder; | |
| 93 | const b = exe.step.owner; | |
| 88 | 94 | @setEvalBranchQuota(1_000_000); |
| 89 | 95 | for (packages) |pkg| { |
| 90 | 96 | const moddep = pkg.zp(b); |
| ... | ... | @@ -100,7 +106,7 @@ pub fn addAllTo(exe: *std.build.LibExeObjStep) void { |
| 100 | 106 | llc = true; |
| 101 | 107 | } |
| 102 | 108 | 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})); | |
| 104 | 110 | exe.linkFramework(item); |
| 105 | 111 | llc = true; |
| 106 | 112 | } |
| ... | ... | @@ -152,8 +158,8 @@ pub const Package = struct { |
| 152 | 158 | }; |
| 153 | 159 | |
| 154 | 160 | fn 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})); | |
| 157 | 163 | } |
| 158 | 164 | |
| 159 | 165 | pub 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. |
| 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.1898+1a4a0b5e9`. | |
| 13 | The earliest Zig release this Zigmod was verified to work with is `0.11.0-dev.2777+b95cdf0ae`. | |
| 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/cmd/fetch.zig+3-3| ... | ... | @@ -49,7 +49,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 49 | 49 | try w.writeAll( |
| 50 | 50 | \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void { |
| 51 | 51 | \\ checkMinZig(builtin.zig_version, exe); |
| 52 | \\ const b = exe.builder; | |
| 52 | \\ const b = exe.step.owner; | |
| 53 | 53 | \\ @setEvalBranchQuota(1_000_000); |
| 54 | 54 | \\ for (packages) |pkg| { |
| 55 | 55 | \\ const moddep = pkg.zp(b); |
| ... | ... | @@ -64,7 +64,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 64 | 64 | \\ llc = true; |
| 65 | 65 | \\ } |
| 66 | 66 | \\ 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})); | |
| 68 | 68 | \\ exe.linkFramework(item); |
| 69 | 69 | \\ llc = true; |
| 70 | 70 | \\ } |
| ... | ... | @@ -126,7 +126,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 126 | 126 | try w.print( |
| 127 | 127 | \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{ |
| 128 | 128 | \\ 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}})); | |
| 130 | 130 | \\}} |
| 131 | 131 | \\ |
| 132 | 132 | \\ |
src/cmd/generate.zig+12-6| ... | ... | @@ -52,7 +52,12 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 52 | 52 | \\ pub fn create(b: *std.build.Builder, url: string, commit: string) *GitExactStep { |
| 53 | 53 | \\ var result = b.allocator.create(GitExactStep) catch @panic("memory"); |
| 54 | 54 | \\ 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 | \\ }), | |
| 56 | 61 | \\ .builder = b, |
| 57 | 62 | \\ .url = url, |
| 58 | 63 | \\ .commit = commit, |
| ... | ... | @@ -77,13 +82,14 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 77 | 82 | \\ return result; |
| 78 | 83 | \\ } |
| 79 | 84 | \\ |
| 80 | \\ fn make(step: *std.build.Step) !void { | |
| 85 | \\ fn make(step: *std.build.Step, prog_node: *std.Progress.Node) !void { | |
| 81 | 86 | \\ _ = step; |
| 87 | \\ _ = prog_node; | |
| 82 | 88 | \\ } |
| 83 | 89 | \\}; |
| 84 | 90 | \\ |
| 85 | 91 | \\pub fn fetch(exe: *std.build.LibExeObjStep) void { |
| 86 | \\ const b = exe.builder; | |
| 92 | \\ const b = exe.step.owner; | |
| 87 | 93 | \\ inline for (comptime std.meta.declarations(package_data)) |decl| { |
| 88 | 94 | \\ const path = &@field(package_data, decl.name).entry; |
| 89 | 95 | \\ 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 |
| 119 | 125 | \\pub fn addAllTo(exe: *std.build.LibExeObjStep) void { |
| 120 | 126 | \\ checkMinZig(builtin.zig_version, exe); |
| 121 | 127 | \\ fetch(exe); |
| 122 | \\ const b = exe.builder; | |
| 128 | \\ const b = exe.step.owner; | |
| 123 | 129 | \\ @setEvalBranchQuota(1_000_000); |
| 124 | 130 | \\ for (packages) |pkg| { |
| 125 | 131 | \\ const moddep = pkg.zp(b); |
| ... | ... | @@ -135,7 +141,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 135 | 141 | \\ llc = true; |
| 136 | 142 | \\ } |
| 137 | 143 | \\ 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})); | |
| 139 | 145 | \\ exe.linkFramework(item); |
| 140 | 146 | \\ llc = true; |
| 141 | 147 | \\ } |
| ... | ... | @@ -192,7 +198,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 192 | 198 | try w.print( |
| 193 | 199 | \\fn checkMinZig(current: std.SemanticVersion, exe: *std.build.LibExeObjStep) void {{ |
| 194 | 200 | \\ 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}})); | |
| 196 | 202 | \\}} |
| 197 | 203 | \\ |
| 198 | 204 | \\ |
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.1898+1a4a0b5e9 | |
| 6 | min_zig_version: 0.11.0-dev.2777+b95cdf0ae | |
| 7 | 7 | dependencies: |
| 8 | 8 | - src: git https://github.com/nektro/zig-yaml |
| 9 | 9 | - src: git https://github.com/nektro/zig-ansi |