mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-15 02:08:40 -09:00
build.zig: add option for building PIE
Might be useful for package maintainers. Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
This commit is contained in:
parent
e6cfacfa06
commit
0d99781c67
1 changed files with 4 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
|
const pie = b.option(bool, "pie", "Build with PIE support (by default false)") orelse false;
|
||||||
|
|
||||||
const exe = b.addExecutable("ncdu", "src/main.zig");
|
const exe = b.addExecutable("ncdu", "src/main.zig");
|
||||||
exe.setTarget(target);
|
exe.setTarget(target);
|
||||||
exe.setBuildMode(mode);
|
exe.setBuildMode(mode);
|
||||||
|
|
@ -18,6 +20,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
exe.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
exe.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
exe.linkSystemLibrary("ncursesw");
|
exe.linkSystemLibrary("ncursesw");
|
||||||
|
exe.pie = pie;
|
||||||
exe.install();
|
exe.install();
|
||||||
|
|
||||||
const run_cmd = exe.run();
|
const run_cmd = exe.run();
|
||||||
|
|
@ -33,6 +36,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
tst.linkLibC();
|
tst.linkLibC();
|
||||||
tst.linkSystemLibrary("ncursesw");
|
tst.linkSystemLibrary("ncursesw");
|
||||||
tst.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
tst.addCSourceFile("src/ncurses_refs.c", &[_][]const u8{});
|
||||||
|
tst.pie = pie;
|
||||||
const tst_step = b.step("test", "Run tests");
|
const tst_step = b.step("test", "Run tests");
|
||||||
tst_step.dependOn(&tst.step);
|
tst_step.dependOn(&tst.step);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue