summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig19
1 files changed, 12 insertions, 7 deletions
diff --git a/build.zig b/build.zig
index 2c8a8858..3b57fff6 100644
--- a/build.zig
+++ b/build.zig
@@ -418,12 +418,22 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/c_heap.zig"),
});
+ // One FreeType in a binary: the gui's glyph atlas links it and MuPDF is
+ // built against it (see mupdf.zig). At c_optimize with the rest of the
+ // vendored C, since MuPDF rasterizes a PDF's text through it.
+ const freetype: ?*std.Build.Step.Compile = if (freestanding_core) null else b.dependency("freetype", .{
+ .target = target,
+ .optimize = c_optimize,
+ .@"enable-libpng" = false,
+ }).artifact("freetype");
+
if (enable_mupdf) {
if (b.lazyDependency("mupdf", .{})) |mupdf_dep| {
const mupdf = mupdf_build.add(b, io, mupdf_dep, .{
.target = target,
.optimize = c_optimize,
.jpx = enable_jpx,
+ .freetype = freetype.?,
});
const mupdf_mod = b.createModule(.{
.target = target,
@@ -647,12 +657,7 @@ pub fn build(b: *std.Build) void {
gm.linkLibrary(sdl_lib);
gm.addIncludePath(dep.path("include"));
}
- const freetype_dep = b.dependency("freetype", .{
- .target = target,
- .optimize = optimize,
- .@"enable-libpng" = false,
- });
- gm.linkLibrary(freetype_dep.artifact("freetype"));
+ gm.linkLibrary(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,
@@ -669,7 +674,7 @@ pub fn build(b: *std.Build) void {
.link_libcpp = true,
}),
});
- harfbuzz.root_module.linkLibrary(freetype_dep.artifact("freetype"));
+ harfbuzz.root_module.linkLibrary(freetype.?);
harfbuzz.root_module.addIncludePath(upstream.path("src"));
harfbuzz.root_module.addCSourceFile(.{
.file = upstream.path("src/harfbuzz.cc"),