fix: make dependency path strings relative

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-12-15 03:42:56 -04:00
parent 6467fc25e7
commit 08bf0f9201
1 changed files with 7 additions and 2 deletions

View File

@ -1,18 +1,23 @@
const std = @import("std"); const std = @import("std");
fn path(comptime suffix: []const u8) []const u8 {
if (suffix[0] == '/') @compileError("expected a relative path");
return comptime (std.fs.path.dirname(@src().file) orelse ".") ++ std.fs.path.sep_str ++ suffix;
}
const pkgs = struct { const pkgs = struct {
const Pkg = std.build.Pkg; const Pkg = std.build.Pkg;
pub const gdbstub: Pkg = .{ pub const gdbstub: Pkg = .{
.name = "gdbstub", .name = "gdbstub",
.source = .{ .path = "src/lib.zig" }, .source = .{ .path = path("src/lib.zig") },
.dependencies = &[_]Pkg{network}, .dependencies = &[_]Pkg{network},
}; };
// https://github.com/MasterQ32/zig-network // https://github.com/MasterQ32/zig-network
pub const network: Pkg = .{ pub const network: Pkg = .{
.name = "network", .name = "network",
.source = .{ .path = "lib/zig-network/network.zig" }, .source = .{ .path = path("lib/zig-network/network.zig") },
}; };
}; };