Skip to content

Commit

Permalink
Remove 1.1.1, use CMake to build
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahajha committed Nov 11, 2023
1 parent e98910c commit 244b84b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
3 changes: 0 additions & 3 deletions recipes/tinyalsa/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ sources:
"2.0.0":
url: "https://github.com/tinyalsa/tinyalsa/archive/refs/tags/v2.0.0.tar.gz"
sha256: "573ae0b2d3480851c1d2a12503ead2beea27f92d44ed47b74b553ba947994ef1"
"1.1.1":
url: "https://github.com/tinyalsa/tinyalsa/archive/1.1.1.tar.gz"
sha256: "d92b438cea348ae316c4b2cbf367b4f01ed821a947e6a34d813624e9e3c936c1"
patches:
"2.0.0":
- patch_file: "patches/tinyalsa-2.0.0-strncpy-warning.patch"
34 changes: 11 additions & 23 deletions recipes/tinyalsa/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from conan import ConanFile
from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, chdir, copy, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, copy
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.errors import ConanInvalidConfiguration
import os

Expand All @@ -21,11 +19,11 @@ class TinyAlsaConan(ConanFile):
default_options = {'shared': False}

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

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("{} only works for Linux.".format(self.name))
raise ConanInvalidConfiguration(f"{self.ref} only works for Linux.")

def configure(self):
self.settings.rm_safe("compiler.libcxx")
Expand All @@ -38,34 +36,24 @@ def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = AutotoolsToolchain(self)
tc = CMakeToolchain(self)
tc.generate()

def build(self):
apply_conandata_patches(self)
with chdir(self, self.source_folder):
at = Autotools(self)
at.make()
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "NOTICE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)

with chdir(self, self.source_folder):
at = Autotools(self)
at.install(args=[f"DESTDIR={self.package_folder}", "PREFIX="])

rmdir(self, os.path.join(self.package_folder, "share"))

with chdir(self, os.path.join(self.package_folder, "lib")):
files = os.listdir()
for f in files:
if (self.options.shared and f.endswith(".a")) or (not self.options.shared and not f.endswith(".a")):
os.unlink(f)
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["tinyalsa"]
if Version(self.version) >= "2.0.0":
self.cpp_info.system_libs.append("dl")
self.cpp_info.system_libs.append("dl")

# Needed for compatibility with v1.x - Remove when 2.0 becomes the default
bin_path = os.path.join(self.package_folder, "bin")
Expand Down

0 comments on commit 244b84b

Please sign in to comment.