build.zig: update to Zig 0.12.0-dev.2018+9a56228c2

* ZBS was reorganized around `Module` struct:
 https://www.github.com/ziglang/zig/pull/18160 .
 * Changes for ReleaseSafe: error return tracing is now off by default.

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
This commit is contained in:
Eric Joldasov 2024-01-03 19:35:20 +06:00
parent 1fa40ae498
commit c41e3f5828
No known key found for this signature in database
GPG key ID: 5C9C69060686B588

View file

@ -5,6 +5,8 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const t = target.result;
const optimize = b.standardOptimizeOption(.{});
const pie = b.option(bool, "pie", "Build with PIE support (by default false)") orelse false;
@ -14,15 +16,16 @@ pub fn build(b: *std.Build) void {
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
.link_libc = true,
});
exe.pie = pie;
exe.root_module.linkSystemLibrary("ncursesw", .{});
// https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554
if (exe.target.isDarwin()) {
if (t.isDarwin()) {
// useful for package maintainers
exe.headerpad_max_install_names = true;
}
linkNcurses(exe);
exe.pie = pie;
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
@ -38,17 +41,13 @@ pub fn build(b: *std.Build) void {
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
.link_libc = true,
});
linkNcurses(unit_tests);
unit_tests.pie = pie;
unit_tests.root_module.linkSystemLibrary("ncursesw", .{});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}
pub fn linkNcurses(compile_step: *std.Build.CompileStep) void {
compile_step.linkSystemLibrary("ncursesw");
compile_step.linkLibC();
}