[DO-971] ffmpeg recipe with requirements (!9)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/9
This commit is contained in:
31
recipes/libalsa/all/conandata.yml
Normal file
31
recipes/libalsa/all/conandata.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
sources:
|
||||
"1.2.13":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.13.tar.gz"
|
||||
sha256: "e296a2e8fa165855e2c8f263ff6bc0b0ea21a3bece4404135f3a181d1a03e63a"
|
||||
"1.2.12":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.12.tar.gz"
|
||||
sha256: "f067dbba9376e5bbbb417b77751d2a9f2f277c54fb3a2b5c023cc2c7dfb4e3c1"
|
||||
"1.2.10":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.10.tar.gz"
|
||||
sha256: "f55749847fd98274501f4691a2d847e89280c07d40a43cdac43d6443f69fc939"
|
||||
"1.2.7.2":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.7.2.tar.gz"
|
||||
sha256: "2ed6d908120beb4a91c2271b01489181b28dc9f35f32229ef83bcd5ac8817654"
|
||||
"1.2.7":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.7.tar.gz"
|
||||
sha256: "d76ac42f678b198d754c072fb6d0ce89f880a9bb9fd6a45f97d7be762ac0a384"
|
||||
"1.2.5.1":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.5.1.tar.gz"
|
||||
sha256: "bc1d9ed505e183fc59413425d34e8106322a0e399befcde8466bd96e6764e6c8"
|
||||
"1.2.4":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.4.tar.gz"
|
||||
sha256: "0c6ab052d7ea980a01d0208da5e5e10849bd16c4c9961bbd5d2665083b74a6c0"
|
||||
"1.2.2":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.2.2.tar.gz"
|
||||
sha256: "ad4fa29e3927c5bec0f71b24b6a88523f4e386905341fc9047abef5744805023"
|
||||
"1.1.9":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/alsa-project/alsa-lib/archive/v1.1.9.tar.gz"
|
||||
sha256: "be3443c69dd2cb86e751c0abaa4b74343c75db28ef13d11d19a3130a5b0ff78d"
|
||||
patches:
|
||||
"1.2.5.1":
|
||||
- patch_file: "patches/1.2.5.1-0001-control-empty-fix-the-static-build.patch"
|
||||
109
recipes/libalsa/all/conanfile.py
Normal file
109
recipes/libalsa/all/conanfile.py
Normal file
@@ -0,0 +1,109 @@
|
||||
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, export_conandata_patches, get, rm, rmdir
|
||||
from conan.tools.gnu import Autotools, AutotoolsToolchain
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class LibalsaConan(ConanFile):
|
||||
name = "libalsa"
|
||||
description = "Library of ALSA: The Advanced Linux Sound Architecture, that provides audio " \
|
||||
"and MIDI functionality to the Linux operating system"
|
||||
license = "LGPL-2.1-or-later"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/alsa-project/alsa-lib"
|
||||
topics = ("alsa", "sound", "audio", "midi")
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"disable_python": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"disable_python": True,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
|
||||
def layout(self):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os != "Linux":
|
||||
raise ConanInvalidConfiguration(f"{self.ref} only supports Linux")
|
||||
|
||||
# def build_requirements(self):
|
||||
# self.tool_requires("libtool/2.4.7")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
virtual_build_env = VirtualBuildEnv(self)
|
||||
virtual_build_env.generate()
|
||||
|
||||
tc = AutotoolsToolchain(self)
|
||||
yes_no = lambda v: "yes" if v else "no"
|
||||
tc.configure_args.extend([
|
||||
f"--enable-python={yes_no(not self.options.disable_python)}",
|
||||
"--datarootdir=${prefix}/res",
|
||||
"--datadir=${prefix}/res",
|
||||
])
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
autotools = Autotools(self)
|
||||
if Version(self.version) > "1.2.4":
|
||||
autotools.autoreconf()
|
||||
autotools.configure()
|
||||
autotools.make()
|
||||
else:
|
||||
with chdir(self, self.source_folder):
|
||||
autotools.autoreconf()
|
||||
autotools.configure()
|
||||
autotools.make()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
if Version(self.version) > "1.2.4":
|
||||
autotools = Autotools(self)
|
||||
autotools.install()
|
||||
else:
|
||||
with chdir(self, self.source_folder):
|
||||
autotools = Autotools(self)
|
||||
autotools.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
||||
self.cpp_info.set_property("cmake_file_name", "ALSA")
|
||||
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)
|
||||
|
||||
# TODO: to remove in conan v2?
|
||||
self.cpp_info.names["cmake_find_package"] = "ALSA"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "ALSA"
|
||||
self.cpp_info.names["pkg_config"] = "alsa"
|
||||
self.env_info.ALSA_CONFIG_DIR = alsa_config_dir
|
||||
@@ -0,0 +1,25 @@
|
||||
From 81e7923fbfad45b2f353a4d6e3053af51f5f7d0b Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 15 Jun 2021 23:21:42 +0200
|
||||
Subject: [PATCH] control: empty - fix the static build
|
||||
|
||||
Reported-by: Jan Palus <atler@pld-linux.org>
|
||||
Fixes: https://github.com/alsa-project/alsa-lib/issues/157
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/control/control_empty.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/control/control_empty.c b/src/control/control_empty.c
|
||||
index 49d1026c..c9b048c1 100644
|
||||
--- a/src/control/control_empty.c
|
||||
+++ b/src/control/control_empty.c
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#ifndef PIC
|
||||
/* entry for static linking */
|
||||
-const char *_snd_module_ctl_empty = "";
|
||||
+const char *_snd_module_control_empty = "";
|
||||
#endif
|
||||
|
||||
/*! \page control_plugins
|
||||
7
recipes/libalsa/all/test_package/CMakeLists.txt
Normal file
7
recipes/libalsa/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(ALSA REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ALSA::ALSA)
|
||||
26
recipes/libalsa/all/test_package/conanfile.py
Normal file
26
recipes/libalsa/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
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()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
8
recipes/libalsa/all/test_package/test_package.c
Normal file
8
recipes/libalsa/all/test_package/test_package.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <alsa/global.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("libalsa version %s\n", snd_asoundlib_version());
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user