From 49068782e7632e2bef5db1b1f014d471c3abb1cd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 5 Apr 2024 17:55:21 +0300 Subject: [PATCH 1/6] dbus: avoid overlinking of glib and X11 libraries --- recipes/dbus/1.x.x/conanfile.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index cd719ddcf771f..3c47a9fd3b8b4 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -52,8 +52,8 @@ def export_sources(self): def config_options(self): if self.settings.os not in ("Linux", "FreeBSD"): del self.options.with_systemd - if self.settings.os not in ("Linux", "FreeBSD"): del self.options.with_x11 + del self.options.with_selinux if self.settings.os == "Windows": del self.options.fPIC @@ -72,8 +72,8 @@ def requirements(self): self.requires("glib/2.78.3") if self.options.get_safe("with_systemd"): self.requires("libsystemd/253.6") - if self.options.with_selinux: - self.requires("libselinux/3.3") + if self.options.get_safe("with_selinux"): + self.requires("libselinux/3.5") if self.options.get_safe("with_x11"): self.requires("xorg/system") @@ -82,7 +82,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} requires at least gcc 7.") 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",check_type=str): self.tool_requires("pkgconf/2.1.0") @@ -109,13 +109,18 @@ def generate(self): tc.project_options["launchd_agent_dir"] = os.path.join(self.package_folder, "res", "LaunchAgents") tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11", False) else "disabled" tc.project_options["xml_docs"] = "disabled" + tc.project_options["modular_tests"] = "enabled" if self.options.with_glib else "disabled" # glib is not found otherwise due to a buggy build.meson tc.generate() deps = PkgConfigDeps(self) deps.generate() - def build(self): + def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('test')", "# subdir('test')") + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "subdir('test')", "# subdir('test')") + + def build(self): + self._patch_sources() meson = Meson(self) meson.configure() meson.build() @@ -179,6 +184,19 @@ def package_info(self): if not self.options.shared: self.cpp_info.defines.append("DBUS_STATIC_BUILD") + self.cpp_info.requires.append("expat::expat") + if self.options.with_glib: + if self.settings.os == "Windows": + self.cpp_info.requires.append("glib::gio-windows-2.0") + else: + self.cpp_info.requires.append("glib::gio-unix-2.0") + if self.options.get_safe("with_systemd"): + self.cpp_info.requires.append("libsystemd::libsystemd") + if self.options.get_safe("with_selinux"): + self.cpp_info.requires.append("libselinux::selinux") + if self.options.get_safe("with_x11"): + self.cpp_info.requires.append("xorg::x11") + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "DBus1" self.cpp_info.filenames["cmake_find_package_multi"] = "DBus1" From e1c81077c798d0cd2ece4867f743e3ddc4778314 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Apr 2024 13:37:20 +0300 Subject: [PATCH 2/6] dbus: set xorg dependency visible=False --- recipes/dbus/1.x.x/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index 3c47a9fd3b8b4..4725633702745 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -75,7 +75,10 @@ def requirements(self): if self.options.get_safe("with_selinux"): self.requires("libselinux/3.5") if self.options.get_safe("with_x11"): - self.requires("xorg/system") + # X11 is only linked into an executable and should not be propagated as a library dependency. + # It should still be provided in a VirtualRunEnv context, though, + # but Conan as of v2.2 does not yet provide a fine-grained enough control over this. + self.requires("xorg/system", visible=False) def validate(self): if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 7: @@ -194,8 +197,6 @@ def package_info(self): self.cpp_info.requires.append("libsystemd::libsystemd") if self.options.get_safe("with_selinux"): self.cpp_info.requires.append("libselinux::selinux") - if self.options.get_safe("with_x11"): - self.cpp_info.requires.append("xorg::x11") # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "DBus1" From 1a1e88fedbc51b98284072377a742be71b3be892 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Apr 2024 13:47:10 +0300 Subject: [PATCH 3/6] dbus: update license details https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.15.8/COPYING --- recipes/dbus/1.x.x/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index 4725633702745..7fc87565a2af8 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -15,7 +15,8 @@ class DbusConan(ConanFile): name = "dbus" - license = ("AFL-2.1", "GPL-2.0-or-later") + # license is AFL-2.1 OR GPL-2.0-or-later with several other compatible licenses for smaller sections of code + license = "(AFL-2.1 OR GPL-2.0-or-later) AND DocumentRef-COPYING" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/dbus" description = "D-Bus is a simple system for interprocess communication and coordination." @@ -129,7 +130,8 @@ def build(self): meson.build() def package(self): - copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*", os.path.join(self.source_folder, "LICENSES"), os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() From bb8ebd40b38beecdc47cd8f973c816184b46173b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Apr 2024 13:59:59 +0300 Subject: [PATCH 4/6] dbus: drop with_glib option --- recipes/dbus/1.x.x/conanfile.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index 7fc87565a2af8..f74dd9f6a3895 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -30,7 +30,7 @@ class DbusConan(ConanFile): "system_socket": [None, "ANY"], "system_pid_file": [None, "ANY"], "with_x11": [True, False], - "with_glib": [True, False], + "with_glib": ["deprecated", True, False], "with_systemd": [True, False], "with_selinux": [True, False], "session_socket_dir": ["ANY"], @@ -41,7 +41,7 @@ class DbusConan(ConanFile): "system_socket": None, "system_pid_file": None, "with_x11": False, - "with_glib": False, + "with_glib": "deprecated", "with_systemd": False, "with_selinux": False, "session_socket_dir": "/tmp", @@ -64,13 +64,14 @@ def configure(self): if self.options.shared: self.options.rm_safe("fPIC") + def package_id(self): + del self.info.options.with_glib + def layout(self): basic_layout(self, src_folder="src") def requirements(self): self.requires("expat/2.6.0") - if self.options.with_glib: - self.requires("glib/2.78.3") if self.options.get_safe("with_systemd"): self.requires("libsystemd/253.6") if self.options.get_safe("with_selinux"): @@ -84,6 +85,8 @@ def requirements(self): def validate(self): if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 7: raise ConanInvalidConfiguration(f"{self.ref} requires at least gcc 7.") + if self.options.with_glib != "deprecated": + raise ConanInvalidConfiguration(f"with_glib option is deprecated and should not be used - the option had no effect.") def build_requirements(self): self.tool_requires("meson/1.4.0") @@ -113,7 +116,6 @@ def generate(self): tc.project_options["launchd_agent_dir"] = os.path.join(self.package_folder, "res", "LaunchAgents") tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11", False) else "disabled" tc.project_options["xml_docs"] = "disabled" - tc.project_options["modular_tests"] = "enabled" if self.options.with_glib else "disabled" # glib is not found otherwise due to a buggy build.meson tc.generate() deps = PkgConfigDeps(self) deps.generate() @@ -190,11 +192,6 @@ def package_info(self): self.cpp_info.defines.append("DBUS_STATIC_BUILD") self.cpp_info.requires.append("expat::expat") - if self.options.with_glib: - if self.settings.os == "Windows": - self.cpp_info.requires.append("glib::gio-windows-2.0") - else: - self.cpp_info.requires.append("glib::gio-unix-2.0") if self.options.get_safe("with_systemd"): self.cpp_info.requires.append("libsystemd::libsystemd") if self.options.get_safe("with_selinux"): From eeb60eb1e5bdc8887b7a28d4789cb549d1f8f933 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Apr 2024 14:46:56 +0300 Subject: [PATCH 5/6] dbus: fix systemd unitdir installation paths Including `self.package_folder` installed them under the package folder with the full `/home/...` path. --- recipes/dbus/1.x.x/conanfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index f74dd9f6a3895..bf29724c650f0 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -110,10 +110,10 @@ def generate(self): tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux", False) else "disabled" tc.project_options["systemd"] = "enabled" if self.options.get_safe("with_systemd", False) else "disabled" if self.options.get_safe("with_systemd", False): - tc.project_options["systemd_system_unitdir"] = os.path.join(self.package_folder, "lib", "systemd", "system") - tc.project_options["systemd_user_unitdir"] = os.path.join(self.package_folder, "lib", "systemd", "user") + tc.project_options["systemd_system_unitdir"] = "/res/lib/systemd/system" + tc.project_options["systemd_user_unitdir"] = "/res/usr/lib/systemd/system" if is_apple_os(self): - tc.project_options["launchd_agent_dir"] = os.path.join(self.package_folder, "res", "LaunchAgents") + tc.project_options["launchd_agent_dir"] = "/res/LaunchAgents" tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11", False) else "disabled" tc.project_options["xml_docs"] = "disabled" tc.generate() @@ -145,7 +145,6 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - rmdir(self, os.path.join(self.package_folder, "lib", "systemd")) fix_apple_shared_install_name(self) if self.settings.os == "Windows" and not self.options.shared: rename(self, os.path.join(self.package_folder, "lib", "libdbus-1.a"), os.path.join(self.package_folder, "lib", "dbus-1.lib")) From 080f0b85506c0b3c2e7edf1b305520a6c9363327 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 6 Apr 2024 17:41:48 +0300 Subject: [PATCH 6/6] dbus: revert macOS install path --- recipes/dbus/1.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index bf29724c650f0..102c9b718e094 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -113,7 +113,7 @@ def generate(self): tc.project_options["systemd_system_unitdir"] = "/res/lib/systemd/system" tc.project_options["systemd_user_unitdir"] = "/res/usr/lib/systemd/system" if is_apple_os(self): - tc.project_options["launchd_agent_dir"] = "/res/LaunchAgents" + tc.project_options["launchd_agent_dir"] = os.path.join(self.package_folder, "res", "LaunchAgents") tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11", False) else "disabled" tc.project_options["xml_docs"] = "disabled" tc.generate()