Skip to content

Commit

Permalink
Replace .{ .path= ...} with b.path()
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed May 9, 2024
1 parent 25be123 commit 75f5683
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const mem = std.mem;
const Compile = std.Build.Step.Compile;
const Target = std.Target;

fn initLibConfig(target: std.Build.ResolvedTarget, lib: *Compile) void {
fn initLibConfig(b: *std.Build, target: std.Build.ResolvedTarget, lib: *Compile) void {
lib.linkLibC();
lib.addIncludePath(.{ .path = "src/libsodium/include/sodium" });
lib.addIncludePath(b.path("src/libsodium/include/sodium"));
lib.defineCMacro("_GNU_SOURCE", "1");
lib.defineCMacro("CONFIGURED", "1");
lib.defineCMacro("DEV_MODE", "1");
Expand Down Expand Up @@ -201,10 +201,10 @@ pub fn build(b: *std.Build) !void {

for (libs.items) |lib| {
b.installArtifact(lib);
lib.installHeader(.{ .path = src_path ++ "/include/sodium.h" }, "sodium.h");
lib.installHeadersDirectory(.{ .path = src_path ++ "/include/sodium" }, "sodium", .{});
lib.installHeader(b.path(src_path ++ "/include/sodium.h"), "sodium.h");
lib.installHeadersDirectory(b.path(src_path ++ "/include/sodium"), "sodium", .{});

initLibConfig(target, lib);
initLibConfig(b, target, lib);

const flags = &.{
"-fvisibility=hidden",
Expand All @@ -228,7 +228,7 @@ pub fn build(b: *std.Build) !void {
});
} else if (mem.endsWith(u8, name, ".S")) {
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path });
lib.addAssemblyFile(.{ .path = full_path });
lib.addAssemblyFile(b.path(full_path));
}
}
}
Expand Down Expand Up @@ -260,8 +260,8 @@ pub fn build(b: *std.Build) !void {
});
exe.linkLibC();
exe.linkLibrary(static_lib);
exe.addIncludePath(.{ .path = "src/libsodium/include" });
exe.addIncludePath(.{ .path = "test/quirks" });
exe.addIncludePath(b.path("src/libsodium/include"));
exe.addIncludePath(b.path("test/quirks"));
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ test_path, entry.path });
exe.addCSourceFiles(.{ .files = &.{full_path} });
if (enable_benchmarks) {
Expand Down

0 comments on commit 75f5683

Please sign in to comment.