Skip to content

Commit 896d3bd

Browse files
committed
Merge pull request godotengine#99171 from dustdfg/pkg_config
Buildsystem: Use pkg-config for miniupnpc and mbedtls
2 parents ad97ef8 + a42b8e2 commit 896d3bd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

platform/linuxbsd/detect.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,18 @@ def configure(env: "SConsEnvironment"):
279279
env.ParseConfig("pkg-config libwebp --cflags --libs")
280280

281281
if not env["builtin_mbedtls"]:
282-
# mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
283-
env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
282+
# mbedTLS only provides a pkgconfig file since 3.6.0, but we still support 2.28.x,
283+
# so fallback to manually specifying LIBS if it fails.
284+
if os.system("pkg-config --exists mbedtls") == 0: # 0 means found
285+
env.ParseConfig("pkg-config mbedtls mbedcrypto mbedx509 --cflags --libs")
286+
else:
287+
env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
284288

285289
if not env["builtin_wslay"]:
286290
env.ParseConfig("pkg-config libwslay --cflags --libs")
287291

288292
if not env["builtin_miniupnpc"]:
289-
# No pkgconfig file so far, hardcode default paths.
290-
env.Prepend(CPPPATH=["/usr/include/miniupnpc"])
291-
env.Append(LIBS=["miniupnpc"])
293+
env.ParseConfig("pkg-config miniupnpc --cflags --libs")
292294

293295
# On Linux wchar_t should be 32-bits
294296
# 16-bit library shouldn't be required due to compiler optimizations

0 commit comments

Comments
 (0)