Update for Zig-nightly

This commit is contained in:
Frank Denis
2025-12-08 15:41:34 +01:00
parent 468646cef2
commit 92d7fb9657
+10 -10
View File
@@ -7,8 +7,9 @@ const Compile = std.Build.Step.Compile;
const Target = std.Target; const Target = std.Target;
fn initLibConfig(b: *std.Build, target: std.Build.ResolvedTarget, lib: *Compile) void { fn initLibConfig(b: *std.Build, target: std.Build.ResolvedTarget, lib: *Compile) void {
lib.linkLibC(); lib.root_module.link_libc = true;
lib.addIncludePath(b.path("src/libsodium/include/sodium")); lib.lto = null;
lib.root_module.addIncludePath(b.path("src/libsodium/include/sodium"));
lib.root_module.addCMacro("_GNU_SOURCE", "1"); lib.root_module.addCMacro("_GNU_SOURCE", "1");
lib.root_module.addCMacro("CONFIGURED", "1"); lib.root_module.addCMacro("CONFIGURED", "1");
lib.root_module.addCMacro("DEV_MODE", "1"); lib.root_module.addCMacro("DEV_MODE", "1");
@@ -20,7 +21,6 @@ fn initLibConfig(b: *std.Build, target: std.Build.ResolvedTarget, lib: *Compile)
lib.root_module.addCMacro("HAVE_INTTYPES_H", "1"); lib.root_module.addCMacro("HAVE_INTTYPES_H", "1");
lib.root_module.addCMacro("HAVE_STDINT_H", "1"); lib.root_module.addCMacro("HAVE_STDINT_H", "1");
lib.root_module.addCMacro("HAVE_TI_MODE", "1"); lib.root_module.addCMacro("HAVE_TI_MODE", "1");
lib.want_lto = false;
const endian = target.result.cpu.arch.endian(); const endian = target.result.cpu.arch.endian();
switch (endian) { switch (endian) {
@@ -242,13 +242,13 @@ pub fn build(b: *std.Build) !void {
if (mem.endsWith(u8, name, ".c")) { if (mem.endsWith(u8, name, ".c")) {
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path }); const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path });
lib.addCSourceFiles(.{ lib.root_module.addCSourceFiles(.{
.files = &.{full_path}, .files = &.{full_path},
.flags = flags, .flags = flags,
}); });
} else if (mem.endsWith(u8, name, ".S")) { } else if (mem.endsWith(u8, name, ".S")) {
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path }); const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ src_path, entry.path });
lib.addAssemblyFile(b.path(full_path)); lib.root_module.addAssemblyFile(b.path(full_path));
} }
} }
} }
@@ -281,14 +281,14 @@ pub fn build(b: *std.Build) !void {
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.strip = true, .strip = true,
.link_libc = true,
}), }),
}); });
exe.linkLibC(); exe.root_module.linkLibrary(static_lib);
exe.linkLibrary(static_lib); exe.root_module.addIncludePath(b.path("src/libsodium/include"));
exe.addIncludePath(b.path("src/libsodium/include")); exe.root_module.addIncludePath(b.path("test/quirks"));
exe.addIncludePath(b.path("test/quirks"));
const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ test_path, entry.path }); const full_path = try fmt.allocPrint(allocator, "{s}/{s}", .{ test_path, entry.path });
exe.addCSourceFiles(.{ .files = &.{full_path} }); exe.root_module.addCSourceFiles(.{ .files = &.{full_path} });
if (enable_benchmarks) { if (enable_benchmarks) {
exe.root_module.addCMacro("BENCHMARKS", "1"); exe.root_module.addCMacro("BENCHMARKS", "1");
var buf: [16]u8 = undefined; var buf: [16]u8 = undefined;