mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-02 20:04:40 +00:00
freetype builds in png support, uses our own zlib
This commit is contained in:
@@ -16,11 +16,18 @@ fn thisDir() []const u8 {
|
||||
|
||||
pub const Options = struct {
|
||||
libpng: Libpng = .{},
|
||||
zlib: Zlib = .{},
|
||||
|
||||
pub const Libpng = struct {
|
||||
enabled: bool = false,
|
||||
step: ?*std.build.LibExeObjStep = null,
|
||||
include: ?[]const u8 = null,
|
||||
include: ?[]const []const u8 = null,
|
||||
};
|
||||
|
||||
pub const Zlib = struct {
|
||||
enabled: bool = false,
|
||||
step: ?*std.build.LibExeObjStep = null,
|
||||
include: ?[]const []const u8 = null,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -57,8 +64,17 @@ pub fn buildFreetype(
|
||||
else
|
||||
lib.linkSystemLibrary("libpng");
|
||||
|
||||
if (opt.libpng.include) |dir|
|
||||
lib.addIncludePath(dir);
|
||||
if (opt.libpng.include) |dirs|
|
||||
for (dirs) |dir| lib.addIncludePath(dir);
|
||||
}
|
||||
if (opt.zlib.enabled) {
|
||||
if (opt.zlib.step) |zlib|
|
||||
lib.linkLibrary(zlib)
|
||||
else
|
||||
lib.linkSystemLibrary("z");
|
||||
|
||||
if (opt.zlib.include) |dirs|
|
||||
for (dirs) |dir| lib.addIncludePath(dir);
|
||||
}
|
||||
|
||||
// Compile
|
||||
@@ -71,7 +87,8 @@ pub fn buildFreetype(
|
||||
"-DHAVE_UNISTD_H",
|
||||
"-DHAVE_FCNTL_H",
|
||||
});
|
||||
if (opt.libpng.enabled) try flags.append("-DFT_CONFIG_OPTION_USE_PNG");
|
||||
if (opt.libpng.enabled) try flags.append("-DFT_CONFIG_OPTION_USE_PNG=1");
|
||||
if (opt.zlib.enabled) try flags.append("-DFT_CONFIG_OPTION_SYSTEM_ZLIB=1");
|
||||
|
||||
// C files
|
||||
lib.addCSourceFiles(srcs, flags.items);
|
||||
|
||||
@@ -5,6 +5,8 @@ const root = thisDir() ++ "../../../vendor/libpng/";
|
||||
const include_path = root;
|
||||
const include_path_pnglibconf = thisDir();
|
||||
|
||||
pub const include_paths = .{ include_path, include_path_pnglibconf };
|
||||
|
||||
pub const pkg = std.build.Pkg{
|
||||
.name = "libpng",
|
||||
.source = .{ .path = thisDir() ++ "/main.zig" },
|
||||
@@ -19,7 +21,7 @@ pub const Options = struct {
|
||||
|
||||
pub const Zlib = struct {
|
||||
step: ?*std.build.LibExeObjStep = null,
|
||||
include: ?[]const u8 = null,
|
||||
include: ?[]const []const u8 = null,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -59,8 +61,8 @@ pub fn buildLib(
|
||||
else
|
||||
lib.linkSystemLibrary("z");
|
||||
|
||||
if (opt.zlib.include) |dir|
|
||||
lib.addIncludePath(dir);
|
||||
if (opt.zlib.include) |dirs|
|
||||
for (dirs) |dir| lib.addIncludePath(dir);
|
||||
|
||||
// Compile
|
||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||
|
||||
@@ -2,7 +2,9 @@ const std = @import("std");
|
||||
|
||||
/// Directories with our includes.
|
||||
const root = thisDir() ++ "../../../vendor/zlib/";
|
||||
pub const include_path = root;
|
||||
const include_path = root;
|
||||
|
||||
pub const include_paths = .{include_path};
|
||||
|
||||
pub const pkg = std.build.Pkg{
|
||||
.name = "zlib",
|
||||
|
||||
Reference in New Issue
Block a user