From b81ab0783e084b92af870c464f2f56263632016c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 31 Jul 2026 17:23:45 +0200 Subject: [PATCH] Update for zig-current Keep compat with previous version for now Fixes #1551 --- build.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 9ffb64e3..4081401e 100644 --- a/build.zig +++ b/build.zig @@ -186,6 +186,8 @@ pub fn build(b: *std.Build) !void { var target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); + const debug_mode: @TypeOf(optimize) = if (@hasField(@TypeOf(optimize), "debug")) .debug else .Debug; + const enable_benchmarks = b.option(bool, "enable_benchmarks", "Whether tests should be benchmarks.") orelse false; const benchmarks_iterations = b.option(u32, "iterations", "Number of iterations for benchmarks.") orelse 200; const wasm_max_memory = b.option(u64, "wasm_max_memory", "Maximum WebAssembly linear memory size in bytes.") orelse null; @@ -205,7 +207,7 @@ pub fn build(b: *std.Build) !void { .aarch64, .aarch64_be => { // ARM CPUs supported by Windows are assumed to have NEON support if (target.result.isMinGW()) { - target.query.cpu_features_add.addFeature(@intFromEnum(Target.aarch64.Feature.neon)); + target.query.cpu_features_add.addFeature(@backingInt(Target.aarch64.Feature.neon)); } }, else => {}, @@ -226,7 +228,7 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .target = target, .optimize = optimize, - .strip = optimize != .Debug and !target.result.isMinGW(), + .strip = optimize != debug_mode and !target.result.isMinGW(), }), }); @@ -334,7 +336,7 @@ pub fn build(b: *std.Build) !void { .root_module = b.createModule(.{ .target = target, .optimize = optimize, - .strip = optimize != .Debug, + .strip = optimize != debug_mode, .link_libc = true, }), }); @@ -371,7 +373,7 @@ pub fn build(b: *std.Build) !void { const translate_c = b.addTranslateC(.{ .root_source_file = b.path("src/libsodium/include/sodium.h"), .target = target, - .optimize = .Debug, + .optimize = debug_mode, .link_libc = true, }); translate_c.addIncludePath(b.path("src/libsodium/include"));