Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libalsa: set cpp_info.resdirs & minor improvements #13124

Merged
merged 4 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions recipes/libalsa/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, chdir, copy, get, rm, rmdir
from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import unix_path
import os

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.52.0"


class LibalsaConan(ConanFile):
Expand All @@ -32,8 +31,7 @@ class LibalsaConan(ConanFile):
}

def export_sources(self):
for p in self.conan_data.get("patches", {}).get(self.version, []):
copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder)
export_conandata_patches(self)

def configure(self):
if self.options.shared:
Expand All @@ -47,16 +45,16 @@ def configure(self):
except Exception:
pass

def layout(self):
basic_layout(self, src_folder="src")

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("Only Linux supported")

def build_requirements(self):
self.tool_requires("libtool/2.4.7")

def layout(self):
basic_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
Expand Down Expand Up @@ -95,6 +93,7 @@ def package_info(self):
self.cpp_info.set_property("cmake_target_name", "ALSA::ALSA")
self.cpp_info.set_property("pkg_config_name", "alsa")
self.cpp_info.libs = ["asound"]
self.cpp_info.resdirs = ["res"]
self.cpp_info.system_libs = ["dl", "m", "rt", "pthread"]
alsa_config_dir = os.path.join(self.package_folder, "res", "alsa")
self.runenv_info.define_path("ALSA_CONFIG_DIR", alsa_config_dir)
Expand Down
7 changes: 4 additions & 3 deletions recipes/libalsa/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"

def requirements(self):
self.requires(self.tested_reference_str)
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
cmake = CMake(self)
cmake.configure()
Expand Down