mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
pkg/fontconfig: disable ubsan (reported upstream)
This commit is contained in:
@ -90,8 +90,6 @@ pub fn buildFontconfig(
|
|||||||
defer flags.deinit();
|
defer flags.deinit();
|
||||||
|
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
"-DFT2_BUILD_LIBRARY",
|
|
||||||
|
|
||||||
"-DHAVE_DIRENT_H",
|
"-DHAVE_DIRENT_H",
|
||||||
"-DHAVE_FCNTL_H",
|
"-DHAVE_FCNTL_H",
|
||||||
"-DHAVE_STDLIB_H",
|
"-DHAVE_STDLIB_H",
|
||||||
@ -143,6 +141,10 @@ pub fn buildFontconfig(
|
|||||||
"-DHAVE_STDATOMIC_PRIMITIVES",
|
"-DHAVE_STDATOMIC_PRIMITIVES",
|
||||||
|
|
||||||
"-DFC_GPERF_SIZE_T=size_t",
|
"-DFC_GPERF_SIZE_T=size_t",
|
||||||
|
|
||||||
|
// https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/231
|
||||||
|
"-fno-sanitize=undefined",
|
||||||
|
"-fno-sanitize-trap=undefined",
|
||||||
});
|
});
|
||||||
const arch = target.cpu_arch orelse builtin.cpu.arch;
|
const arch = target.cpu_arch orelse builtin.cpu.arch;
|
||||||
switch (arch.ptrBitWidth()) {
|
switch (arch.ptrBitWidth()) {
|
||||||
|
8
pkg/fontconfig/config.zig
Normal file
8
pkg/fontconfig/config.zig
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const c = @import("c.zig");
|
||||||
|
|
||||||
|
pub const Config = opaque {
|
||||||
|
pub fn destroy(self: *Config) void {
|
||||||
|
c.FcConfigDestroy(@ptrCast(*c.struct__FcConfig, self));
|
||||||
|
}
|
||||||
|
};
|
@ -1,5 +1,22 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig");
|
||||||
|
const Config = @import("config.zig").Config;
|
||||||
|
|
||||||
|
pub fn init() bool {
|
||||||
|
return c.FcInit() == c.FcTrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fini() void {
|
||||||
|
c.FcFini();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn initLoadConfig() *Config {
|
||||||
|
return @ptrCast(*Config, c.FcInitLoadConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn initLoadConfigAndFonts() *Config {
|
||||||
|
return @ptrCast(*Config, c.FcInitLoadConfigAndFonts());
|
||||||
|
}
|
||||||
|
|
||||||
pub fn version() u32 {
|
pub fn version() u32 {
|
||||||
return @intCast(u32, c.FcGetVersion());
|
return @intCast(u32, c.FcGetVersion());
|
||||||
@ -9,3 +26,18 @@ test "version" {
|
|||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
try testing.expect(version() > 0);
|
try testing.expect(version() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "init" {
|
||||||
|
try std.testing.expect(init());
|
||||||
|
defer fini();
|
||||||
|
}
|
||||||
|
|
||||||
|
test "initLoadConfig" {
|
||||||
|
var config = initLoadConfig();
|
||||||
|
defer config.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
test "initLoadConfigAndFonts" {
|
||||||
|
var config = initLoadConfigAndFonts();
|
||||||
|
defer config.destroy();
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
pub const c = @import("c.zig");
|
pub const c = @import("c.zig");
|
||||||
pub usingnamespace @import("init.zig");
|
pub usingnamespace @import("init.zig");
|
||||||
|
pub usingnamespace @import("config.zig");
|
||||||
|
|
||||||
test {
|
test {
|
||||||
@import("std").testing.refAllDecls(@This());
|
@import("std").testing.refAllDecls(@This());
|
||||||
|
@ -88,6 +88,8 @@ pub fn buildFreetype(
|
|||||||
|
|
||||||
"-DHAVE_UNISTD_H",
|
"-DHAVE_UNISTD_H",
|
||||||
"-DHAVE_FCNTL_H",
|
"-DHAVE_FCNTL_H",
|
||||||
|
|
||||||
|
//"-fno-sanitize=undefined",
|
||||||
});
|
});
|
||||||
if (opt.libpng.enabled) try flags.append("-DFT_CONFIG_OPTION_USE_PNG=1");
|
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");
|
if (opt.zlib.enabled) try flags.append("-DFT_CONFIG_OPTION_SYSTEM_ZLIB=1");
|
||||||
|
Reference in New Issue
Block a user