mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
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:
parent
1fa40ae498
commit
c41e3f5828
1 changed files with 8 additions and 9 deletions
17
build.zig
17
build.zig
|
|
@ -5,6 +5,8 @@ const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const t = target.result;
|
||||||
|
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const pie = b.option(bool, "pie", "Build with PIE support (by default false)") orelse false;
|
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" },
|
.root_source_file = .{ .path = "src/main.zig" },
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exe.pie = pie;
|
||||||
|
exe.root_module.linkSystemLibrary("ncursesw", .{});
|
||||||
// https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554
|
// https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554
|
||||||
if (exe.target.isDarwin()) {
|
if (t.isDarwin()) {
|
||||||
// useful for package maintainers
|
// useful for package maintainers
|
||||||
exe.headerpad_max_install_names = true;
|
exe.headerpad_max_install_names = true;
|
||||||
}
|
}
|
||||||
linkNcurses(exe);
|
|
||||||
exe.pie = pie;
|
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(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" },
|
.root_source_file = .{ .path = "src/main.zig" },
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
linkNcurses(unit_tests);
|
|
||||||
unit_tests.pie = pie;
|
unit_tests.pie = pie;
|
||||||
|
unit_tests.root_module.linkSystemLibrary("ncursesw", .{});
|
||||||
|
|
||||||
const run_unit_tests = b.addRunArtifact(unit_tests);
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
||||||
|
|
||||||
const test_step = b.step("test", "Run unit tests");
|
const test_step = b.step("test", "Run unit tests");
|
||||||
test_step.dependOn(&run_unit_tests.step);
|
test_step.dependOn(&run_unit_tests.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn linkNcurses(compile_step: *std.Build.CompileStep) void {
|
|
||||||
compile_step.linkSystemLibrary("ncursesw");
|
|
||||||
compile_step.linkLibC();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue