summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/detect.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd/detect.py')
-rw-r--r--platform/linuxbsd/detect.py79
1 files changed, 23 insertions, 56 deletions
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 747dcbd76c..36e149f2b4 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -43,10 +43,11 @@ def get_opts():
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False),
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False),
- BoolVariable("pulseaudio", "Detect and use PulseAudio", True),
- BoolVariable("dbus", "Detect and use D-Bus to handle screensaver and portal desktop settings", True),
- BoolVariable("speechd", "Detect and use Speech Dispatcher for Text-to-Speech support", True),
- BoolVariable("fontconfig", "Detect and use fontconfig for system fonts support", True),
+ BoolVariable("alsa", "Use ALSA", True),
+ BoolVariable("pulseaudio", "Use PulseAudio", True),
+ BoolVariable("dbus", "Use D-Bus to handle screensaver and portal desktop settings", True),
+ BoolVariable("speechd", "Use Speech Dispatcher for Text-to-Speech support", True),
+ BoolVariable("fontconfig", "Use fontconfig for system fonts support", True),
BoolVariable("udev", "Use udev for gamepad connection callbacks", True),
BoolVariable("x11", "Enable X11 display", True),
BoolVariable("touch", "Enable touch events", True),
@@ -183,16 +184,6 @@ def configure(env: "Environment"):
## Dependencies
- if env["x11"]:
- # Only cflags, we dlopen the libraries.
- env.ParseConfig("pkg-config x11 --cflags")
- env.ParseConfig("pkg-config xcursor --cflags")
- env.ParseConfig("pkg-config xinerama --cflags")
- env.ParseConfig("pkg-config xext --cflags")
- env.ParseConfig("pkg-config xrandr --cflags")
- env.ParseConfig("pkg-config xrender --cflags")
- env.ParseConfig("pkg-config xi --cflags")
-
if env["touch"]:
env.Append(CPPDEFINES=["TOUCH_ENABLED"])
@@ -271,7 +262,7 @@ def configure(env: "Environment"):
env.Append(LIBS=["miniupnpc"])
# On Linux wchar_t should be 32-bits
- # 16-bit library shouldn't be required due to compiler optimisations
+ # 16-bit library shouldn't be required due to compiler optimizations
if not env["builtin_pcre2"]:
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
@@ -282,53 +273,24 @@ def configure(env: "Environment"):
## Flags
if env["fontconfig"]:
- if os.system("pkg-config --exists fontconfig") == 0: # 0 means found
- env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
- env.ParseConfig("pkg-config fontconfig --cflags") # Only cflags, we dlopen the library.
- else:
- env["fontconfig"] = False
- print("Warning: fontconfig libraries not found. Disabling the system fonts support.")
+ env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
- if os.system("pkg-config --exists alsa") == 0: # 0 means found
- env["alsa"] = True
+ if env["alsa"]:
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 libpulse --cflags") # Only cflags, we dlopen the library.
- else:
- env["pulseaudio"] = False
- print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
+ env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
if env["dbus"]:
- if os.system("pkg-config --exists dbus-1") == 0: # 0 means found
- env.Append(CPPDEFINES=["DBUS_ENABLED"])
- env.ParseConfig("pkg-config dbus-1 --cflags") # Only cflags, we dlopen the library.
- else:
- env["dbus"] = False
- print("Warning: D-Bus development libraries not found. Disabling screensaver prevention.")
+ env.Append(CPPDEFINES=["DBUS_ENABLED"])
if env["speechd"]:
- if os.system("pkg-config --exists speech-dispatcher") == 0: # 0 means found
- env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
- env.ParseConfig("pkg-config speech-dispatcher --cflags") # Only cflags, we dlopen the library.
- else:
- env["speechd"] = False
- print("Warning: Speech Dispatcher development libraries not found. Disabling Text-to-Speech support.")
+ env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
if platform.system() == "Linux":
env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
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:
- env["udev"] = False
- print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
+ env.Append(CPPDEFINES=["UDEV_ENABLED"])
else:
env["udev"] = False # Linux specific
@@ -336,14 +298,19 @@ def configure(env: "Environment"):
if not env["builtin_zlib"]:
env.ParseConfig("pkg-config zlib --cflags --libs")
- env.Prepend(CPPPATH=["#platform/linuxbsd"])
+ env.Prepend(CPPPATH=["#platform/linuxbsd", "#thirdparty/linuxbsd_headers"])
+
+ env.Append(
+ CPPDEFINES=[
+ "LINUXBSD_ENABLED",
+ "UNIX_ENABLED",
+ ("_FILE_OFFSET_BITS", 64),
+ ]
+ )
if env["x11"]:
env.Append(CPPDEFINES=["X11_ENABLED"])
- env.Append(CPPDEFINES=["UNIX_ENABLED"])
- env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)])
-
if env["vulkan"]:
env.Append(CPPDEFINES=["VULKAN_ENABLED"])
if not env["use_volk"]:
@@ -400,9 +367,9 @@ def configure(env: "Environment"):
# Link those statically for portability
if env["use_static_cpp"]:
env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
- if env["use_llvm"]:
+ if env["use_llvm"] and platform.system() != "FreeBSD":
env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a"
else:
- if env["use_llvm"]:
+ if env["use_llvm"] and platform.system() != "FreeBSD":
env.Append(LIBS=["atomic"])