From 8aef0181829ff5c87468add66ed07d1a65982867 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 12 Aug 2023 11:21:37 +0200 Subject: [PATCH] Update for Zig 0.11 --- README.md | 2 +- build.zig | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23f6196..95ea170 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Dependencies: Compilation: - $ zig build -Drelease-safe + $ zig build -Drelease ## Using cmake and gcc or clang: diff --git a/build.zig b/build.zig index afa2612..1e87e11 100644 --- a/build.zig +++ b/build.zig @@ -1,21 +1,24 @@ const std = @import("std"); pub fn build(b: *std.build.Builder) !void { - var target = b.standardTargetOptions(.{}); - const mode = b.standardReleaseOptions(); + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSmall }); - const minisign = b.addExecutable("minisign", null); - minisign.setTarget(target); - minisign.setBuildMode(mode); - minisign.install(); + const minisign = b.addExecutable(.{ + .name = "minisign", + .target = target, + .optimize = optimize, + }); minisign.linkLibC(); - minisign.addLibraryPath("/opt/homebrew/lib"); - minisign.addLibraryPath("/usr/local/lib"); + minisign.addLibraryPath(.{ .path = "/opt/homebrew/lib" }); + minisign.addLibraryPath(.{ .path = "/usr/local/lib" }); minisign.linkSystemLibrary("sodium"); - minisign.addIncludePath("src"); - minisign.addSystemIncludePath("/opt/homebrew/include"); - minisign.addSystemIncludePath("/usr/local/include"); + minisign.addIncludePath(.{ .path = "src" }); + minisign.addSystemIncludePath(.{ .path = "/opt/homebrew/include" }); + minisign.addSystemIncludePath(.{ .path = "/usr/local/include" }); minisign.defineCMacro("_GNU_SOURCE", "1"); minisign.addCSourceFiles(&.{ "src/base64.c", "src/get_line.c", "src/helpers.c", "src/minisign.c" }, &.{}); + + b.installArtifact(minisign); }