mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
use package manager for font stack
This commit is contained in:
156
build.zig
156
build.zig
@ -675,6 +675,26 @@ fn addDeps(
|
|||||||
.search_strategy = .mode_first,
|
.search_strategy = .mode_first,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
const freetype_dep = b.dependency("freetype", .{
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
});
|
||||||
|
const libpng_dep = b.dependency("libpng", .{
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
});
|
||||||
|
const zlib_dep = b.dependency("zlib", .{
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
});
|
||||||
|
const harfbuzz_dep = b.dependency("harfbuzz", .{
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
.@"enable-freetype" = true,
|
||||||
|
.@"enable-coretext" = font_backend.hasCoretext(),
|
||||||
|
});
|
||||||
|
|
||||||
// On Linux, we need to add a couple common library paths that aren't
|
// On Linux, we need to add a couple common library paths that aren't
|
||||||
// on the standard search list. i.e. GTK is often in /usr/lib/x86_64-linux-gnu
|
// on the standard search list. i.e. GTK is often in /usr/lib/x86_64-linux-gnu
|
||||||
// on x86_64.
|
// on x86_64.
|
||||||
@ -751,79 +771,93 @@ fn addDeps(
|
|||||||
|
|
||||||
// Other dependencies, we may dynamically link
|
// Other dependencies, we may dynamically link
|
||||||
if (static) {
|
if (static) {
|
||||||
const zlib_step = try zlib.link(b, step);
|
step.linkLibrary(zlib_dep.artifact("z"));
|
||||||
try static_libs.append(zlib_step.getEmittedBin());
|
try static_libs.append(zlib_dep.artifact("z").getEmittedBin());
|
||||||
|
|
||||||
const libpng_step = try libpng.link(b, step, .{
|
step.linkLibrary(libpng_dep.artifact("png"));
|
||||||
.zlib = .{
|
try static_libs.append(libpng_dep.artifact("png").getEmittedBin());
|
||||||
.step = zlib_step,
|
|
||||||
.include = &zlib.include_paths,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
try static_libs.append(libpng_step.getEmittedBin());
|
|
||||||
|
|
||||||
// Freetype
|
// Freetype
|
||||||
const freetype_step = try freetype.link(b, step, .{
|
step.linkLibrary(freetype_dep.artifact("freetype"));
|
||||||
.libpng = freetype.Options.Libpng{
|
try static_libs.append(freetype_dep.artifact("freetype").getEmittedBin());
|
||||||
.enabled = true,
|
|
||||||
.step = libpng_step,
|
|
||||||
.include = &libpng.include_paths,
|
|
||||||
},
|
|
||||||
|
|
||||||
.zlib = .{
|
|
||||||
.enabled = true,
|
|
||||||
.step = zlib_step,
|
|
||||||
.include = &zlib.include_paths,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
try static_libs.append(freetype_step.getEmittedBin());
|
|
||||||
|
|
||||||
// Harfbuzz
|
// Harfbuzz
|
||||||
const harfbuzz_step = try harfbuzz.link(b, step, .{
|
step.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
|
||||||
.freetype = .{
|
try static_libs.append(harfbuzz_dep.artifact("harfbuzz").getEmittedBin());
|
||||||
.enabled = true,
|
|
||||||
.step = freetype_step,
|
|
||||||
.include = &freetype.include_paths,
|
|
||||||
},
|
|
||||||
|
|
||||||
.coretext = .{
|
// const zlib_step = try zlib.link(b, step);
|
||||||
.enabled = font_backend.hasCoretext(),
|
// try static_libs.append(zlib_step.getEmittedBin());
|
||||||
},
|
//
|
||||||
});
|
// const libpng_step = try libpng.link(b, step, .{
|
||||||
system_sdk.include(b, harfbuzz_step, .{});
|
// .zlib = .{
|
||||||
try static_libs.append(harfbuzz_step.getEmittedBin());
|
// .step = zlib_step,
|
||||||
|
// .include = &zlib.include_paths,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// try static_libs.append(libpng_step.getEmittedBin());
|
||||||
|
//
|
||||||
|
// // Freetype
|
||||||
|
// const freetype_step = try freetype.link(b, step, .{
|
||||||
|
// .libpng = freetype.Options.Libpng{
|
||||||
|
// .enabled = true,
|
||||||
|
// .step = libpng_step,
|
||||||
|
// .include = &libpng.include_paths,
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// .zlib = .{
|
||||||
|
// .enabled = true,
|
||||||
|
// .step = zlib_step,
|
||||||
|
// .include = &zlib.include_paths,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// try static_libs.append(freetype_step.getEmittedBin());
|
||||||
|
//
|
||||||
|
// // Harfbuzz
|
||||||
|
// const harfbuzz_step = try harfbuzz.link(b, step, .{
|
||||||
|
// .freetype = .{
|
||||||
|
// .enabled = true,
|
||||||
|
// .step = freetype_step,
|
||||||
|
// .include = &freetype.include_paths,
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// .coretext = .{
|
||||||
|
// .enabled = font_backend.hasCoretext(),
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// system_sdk.include(b, harfbuzz_step, .{});
|
||||||
|
// try static_libs.append(harfbuzz_step.getEmittedBin());
|
||||||
|
|
||||||
// Pixman
|
// Pixman
|
||||||
const pixman_step = try pixman.link(b, step, .{});
|
const pixman_step = try pixman.link(b, step, .{});
|
||||||
try static_libs.append(pixman_step.getEmittedBin());
|
try static_libs.append(pixman_step.getEmittedBin());
|
||||||
|
|
||||||
// Only Linux gets fontconfig
|
// Only Linux gets fontconfig
|
||||||
if (font_backend.hasFontconfig()) {
|
// if (font_backend.hasFontconfig()) {
|
||||||
// Libxml2
|
// // Libxml2
|
||||||
const libxml2_lib = try libxml2.create(
|
// const libxml2_lib = try libxml2.create(
|
||||||
b,
|
// b,
|
||||||
step.target,
|
// step.target,
|
||||||
step.optimize,
|
// step.optimize,
|
||||||
.{
|
// .{
|
||||||
.lzma = false,
|
// .lzma = false,
|
||||||
.zlib = false,
|
// .zlib = false,
|
||||||
.iconv = !step.target.isWindows(),
|
// .iconv = !step.target.isWindows(),
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
libxml2_lib.link(step);
|
// libxml2_lib.link(step);
|
||||||
|
//
|
||||||
// Fontconfig
|
// // Fontconfig
|
||||||
const fontconfig_step = try fontconfig.link(b, step, .{
|
// const fontconfig_step = try fontconfig.link(b, step, .{
|
||||||
.freetype = .{
|
// .freetype = .{
|
||||||
.enabled = true,
|
// .enabled = true,
|
||||||
.step = freetype_step,
|
// .step = freetype_step,
|
||||||
.include = &freetype.include_paths,
|
// .include = &freetype.include_paths,
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
.libxml2 = true,
|
// .libxml2 = true,
|
||||||
});
|
// });
|
||||||
libxml2_lib.link(fontconfig_step);
|
// libxml2_lib.link(fontconfig_step);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lib) {
|
if (!lib) {
|
||||||
|
@ -42,10 +42,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
"-DHAVE_FT_DONE_MM_VAR=1",
|
"-DHAVE_FT_DONE_MM_VAR=1",
|
||||||
"-DHAVE_FT_GET_TRANSFORM=1",
|
"-DHAVE_FT_GET_TRANSFORM=1",
|
||||||
});
|
});
|
||||||
if (coretext_enabled) {
|
if (coretext_enabled) try flags.appendSlice(&.{"-DHAVE_CORETEXT=1"});
|
||||||
try flags.appendSlice(&.{"-DHAVE_CORETEXT=1"});
|
|
||||||
lib.linkFramework("ApplicationServices");
|
|
||||||
}
|
|
||||||
|
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = .{ .path = upstream_root ++ "/src/harfbuzz.cc" },
|
.file = .{ .path = upstream_root ++ "/src/harfbuzz.cc" },
|
||||||
|
Reference in New Issue
Block a user