--- platform/macos/detect.py.orig 2026-06-19 08:57:29 +++ platform/macos/detect.py 2026-06-19 08:58:03 @@ -231,9 +231,45 @@ ) env["accesskit"] = False - if env["builtin_libtheora"] and env["arch"] == "x86_64": - env["x86_libtheora_opt_gcc"] = True + if not env["builtin_freetype"]: + env.ParseConfig("pkg-config freetype2 --cflags --libs") + if not env["builtin_libpng"]: + env.ParseConfig("pkg-config libpng16 --cflags --libs") + + if not env["builtin_zstd"]: + env.ParseConfig("pkg-config libzstd --cflags --libs") + + # Sound and video libraries + # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) + + if not env["builtin_libtheora"]: + env["builtin_libogg"] = False + env["builtin_libvorbis"] = False + if env.editor_build: + env.ParseConfig("pkg-config theora theoradec theoraenc --cflags --libs") + else: + env.ParseConfig("pkg-config theora theoradec --cflags --libs") + else: + if env["arch"] == "x86_64": + env["x86_libtheora_opt_gcc"] = True + + if not env["builtin_libvorbis"]: + env["builtin_libogg"] = False + if env.editor_build: + env.ParseConfig("pkg-config vorbis vorbisfile vorbisenc --cflags --libs") + else: + env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") + + if not env["builtin_libogg"]: + env.ParseConfig("pkg-config ogg --cflags --libs") + + if not env["builtin_miniupnpc"]: + env.ParseConfig("pkg-config miniupnpc --cflags --libs") + + if not env["builtin_pcre2"]: + env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") + if env["sdl"]: env.Append(CPPDEFINES=["SDL_ENABLED"]) env.Append(LINKFLAGS=["-framework", "ForceFeedback"]) @@ -342,3 +378,6 @@ if len(extra_frameworks) > 0: frameworks = [item for key in sorted(extra_frameworks) for item in ["-framework", key]] env.Append(LINKFLAGS=frameworks) + + if not env["builtin_zlib"]: + env.ParseConfig("pkg-config zlib --cflags --libs")