ghostty/src/build/UnicodeTables.zig
Mitchell Hashimoto 3d2bc3dca1 build: add unwind tables and frame pointers to debug/test builds
This fixes an issue where stack traces were unreliable on some platforms
(namely aarch64-linux in a MacOS VM). I'm unsure if this is a bug in Zig
(defaults should be changed?) or what, because this isn't necessary on
other platforms, but this works around the issue.

I've unconditionally enabled this for all platforms, depending on build
mode (debug/test) and not the target. This is because I don't think
there is a downside for other platforms but if thats wrong we can fix
that quickly.

Some binaries have this unconditionally enabled regardless of build mode
(e.g. the Unicode tables generator) because having symbols in those
cases is always useful.

Some unrelated GTK test fix is also included here. I'm not sure why CI
didn't catch this (perhaps we only run tests for none-runtime) but all
tests pass locally and we can look into that elsewhere.
2025-05-19 17:12:39 -07:00

52 lines
1.3 KiB
Zig

const UnicodeTables = @This();
const std = @import("std");
const Config = @import("Config.zig");
/// The exe.
exe: *std.Build.Step.Compile,
/// The output path for the unicode tables
output: std.Build.LazyPath,
pub fn init(b: *std.Build) !UnicodeTables {
const exe = b.addExecutable(.{
.name = "unigen",
.root_module = b.createModule(.{
.root_source_file = b.path("src/unicode/props.zig"),
.target = b.graph.host,
.strip = false,
.omit_frame_pointer = false,
.unwind_tables = .sync,
}),
});
if (b.lazyDependency("ziglyph", .{
.target = b.graph.host,
})) |ziglyph_dep| {
exe.root_module.addImport(
"ziglyph",
ziglyph_dep.module("ziglyph"),
);
}
const run = b.addRunArtifact(exe);
return .{
.exe = exe,
.output = run.captureStdOut(),
};
}
/// Add the "unicode_tables" import.
pub fn addImport(self: *const UnicodeTables, step: *std.Build.Step.Compile) void {
self.output.addStepDependencies(&step.step);
step.root_module.addAnonymousImport("unicode_tables", .{
.root_source_file = self.output,
});
}
/// Install the exe
pub fn install(self: *const UnicodeTables, b: *std.Build) void {
b.installArtifact(self.exe);
}