build: fix freetype compilation on Windows with MSVC

Gate HAVE_UNISTD_H and HAVE_FCNTL_H behind a non-Windows check since
these headers do not exist with MSVC. Freetype includes zlib headers
which conditionally include unistd.h based on this define.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alessandro De Blasis
2026-03-24 08:08:29 +01:00
parent f9d3b1aafb
commit d5aef6e845

View File

@@ -84,11 +84,14 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
"-DFT_CONFIG_OPTION_SYSTEM_ZLIB=1",
"-DHAVE_UNISTD_H",
"-DHAVE_FCNTL_H",
"-fno-sanitize=undefined",
});
if (target.result.os.tag != .windows) {
try flags.appendSlice(b.allocator, &.{
"-DHAVE_UNISTD_H",
"-DHAVE_FCNTL_H",
});
}
if (target.result.os.tag == .freebsd or target.result.abi == .musl) {
try flags.append(b.allocator, "-fPIC");