build: enable frame pointers in release safe

These are by default only enabled for debug builds but give a higher
chance of getting a usable stack trace out of bug reports as Zig's
builtin stack trace dumping code doesn't handle their absence well in
all cases yet. The cost should be negligible as river is not CPU-bound.
This commit is contained in:
Isaac Freund 2024-03-07 16:28:00 +01:00
parent 726ee2e7ca
commit 50d4f25eee
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -19,6 +19,11 @@ pub fn build(b: *Build) !void {
const strip = b.option(bool, "strip", "Omit debug information") orelse false;
const pie = b.option(bool, "pie", "Build a Position Independent Executable") orelse false;
const omit_frame_pointer = switch (optimize) {
.Debug, .ReleaseSafe => false,
.ReleaseFast, .ReleaseSmall => true,
};
const man_pages = b.option(
bool,
"man-pages",
@ -180,6 +185,7 @@ pub fn build(b: *Build) !void {
river.strip = strip;
river.pie = pie;
river.omit_frame_pointer = omit_frame_pointer;
b.installArtifact(river);
}
@ -202,6 +208,7 @@ pub fn build(b: *Build) !void {
riverctl.strip = strip;
riverctl.pie = pie;
riverctl.omit_frame_pointer = omit_frame_pointer;
b.installArtifact(riverctl);
}
@ -224,6 +231,7 @@ pub fn build(b: *Build) !void {
rivertile.strip = strip;
rivertile.pie = pie;
rivertile.omit_frame_pointer = omit_frame_pointer;
b.installArtifact(rivertile);
}