summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig33
1 files changed, 33 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 7010c863..21df1555 100644
--- a/build.zig
+++ b/build.zig
@@ -642,6 +642,39 @@ pub fn build(b: *std.Build) void {
.@"enable-libpng" = false,
});
gm.linkLibrary(freetype_dep.artifact("freetype"));
+ // HarfBuzz from source, like FreeType: its FreeType integration
+ // (HAVE_FREETYPE, hb-ft) links the freetype artifact above, so the two
+ // share one FreeType. The flags are the ones Ghostty builds it with.
+ if (b.lazyDependency("harfbuzz", .{})) |upstream| {
+ const harfbuzz = b.addLibrary(.{
+ .name = "harfbuzz",
+ .linkage = .static,
+ .root_module = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ .link_libc = true,
+ .link_libcpp = true,
+ }),
+ });
+ harfbuzz.root_module.linkLibrary(freetype_dep.artifact("freetype"));
+ harfbuzz.root_module.addIncludePath(upstream.path("src"));
+ harfbuzz.root_module.addCSourceFile(.{
+ .file = upstream.path("src/harfbuzz.cc"),
+ .flags = &.{
+ "-DHAVE_STDBOOL_H",
+ "-DHAVE_UNISTD_H",
+ "-DHAVE_SYS_MMAN_H",
+ "-DHAVE_PTHREAD=1",
+ "-DHAVE_FREETYPE=1",
+ "-DHAVE_FT_GET_VAR_BLEND_COORDINATES=1",
+ "-DHAVE_FT_SET_VAR_BLEND_COORDINATES=1",
+ "-DHAVE_FT_DONE_MM_VAR=1",
+ "-DHAVE_FT_GET_TRANSFORM=1",
+ },
+ });
+ gm.linkLibrary(harfbuzz);
+ gm.addIncludePath(upstream.path("src"));
+ }
if (target.result.os.tag.isDarwin())
gm.addRPath(.{ .cwd_relative = "/usr/local/lib" });
gm.addIncludePath(b.path("src/gui"));