From acea653fd651309b932d81229443a9be05162ca6 Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Sun, 17 Mar 2024 18:31:02 -0700 Subject: [PATCH 1/5] Updates libsndfile to use a conan-provided libsndio --- recipes/libsndfile/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index 6ce8582b64685..063a78594be67 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -57,7 +57,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): + self.requires("libsndio/1.9.0") if self.options.get_safe("with_alsa"): + self.options["libsndio"].with_alsa = True self.requires("libalsa/1.2.10") if self.options.with_external_libs: self.requires("ogg/1.3.5") @@ -73,7 +75,6 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Sndio"] = True # FIXME: missing sndio cci recipe (check whether it is really required) tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing sndio cci recipe (check whether it is really required) tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SQLite3"] = True # only used for regtest tc.variables["ENABLE_EXTERNAL_LIBS"] = self.options.with_external_libs @@ -122,6 +123,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "sndfile") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["sndfile"].libs = ["sndfile"] + self.cpp_info.components["sndfile"].requires.append("libsndio::libsndio") if self.options.with_external_libs: self.cpp_info.components["sndfile"].requires.extend([ "ogg::ogg", "vorbis::vorbismain", "vorbis::vorbisenc", From ac77833fb89f3bd47705551a1edc2b6a66741f9d Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Sun, 17 Mar 2024 18:31:34 -0700 Subject: [PATCH 2/5] Fixes dependency name copy-paste error in recipe --- recipes/libsndfile/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index 063a78594be67..cf2b9ac54254e 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -75,7 +75,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing sndio cci recipe (check whether it is really required) + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Speex"] = True # FIXME: missing speex cci recipe (check whether it is really required) tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SQLite3"] = True # only used for regtest tc.variables["ENABLE_EXTERNAL_LIBS"] = self.options.with_external_libs if not self.options.with_external_libs: From fc121823c88c9de1bdccd02ffd3c786a19bb52ac Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 22 Nov 2024 13:38:05 +0100 Subject: [PATCH 3/5] with_alsa option default true --- recipes/libsndfile/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index d585742e08206..e5504418a120a 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -34,7 +34,7 @@ class LibsndfileConan(ConanFile): "fPIC": True, "programs": True, "experimental": False, - "with_alsa": False, + "with_alsa": True, "with_external_libs": True, "with_mpeg": True, } @@ -59,9 +59,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libsndio/1.9.0") + self.requires("libsndio/1.9.0", + options={"with_alsa": self.options.get_safe("with_alsa")}) if self.options.get_safe("with_alsa"): - self.options["libsndio"].with_alsa = True self.requires("libalsa/1.2.10") if self.options.with_external_libs: self.requires("ogg/1.3.5") From 2e39acf58466490665b8a058596f3a2cc44b8463 Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 22 Nov 2024 14:17:25 +0100 Subject: [PATCH 4/5] add validate check --- recipes/libsndfile/all/conanfile.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index e5504418a120a..afe60cecc65f6 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime @@ -55,6 +56,11 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") + def validate(self): + if self.options.get_safe("with_alsa") != self.dependencies["libsndio"].options.get_safe("with_alsa"): + raise ConanInvalidConfiguration(f"{self.ref} with_alsa ({self.options.get_safe('with_alsa')}) option "\ + f"should be equal to the libsndio with_alsa ({self.dependencies['libsndio'].options.get_safe('with_alsa')}) one") + def layout(self): cmake_layout(self, src_folder="src") From f351c7cfb30fc2065eca5389c4a0595e8475c0b9 Mon Sep 17 00:00:00 2001 From: danimtb Date: Fri, 22 Nov 2024 14:25:05 +0100 Subject: [PATCH 5/5] fix validate --- recipes/libsndfile/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index afe60cecc65f6..fa3461e28d629 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -57,9 +57,8 @@ def configure(self): self.settings.rm_safe("compiler.libcxx") def validate(self): - if self.options.get_safe("with_alsa") != self.dependencies["libsndio"].options.get_safe("with_alsa"): - raise ConanInvalidConfiguration(f"{self.ref} with_alsa ({self.options.get_safe('with_alsa')}) option "\ - f"should be equal to the libsndio with_alsa ({self.dependencies['libsndio'].options.get_safe('with_alsa')}) one") + if self.dependencies["libsndio"].options.get_safe("with_alsa") and not self.options.get_safe("with_alsa"): + raise ConanInvalidConfiguration(f"{self.ref} 'with_alsa' option should be True when the libsndio 'with_alsa' one is True") def layout(self): cmake_layout(self, src_folder="src")