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.py143
1 files changed, 121 insertions, 22 deletions
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index bae5a98aee..3f713d2db3 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -43,6 +43,7 @@ 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("use_sowrap", "Dynamically load system libraries", True),
BoolVariable("alsa", "Use ALSA", True),
BoolVariable("pulseaudio", "Use PulseAudio", True),
BoolVariable("dbus", "Use D-Bus to handle screensaver and portal desktop settings", True),
@@ -184,25 +185,30 @@ def configure(env: "Environment"):
## Dependencies
+ if env["use_sowrap"]:
+ env.Append(CPPDEFINES=["SOWRAP_ENABLED"])
+
if env["touch"]:
env.Append(CPPDEFINES=["TOUCH_ENABLED"])
# 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
- if (
- env["builtin_freetype"]
- or env["builtin_libpng"]
- or env["builtin_zlib"]
- or env["builtin_graphite"]
- or env["builtin_harfbuzz"]
- ):
- env["builtin_freetype"] = True
- env["builtin_libpng"] = True
- env["builtin_zlib"] = True
- env["builtin_graphite"] = True
- env["builtin_harfbuzz"] = True
+ # 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(
+ "These libraries should be either all builtin, or all system provided:\n"
+ "freetype, libpng, zlib, graphite, harfbuzz.\n"
+ "Please specify `builtin_<name>=no` for all of them, or none."
+ )
+ sys.exit()
if not env["builtin_freetype"]:
env.ParseConfig("pkg-config freetype2 --cflags --libs")
@@ -210,8 +216,8 @@ def configure(env: "Environment"):
if not env["builtin_graphite"]:
env.ParseConfig("pkg-config graphite2 --cflags --libs")
- if not env["builtin_icu"]:
- env.ParseConfig("pkg-config icu-uc --cflags --libs")
+ if not env["builtin_icu4c"]:
+ env.ParseConfig("pkg-config icu-i18n icu-uc --cflags --libs")
if not env["builtin_harfbuzz"]:
env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs")
@@ -266,31 +272,93 @@ def configure(env: "Environment"):
if not env["builtin_pcre2"]:
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
+ if not env["builtin_recastnavigation"]:
+ # No pkgconfig file so far, hardcode default paths.
+ env.Prepend(CPPPATH=["/usr/include/recastnavigation"])
+ env.Append(LIBS=["Recast"])
+
if not env["builtin_embree"]:
# No pkgconfig file so far, hardcode expected lib name.
env.Append(LIBS=["embree3"])
## Flags
-
if env["fontconfig"]:
- env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists fontconfig") == 0: # 0 means found
+ env.ParseConfig("pkg-config fontconfig --cflags --libs")
+ env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
+ else:
+ print("Warning: fontconfig development libraries not found. Disabling the system fonts support.")
+ env["fontconfig"] = False
+ else:
+ env.Append(CPPDEFINES=["FONTCONFIG_ENABLED"])
if env["alsa"]:
- env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists alsa") == 0: # 0 means found
+ env.ParseConfig("pkg-config alsa --cflags --libs")
+ env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
+ else:
+ print("Warning: ALSA development libraries not found. Disabling the ALSA audio driver.")
+ env["alsa"] = False
+ else:
+ env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
if env["pulseaudio"]:
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists libpulse") == 0: # 0 means found
+ env.ParseConfig("pkg-config libpulse --cflags --libs")
+ env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
+ else:
+ print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
+ env["pulseaudio"] = False
env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
if env["dbus"]:
- env.Append(CPPDEFINES=["DBUS_ENABLED"])
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists dbus-1") == 0: # 0 means found
+ env.ParseConfig("pkg-config dbus-1 --cflags --libs")
+ env.Append(CPPDEFINES=["DBUS_ENABLED"])
+ else:
+ print("Warning: D-Bus development libraries not found. Disabling screensaver prevention.")
+ env["dbus"] = False
+ else:
+ env.Append(CPPDEFINES=["DBUS_ENABLED"])
if env["speechd"]:
- env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists speech-dispatcher") == 0: # 0 means found
+ env.ParseConfig("pkg-config speech-dispatcher --cflags --libs")
+ env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
+ else:
+ print("Warning: speech-dispatcher development libraries not found. Disabling text to speech support.")
+ env["speechd"] = False
+ else:
+ env.Append(CPPDEFINES=["SPEECHD_ENABLED"])
+
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists xkbcommon") == 0: # 0 means found
+ env.ParseConfig("pkg-config xkbcommon --cflags --libs")
+ env.Append(CPPDEFINES=["XKB_ENABLED"])
+ else:
+ print(
+ "Warning: libxkbcommon development libraries not found. Disabling dead key composition and key label support."
+ )
+ else:
+ env.Append(CPPDEFINES=["XKB_ENABLED"])
if platform.system() == "Linux":
env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
if env["udev"]:
- env.Append(CPPDEFINES=["UDEV_ENABLED"])
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists libudev") == 0: # 0 means found
+ env.ParseConfig("pkg-config libudev --cflags --libs")
+ env.Append(CPPDEFINES=["UDEV_ENABLED"])
+ else:
+ print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
+ env["udev"] = False
+ else:
+ env.Append(CPPDEFINES=["UDEV_ENABLED"])
else:
env["udev"] = False # Linux specific
@@ -298,7 +366,9 @@ def configure(env: "Environment"):
if not env["builtin_zlib"]:
env.ParseConfig("pkg-config zlib --cflags --libs")
- env.Prepend(CPPPATH=["#platform/linuxbsd", "#thirdparty/linuxbsd_headers"])
+ env.Prepend(CPPPATH=["#platform/linuxbsd"])
+ if env["use_sowrap"]:
+ env.Prepend(CPPPATH=["#thirdparty/linuxbsd_headers"])
env.Append(
CPPDEFINES=[
@@ -309,6 +379,35 @@ def configure(env: "Environment"):
)
if env["x11"]:
+ if not env["use_sowrap"]:
+ if os.system("pkg-config --exists x11"):
+ print("Error: X11 libraries not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config x11 --cflags --libs")
+ if os.system("pkg-config --exists xcursor"):
+ print("Error: Xcursor library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xcursor --cflags --libs")
+ if os.system("pkg-config --exists xinerama"):
+ print("Error: Xinerama library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xinerama --cflags --libs")
+ if os.system("pkg-config --exists xext"):
+ print("Error: Xext library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xext --cflags --libs")
+ if os.system("pkg-config --exists xrandr"):
+ print("Error: XrandR library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xrandr --cflags --libs")
+ if os.system("pkg-config --exists xrender"):
+ print("Error: XRender library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xrender --cflags --libs")
+ if os.system("pkg-config --exists xi"):
+ print("Error: Xi library not found. Aborting.")
+ sys.exit(255)
+ env.ParseConfig("pkg-config xi --cflags --libs")
env.Append(CPPDEFINES=["X11_ENABLED"])
if env["vulkan"]: