Skip to content

Commit c8d865f

Browse files
akien-mgaSplizard
authored andcommitted
Linux: Relax interdependency between freetype, libpng, and zlib for unvendored builds
This restriction was added to fix godotengine#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 godotengine#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 (godotengine#91401, godotengine#100301). We still allow it for now but raise a warning.
1 parent 4c4b2ab commit c8d865f

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

core/SCsub

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ if env["builtin_zlib"]:
9999
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
100100
if env.dev_build:
101101
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
102+
# Affects headers so it should also be defined for Godot code
103+
env.Append(CPPDEFINES=["ZLIB_DEBUG"])
102104

103105
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
104106

modules/freetype/SCsub

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ if env["builtin_freetype"]:
6767
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
6868

6969
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
70-
if env.dev_build:
71-
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
7270

7371
# Also requires libpng headers
7472
if env["builtin_libpng"]:

platform/linuxbsd/detect.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -222,23 +222,6 @@ def configure(env: "SConsEnvironment"):
222222

223223
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
224224

225-
# freetype depends on libpng and zlib, so bundling one of them while keeping others
226-
# as shared libraries leads to weird issues. And graphite and harfbuzz need freetype.
227-
ft_linked_deps = [
228-
env["builtin_freetype"],
229-
env["builtin_libpng"],
230-
env["builtin_zlib"],
231-
env["builtin_graphite"],
232-
env["builtin_harfbuzz"],
233-
]
234-
if (not all(ft_linked_deps)) and any(ft_linked_deps): # All or nothing.
235-
print_error(
236-
"These libraries should be either all builtin, or all system provided:\n"
237-
"freetype, libpng, zlib, graphite, harfbuzz.\n"
238-
"Please specify `builtin_<name>=no` for all of them, or none."
239-
)
240-
sys.exit(255)
241-
242225
if not env["builtin_freetype"]:
243226
env.ParseConfig("pkg-config freetype2 --cflags --libs")
244227

@@ -251,6 +234,11 @@ def configure(env: "SConsEnvironment"):
251234
if not env["builtin_harfbuzz"]:
252235
env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs")
253236

237+
if not env["builtin_icu4c"] or not env["builtin_harfbuzz"]:
238+
print_warning(
239+
"System-provided icu4c or harfbuzz cause known issues for GDExtension (see GH-91401 and GH-100301)."
240+
)
241+
254242
if not env["builtin_libpng"]:
255243
env.ParseConfig("pkg-config libpng16 --cflags --libs")
256244

0 commit comments

Comments
 (0)