From 7fe0609118665e9b1adc326a0d5c556534852898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 5 Dec 2024 16:04:37 +0100 Subject: [PATCH] Linux: Relax interdependency between freetype, libpng, and zlib for unvendored builds This restriction was added to fix #7373 back then, which was a symbol conflict between FreeType's bundled copy of gzip/zlib, and distro packages. But we also unbundled FreeType's zlib in #69395 so this is no longer an issue. On the other hand recent issues pointed out that using system-provided icu4c or harfbuzz can cause issues (#91401, #100301). We still allow it for now but raise a warning. --- core/SCsub | 2 ++ modules/freetype/SCsub | 2 -- platform/linuxbsd/detect.py | 22 +++++----------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/core/SCsub b/core/SCsub index 8bda230b870c..f055a75cb75d 100644 --- a/core/SCsub +++ b/core/SCsub @@ -99,6 +99,8 @@ if env["builtin_zlib"]: env.Prepend(CPPPATH=[thirdparty_zlib_dir]) if env.dev_build: env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"]) + # Affects headers so it should also be defined for Godot code + env.Append(CPPDEFINES=["ZLIB_DEBUG"]) env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources) diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 5edce9668006..dc46513a3faa 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -67,8 +67,6 @@ if env["builtin_freetype"]: env.Prepend(CPPPATH=[thirdparty_dir + "/include"]) env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"]) - if env.dev_build: - env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"]) # Also requires libpng headers if env["builtin_libpng"]: diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 3ff81d5de29a..ce497bfa5016 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -222,23 +222,6 @@ def configure(env: "SConsEnvironment"): # FIXME: Check for existence of the libs before parsing their flags with pkg-config - # freetype depends on libpng and zlib, so bundling one of them while keeping others - # as shared libraries leads to weird issues. And graphite and harfbuzz need freetype. - ft_linked_deps = [ - env["builtin_freetype"], - env["builtin_libpng"], - env["builtin_zlib"], - env["builtin_graphite"], - env["builtin_harfbuzz"], - ] - if (not all(ft_linked_deps)) and any(ft_linked_deps): # All or nothing. - print_error( - "These libraries should be either all builtin, or all system provided:\n" - "freetype, libpng, zlib, graphite, harfbuzz.\n" - "Please specify `builtin_=no` for all of them, or none." - ) - sys.exit(255) - if not env["builtin_freetype"]: env.ParseConfig("pkg-config freetype2 --cflags --libs") @@ -251,6 +234,11 @@ def configure(env: "SConsEnvironment"): if not env["builtin_harfbuzz"]: env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs") + if not env["builtin_icu4c"] or not env["builtin_harfbuzz"]: + print_warning( + "System-provided icu4c or harfbuzz cause known issues for GDExtension (see GH-91401 and GH-100301)." + ) + if not env["builtin_libpng"]: env.ParseConfig("pkg-config libpng16 --cflags --libs")