From c5763035bf35321cda2e736bef4a59f6647ee2bb Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Fri, 12 Apr 2024 14:21:04 -0500 Subject: [PATCH] libglvnd: Set the default datadir appropriately for the system Currently, ICD discovery doesn't work properly for the system. This is because `datadir` is either configured to the package directory for Conan versions before 1.64 and 2.2 or not set at all for later versions. When the datadir is not set, it results in the default search path for ICD discovery using /share/glvnd/egl_vendor.d, which is not correct for any platform. This is due to the empty `prefix`. This PR sets datadir to `/usr/share` on Linux, fixing the search path to include `/usr/share/glvnd/egl_vendor.d`. The `prefix` is not modified to avoid installing everything under `/usr` in the install step. On FreeBSD, the `datadir` is set to `/usr/local/share`, where I assume that the Mesa package's vendor configs are installed. I haven't confirmed this for FreeBSD. These changes can be verified by checking the generated `compile_commands.json` file in the build directory. The value for `-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=` will include the default search paths that libglvnd is built with. The first path which is under `sysconfigdir`, should be correct for Linux, as it is `/etc`. Under FreeBSD, this should be `/usr/local/etc`. --- recipes/libglvnd/all/conanfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/libglvnd/all/conanfile.py b/recipes/libglvnd/all/conanfile.py index 2362f8db4e5aa..422acffdcd2c7 100644 --- a/recipes/libglvnd/all/conanfile.py +++ b/recipes/libglvnd/all/conanfile.py @@ -8,7 +8,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.64.0 <2 || >=2.2.0" class LibGlvndConan(ConanFile): name = "libglvnd" @@ -59,7 +59,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.name} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/1.3.2") + self.tool_requires("meson/1.4.0") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/2.1.0") @@ -87,6 +87,10 @@ def generate(self): tc.project_options["headers"] = self.options.headers tc.project_options["entrypoint-patching"] = "enabled" if self.options.entrypoint_patching else "disabled" tc.project_options["libdir"] = "lib" + # Configure the data directory so that it defaults to the correct location for ICD discovery on the local system. + tc.project_options["datadir"] = os.path.join("usr", "share") if self.settings.os == "Linux" else os.path.join("usr", "local", "share") + if self.settings.os == "FreeBSD": + tc.project_options["sysconfdir"] = os.path.join("usr", "local", "etc") tc.generate() def build(self):