From d5aef6e845ed72584aba3a129268d40a9694b568 Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Tue, 24 Mar 2026 08:08:29 +0100 Subject: [PATCH] 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) --- pkg/freetype/build.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/freetype/build.zig b/pkg/freetype/build.zig index ecb22cb6c..b85310a5b 100644 --- a/pkg/freetype/build.zig +++ b/pkg/freetype/build.zig @@ -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");