| ... | ... | @@ -61,7 +61,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 61 | 61 | \\ var urlpath = url; |
| 62 | 62 | \\ urlpath = trimPrefix(u8, urlpath, "https://"); |
| 63 | 63 | \\ urlpath = trimPrefix(u8, urlpath, "git://"); |
| 64 | | \\ const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root, urlpath, commit }); |
| 64 | \\ const repopath = b.fmt("{s}/zigmod/deps/git/{s}/{s}", .{ b.cache_root.path.?, urlpath, commit }); |
| 65 | 65 | \\ flip(std.fs.cwd().access(repopath, .{})) catch return result; |
| 66 | 66 | \\ |
| 67 | 67 | \\ var clonestep = std.build.RunStep.create(b, "clone"); |
| ... | ... | @@ -86,7 +86,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 86 | 86 | \\ const b = exe.builder; |
| 87 | 87 | \\ inline for (comptime std.meta.declarations(package_data)) |decl| { |
| 88 | 88 | \\ const path = &@field(package_data, decl.name).entry; |
| 89 | | \\ const root = if (@field(package_data, decl.name).store) |_| b.cache_root else "."; |
| 89 | \\ const root = if (@field(package_data, decl.name).store) |_| b.cache_root.path.? else "."; |
| 90 | 90 | \\ if (path.* != null) path.* = b.fmt("{s}/zigmod/deps{s}", .{ root, path.*.? }); |
| 91 | 91 | \\ } |
| 92 | 92 | \\ |
| ... | ... | @@ -129,7 +129,7 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 129 | 129 | \\ var vcpkg = false; |
| 130 | 130 | \\ inline for (comptime std.meta.declarations(package_data)) |decl| { |
| 131 | 131 | \\ const pkg = @as(Package, @field(package_data, decl.name)); |
| 132 | | \\ const root = if (pkg.store) |st| b.fmt("{s}/zigmod/deps/{s}", .{ b.cache_root, st }) else "."; |
| 132 | \\ const root = if (pkg.store) |st| b.fmt("{s}/zigmod/deps/{s}", .{ b.cache_root.path.?, st }) else "."; |
| 133 | 133 | \\ for (pkg.system_libs) |item| { |
| 134 | 134 | \\ exe.linkSystemLibrary(item); |
| 135 | 135 | \\ llc = true; |
| ... | ... | @@ -164,19 +164,25 @@ pub fn create_depszig(alloc: std.mem.Allocator, cachepath: string, dir: std.fs.D |
| 164 | 164 | \\ system_libs: []const string = &.{}, |
| 165 | 165 | \\ frameworks: []const string = &.{}, |
| 166 | 166 | \\ vcpkg: bool = false, |
| 167 | \\ module: ?ModuleDependency = null, |
| 167 | 168 | \\ |
| 168 | | \\ pub fn zp(self: *const Package, b: *std.build.Builder) ModuleDependency { |
| 169 | \\ pub fn zp(self: *Package, b: *std.build.Builder) ModuleDependency { |
| 169 | 170 | \\ var temp: [100]ModuleDependency = undefined; |
| 170 | 171 | \\ for (self.deps, 0..) |item, i| { |
| 171 | 172 | \\ temp[i] = item.zp(b); |
| 172 | 173 | \\ } |
| 173 | | \\ return .{ |
| 174 | \\ if (self.module) |mod| { |
| 175 | \\ return mod; |
| 176 | \\ } |
| 177 | \\ const result = ModuleDependency{ |
| 174 | 178 | \\ .name = self.name, |
| 175 | 179 | \\ .module = b.createModule(.{ |
| 176 | 180 | \\ .source_file = .{ .path = self.entry.? }, |
| 177 | 181 | \\ .dependencies = b.allocator.dupe(ModuleDependency, temp[0..self.deps.len]) catch @panic("oom"), |
| 178 | 182 | \\ }), |
| 179 | 183 | \\ }; |
| 184 | \\ self.module = result; |
| 185 | \\ return result; |
| 180 | 186 | \\ } |
| 181 | 187 | \\}; |
| 182 | 188 | \\ |
| ... | ... | @@ -229,7 +235,7 @@ fn print_dirs(w: std.fs.File.Writer, list: []const zigmod.Module) !void { |
| 229 | 235 | } |
| 230 | 236 | |
| 231 | 237 | fn print_deps(w: std.fs.File.Writer, m: zigmod.Module) !void { |
| 232 | | try w.writeAll("[_]*const Package{\n"); |
| 238 | try w.writeAll("[_]*Package{\n"); |
| 233 | 239 | for (m.deps) |d| { |
| 234 | 240 | if (d.main.len == 0) { |
| 235 | 241 | continue; |