From a0f698d4a6026180f29da9c2018d4ad0f5bc86e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 26 Apr 2022 09:34:49 +0200 Subject: [PATCH] Linux: Use pkg-config for alsa, libudev and GL too It's not needed on most distros as those are found in standard lib and include paths, but on NixOS they're all in non-standard prefixes, so we need to rely on information provided by pkg-config. Fixes #59913. Co-authored-by: David Lewis (cherry picked from commit 07ad0664204fbc965627ed5cba548e93e5af4be7) --- platform/x11/detect.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 516b786bd..b7fc68059 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -114,7 +114,7 @@ def configure(env): ## Architecture - is64 = sys.maxsize > 2 ** 32 + is64 = sys.maxsize > 2**32 if env["bits"] == "default": env["bits"] = "64" if is64 else "32" @@ -308,13 +308,14 @@ def configure(env): if os.system("pkg-config --exists alsa") == 0: # 0 means found env["alsa"] = True env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"]) + env.ParseConfig("pkg-config alsa --cflags") # Only cflags, we dlopen the library. else: print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.") if env["pulseaudio"]: if os.system("pkg-config --exists libpulse") == 0: # 0 means found env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"]) - env.ParseConfig("pkg-config --cflags libpulse") + env.ParseConfig("pkg-config libpulse --cflags") # Only cflags, we dlopen the library. else: print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.") @@ -323,6 +324,7 @@ def configure(env): if env["udev"]: if os.system("pkg-config --exists libudev") == 0: # 0 means found env.Append(CPPDEFINES=["UDEV_ENABLED"]) + env.ParseConfig("pkg-config libudev --cflags") # Only cflags, we dlopen the library. else: print("Warning: libudev development libraries not found. Disabling controller hotplugging support.") else: @@ -334,7 +336,10 @@ def configure(env): env.Prepend(CPPPATH=["#platform/x11"]) env.Append(CPPDEFINES=["X11_ENABLED", "UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED", ("_FILE_OFFSET_BITS", 64)]) - env.Append(LIBS=["GL", "pthread"]) + + env.ParseConfig("pkg-config gl --cflags --libs") + + env.Append(LIBS=["pthread"]) if platform.system() == "Linux": env.Append(LIBS=["dl"])