[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:
37
recipes/libaom-av1/all/conandata.yml
Normal file
37
recipes/libaom-av1/all/conandata.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
sources:
|
||||
"3.8.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/aom-releases/libaom-3.8.0.tar.gz"
|
||||
sha256: "a768d3e54c7f00cd38b01208d1ae52d671be410cfc387ff7881ea71c855f3600"
|
||||
"3.6.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/aom-releases/libaom-3.6.1.tar.gz"
|
||||
sha256: "42b862f58b3d00bd3902d2dc469526574f5b012e5b178e6a9652845a113d6887"
|
||||
"3.5.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/aom-releases/libaom-3.5.0.tar.gz"
|
||||
sha256: "d37dbee372e2430a7efde813984ae6d78bdf1fc4080ebe32457c9115408b0738"
|
||||
"3.4.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/aom-releases/libaom-3.4.0.tar.gz"
|
||||
sha256: "bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354"
|
||||
"2.0.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/aom-releases/libaom-2.0.1.tar.gz"
|
||||
sha256: "a0cff299621e2ef885aba219c498fa39a7d9a7ddf47585a118fd66c64ad1b312"
|
||||
patches:
|
||||
"3.8.0":
|
||||
- patch_file: "patches/0001-3.8.0-fix-install.patch"
|
||||
patch_type: conan
|
||||
patch_description: Install just aom library without aom_static.
|
||||
"3.6.1":
|
||||
- patch_file: "patches/0001-3.4.0-fix-install.patch"
|
||||
patch_type: conan
|
||||
patch_description: Install just aom library without aom_static.
|
||||
"3.5.0":
|
||||
- patch_file: "patches/0001-3.4.0-fix-install.patch"
|
||||
patch_type: conan
|
||||
patch_description: Install just aom library without aom_static.
|
||||
"3.4.0":
|
||||
- patch_file: "patches/0001-3.4.0-fix-install.patch"
|
||||
patch_type: conan
|
||||
patch_description: Install just aom library without aom_static.
|
||||
"2.0.1":
|
||||
- patch_file: "patches/0001-2.0.1-fix-install.patch"
|
||||
patch_type: conan
|
||||
patch_description: Install just aom library without aom_static.
|
||||
102
recipes/libaom-av1/all/conanfile.py
Normal file
102
recipes/libaom-av1/all/conanfile.py
Normal file
@@ -0,0 +1,102 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class LibaomAv1Conan(ConanFile):
|
||||
name = "libaom-av1"
|
||||
description = "AV1 Codec Library"
|
||||
topics = ("av1", "codec", "video", "encoding", "decoding")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://aomedia.googlesource.com/aom"
|
||||
license = "BSD-2-Clause"
|
||||
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"assembly": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"assembly": False,
|
||||
}
|
||||
|
||||
@property
|
||||
def _settings_build(self):
|
||||
return getattr(self, "settings_build", self.settings)
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
if self.settings.arch not in ("x86", "x86_64"):
|
||||
del self.options.assembly
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
|
||||
def build_requirements(self):
|
||||
if self.options.get_safe("assembly", False):
|
||||
self.tool_requires("nasm/[>=2.15.05]")
|
||||
if self._settings_build.os == "Windows":
|
||||
self.tool_requires("strawberryperl/5.32.1.1")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=Version(self.version) >= "3.3.0")
|
||||
|
||||
def generate(self):
|
||||
env = VirtualBuildEnv(self)
|
||||
env.generate()
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["ENABLE_EXAMPLES"] = False
|
||||
tc.variables["ENABLE_TESTS"] = False
|
||||
tc.variables["ENABLE_DOCS"] = False
|
||||
tc.variables["ENABLE_TOOLS"] = False
|
||||
if not self.options.get_safe("assembly", False):
|
||||
# make non-assembly build
|
||||
tc.variables["AOM_TARGET_CPU"] = "generic"
|
||||
# libyuv is used for examples, tests and non-essential 'dump_obu' tool so it is disabled
|
||||
# required to be 1/0 instead of False
|
||||
tc.variables["CONFIG_LIBYUV"] = 0
|
||||
# webm is not yet packaged
|
||||
tc.variables["CONFIG_WEBM_IO"] = 0
|
||||
# Requires C99 or higher
|
||||
tc.variables["CMAKE_C_STANDARD"] = "99"
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("pkg_config_name", "aom")
|
||||
lib = "aom"
|
||||
if Version(self.version) >= "3.8.0" and self.settings.os == "Windows" and self.options.shared:
|
||||
lib = "aom_dll"
|
||||
self.cpp_info.libs = [lib]
|
||||
if self.settings.os in ("FreeBSD", "Linux"):
|
||||
self.cpp_info.system_libs = ["pthread", "m"]
|
||||
34
recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch
Normal file
34
recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
--- a/build/cmake/aom_install.cmake
|
||||
+++ b/build/cmake/aom_install.cmake
|
||||
@@ -27,7 +27,7 @@ endif()
|
||||
# Note: aom.pc generation uses GNUInstallDirs:
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
macro(setup_aom_install_targets)
|
||||
- if(NOT (MSVC OR XCODE))
|
||||
+ if(1)
|
||||
include("GNUInstallDirs")
|
||||
set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc")
|
||||
|
||||
@@ -73,7 +73,8 @@ macro(setup_aom_install_targets)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
- set(AOM_INSTALL_LIBS aom aom_static)
|
||||
+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static)
|
||||
+ set(AOM_INSTALL_LIBS aom)
|
||||
else()
|
||||
set(AOM_INSTALL_LIBS aom)
|
||||
endif()
|
||||
@@ -85,8 +86,10 @@ macro(setup_aom_install_targets)
|
||||
install(
|
||||
FILES "${AOM_PKG_CONFIG_FILE}"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
- install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION
|
||||
- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
+ install(TARGETS ${AOM_INSTALL_LIBS}
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if(ENABLE_EXAMPLES)
|
||||
install(TARGETS ${AOM_INSTALL_BINS} DESTINATION
|
||||
21
recipes/libaom-av1/all/patches/0001-3.4.0-fix-install.patch
Normal file
21
recipes/libaom-av1/all/patches/0001-3.4.0-fix-install.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
--- a/build/cmake/aom_install.cmake
|
||||
+++ b/build/cmake/aom_install.cmake
|
||||
@@ -27,7 +27,7 @@ endif()
|
||||
# Note: aom.pc generation uses GNUInstallDirs:
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
macro(setup_aom_install_targets)
|
||||
- if(NOT XCODE)
|
||||
+ if(1)
|
||||
include("GNUInstallDirs")
|
||||
set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc")
|
||||
|
||||
@@ -78,7 +78,8 @@ macro(setup_aom_install_targets)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
- set(AOM_INSTALL_LIBS aom aom_static)
|
||||
+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static)
|
||||
+ set(AOM_INSTALL_LIBS aom)
|
||||
else()
|
||||
set(AOM_INSTALL_LIBS aom)
|
||||
endif()
|
||||
21
recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch
Normal file
21
recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
--- build/cmake/aom_install.cmake
|
||||
+++ build/cmake/aom_install.cmake
|
||||
@@ -27,7 +27,7 @@
|
||||
# Note: aom.pc generation uses GNUInstallDirs:
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
macro(setup_aom_install_targets)
|
||||
- if(NOT XCODE)
|
||||
+ if(1)
|
||||
include("GNUInstallDirs")
|
||||
set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc")
|
||||
|
||||
@@ -79,7 +79,8 @@
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
- set(AOM_INSTALL_LIBS aom aom_static)
|
||||
+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static)
|
||||
+ set(AOM_INSTALL_LIBS aom)
|
||||
else()
|
||||
set(AOM_INSTALL_LIBS aom)
|
||||
endif()
|
||||
7
recipes/libaom-av1/all/test_package/CMakeLists.txt
Normal file
7
recipes/libaom-av1/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(libaom-av1 REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libaom-av1::libaom-av1)
|
||||
26
recipes/libaom-av1/all/test_package/conanfile.py
Normal file
26
recipes/libaom-av1/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")
|
||||
7
recipes/libaom-av1/all/test_package/test_package.c
Normal file
7
recipes/libaom-av1/all/test_package/test_package.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "aom/aom_codec.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Version: %s\n", aom_codec_version_str());
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user