[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:
Aleksandr Vodyanov
2024-12-25 17:47:28 +03:00
parent e58f90de0e
commit 39afe6a1dd
212 changed files with 9263 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
sources:
"cci.20231129":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/pytorch/cpuinfo/archive/9d809924011af8ff49dadbda1499dc5193f1659c.tar.gz"
sha256: "0d769b7e3cc7d16205f4cc8988f869910db19f2d274db005c1ed74e961936d34"
"cci.20230118":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/pytorch/cpuinfo/archive/3dc310302210c1891ffcfb12ae67b11a3ad3a150.tar.gz"
sha256: "f2f4df6d2b01036f36c5e372954e536881cdd59f5c2461c67aa0a92c6d755c61"
"cci.20220618":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/pytorch/cpuinfo/archive/082deffc80ce517f81dc2f3aebe6ba671fcd09c9.tar.gz"
sha256: "4379348ec3127b37e854a0a66f85ea1d3c606e5f3a6dce235dc9c69ce663c026"
"cci.20220228":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/pytorch/cpuinfo/archive/6288930068efc8dff4f3c0b95f062fc5ddceba04.tar.gz"
sha256: "9e9e937b3569320d23d8b1c8c26ed3603affe55c3e4a3e49622e8a2c6d6e1696"
"cci.20201217":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/pytorch/cpuinfo/archive/5916273f79a21551890fd3d56fc5375a78d1598d.tar.gz"
sha256: "f3c16d5d393d6d1fa6b6ed8621dd0a535552df9bc88cbba739375dde38a93142"

View File

@@ -0,0 +1,113 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file, rmdir
from conan.tools.microsoft import is_msvc
import os
required_conan_version = ">=1.53.0"
class CpuinfoConan(ConanFile):
name = "cpuinfo"
description = "cpuinfo is a library to detect essential for performance " \
"optimization information about host CPU."
license = "BSD-2-Clause"
topics = ("cpu", "cpuid", "cpu-cache", "cpu-model", "instruction-set", "cpu-topology")
homepage = "https://github.com/pytorch/cpuinfo"
url = "https://github.com/conan-io/conan-center-index"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"log_level": ["default", "debug", "info", "warning", "error", "fatal", "none"],
}
default_options = {
"shared": False,
"fPIC": True,
"log_level": "default",
}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if is_msvc(self):
# Only static for msvc
# Injecting CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is not sufficient since there are global symbols
del self.options.shared
self.package_type = "static-library"
if self.options.get_safe("shared"):
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
# cpuinfo
tc.cache_variables["CPUINFO_LIBRARY_TYPE"] = "default"
tc.cache_variables["CPUINFO_RUNTIME_TYPE"] = "default"
tc.cache_variables["CPUINFO_LOG_LEVEL"] = self.options.log_level
tc.variables["CPUINFO_BUILD_TOOLS"] = False
tc.variables["CPUINFO_BUILD_UNIT_TESTS"] = False
tc.variables["CPUINFO_BUILD_MOCK_TESTS"] = False
tc.variables["CPUINFO_BUILD_BENCHMARKS"] = False
# clog (always static)
tc.cache_variables["CLOG_RUNTIME_TYPE"] = "default"
tc.variables["CLOG_BUILD_TESTS"] = False
tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)
tc.generate()
def _patch_sources(self):
cmakelists = os.path.join(self.source_folder, "CMakeLists.txt")
# Fix install dir of dll
replace_in_file(
self,
cmakelists,
"LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}",
"LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}",
)
if self.version < "cci.20230118":
# Honor fPIC option
replace_in_file(self, cmakelists, "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", "")
def build(self):
self._patch_sources()
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"))
rmdir(self, os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "cpuinfo")
self.cpp_info.set_property("pkg_config_name", "libcpuinfo")
if self.version < "cci.20230118":
self.cpp_info.components["clog"].libs = ["clog"]
cpuinfo_clog_target = "clog" if self.version < "cci.20220618" else "cpuinfo::clog"
self.cpp_info.components["clog"].set_property("cmake_target_name", cpuinfo_clog_target)
self.cpp_info.components["cpuinfo"].set_property("cmake_target_name", "cpuinfo::cpuinfo")
self.cpp_info.components["cpuinfo"].libs = ["cpuinfo"]
if self.version < "cci.20230118":
self.cpp_info.components["cpuinfo"].requires = ["clog"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["cpuinfo"].system_libs.append("pthread")
if self.settings.os == "Android":
self.cpp_info.components["cpuinfo"].system_libs.append("log")

View File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES C)
find_package(cpuinfo REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
if ((${CPUINFO_VERSION} GREATER_EQUAL "20220618") AND (${CPUINFO_VERSION} LESS "20230118"))
# in that version range cpuinfo exposed cpuinfo::clog. Check that is available through conan recipe
target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo cpuinfo::clog)
else ()
target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo)
endif()
target_compile_features(${PROJECT_NAME} PRIVATE c_std_99)

View File

@@ -0,0 +1,31 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["CPUINFO_VERSION"] = str(self.dependencies["cpuinfo"].ref.version).split('.')[1]
tc.generate()
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")

View File

@@ -0,0 +1,23 @@
#include <cpuinfo.h>
#include <stdio.h>
int main() {
bool initialized = cpuinfo_initialize();
if (!initialized) {
printf("cpuinfo doesn't support this platforn\n");
return 0;
}
printf("processors count: %u\n", cpuinfo_get_processors_count());
printf("cores count: %u\n", cpuinfo_get_cores_count());
printf("clusters count: %u\n", cpuinfo_get_clusters_count());
printf("packages count: %u\n", cpuinfo_get_packages_count());
printf("uarchs count: %u\n", cpuinfo_get_uarchs_count());
printf("l1i caches count: %u\n", cpuinfo_get_l1i_caches_count());
printf("l1d caches count: %u\n", cpuinfo_get_l1d_caches_count());
printf("l2 count: %u\n", cpuinfo_get_l2_caches_count());
printf("l3 count: %u\n", cpuinfo_get_l3_caches_count());
printf("l4 count: %u\n", cpuinfo_get_l4_caches_count());
cpuinfo_deinitialize();
return 0;
}

View File

@@ -0,0 +1,11 @@
versions:
"cci.20231129":
folder: all
"cci.20230118":
folder: all
"cci.20220618":
folder: all
"cci.20220228":
folder: all
"cci.20201217":
folder: all

View File

@@ -0,0 +1,13 @@
sources:
"1.4.3":
url: "http://code.videolan.org/videolan/dav1d/-/archive/1.4.3/dav1d-1.4.3.tar.gz"
sha256: "88a023e58d955e0886faf49c72940e0e90914a948a8e60c1326ce3e09e7a6099"
"1.4.1":
url: "http://code.videolan.org/videolan/dav1d/-/archive/1.4.1/dav1d-1.4.1.tar.gz"
sha256: "8d407dd5fe7986413c937b14e67f36aebd06e1fa5cfec679d10e548476f2d5f8"
"1.3.0":
url: "http://code.videolan.org/videolan/dav1d/-/archive/1.3.0/dav1d-1.3.0.tar.gz"
sha256: "6d8be2741c505c47f8f1ced3c9cc427759243436553d01d1acce201f87b39e71"
"1.2.1":
url: "http://code.videolan.org/videolan/dav1d/-/archive/1.2.1/dav1d-1.2.1.tar.gz"
sha256: "4e33eb61ec54c768a16da0cf8fa0928b4c4593f5f804a3c887d4a21c318340b2"

View File

@@ -0,0 +1,128 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import copy, get, replace_in_file, rm, rmdir
from conan.tools.layout import basic_layout
from conan.tools.meson import Meson, MesonToolchain
from conan.tools.microsoft import is_msvc
import os
required_conan_version = ">=1.53.0"
class Dav1dConan(ConanFile):
name = "dav1d"
description = "dav1d is a new AV1 cross-platform decoder, open-source, and focused on speed, size and correctness."
homepage = "https://www.videolan.org/projects/dav1d.html"
topics = ("av1", "codec", "video", "decoding")
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"bit_depth": ["all", 8, 16],
"with_tools": [True, False],
"assembly": [True, False],
"with_avx512": ["deprecated", True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"bit_depth": "all",
"with_tools": True,
"assembly": True,
"with_avx512": "deprecated",
}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if is_msvc(self) and self.settings.build_type == "Debug":
# debug builds with assembly often causes linker hangs or LNK1000
self.options.assembly = False
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 layout(self):
basic_layout(self, src_folder="src")
def package_id(self):
del self.info.options.with_avx512
def validate(self):
if self.options.with_avx512 != "deprecated":
self.output.warning("The 'with_avx512' option is deprecated and has no effect")
def build_requirements(self):
# self.tool_requires("meson/1.4.0")
if self.options.assembly:
self.tool_requires("nasm/2.16.01")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = MesonToolchain(self)
tc.project_options["enable_tests"] = False
tc.project_options["enable_asm"] = self.options.assembly
tc.project_options["enable_tools"] = self.options.with_tools
if self.options.bit_depth == "all":
tc.project_options["bitdepths"] = "8,16"
else:
tc.project_options["bitdepths"] = str(self.options.bit_depth)
tc.generate()
def _patch_sources(self):
replace_in_file(self, os.path.join(self.source_folder, "meson.build"),
"subdir('doc')", "")
def build(self):
self._patch_sources()
meson = Meson(self)
meson.configure()
meson.build()
def package(self):
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
meson = Meson(self)
meson.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
fix_apple_shared_install_name(self)
fix_msvc_libname(self)
def package_info(self):
self.cpp_info.set_property("pkg_config_name", "dav1d")
self.cpp_info.libs = ["dav1d"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.extend(["dl", "pthread"])
# TODO: to remove in conan v2
if self.options.with_tools:
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
def fix_msvc_libname(conanfile, remove_lib_prefix=True):
"""remove lib prefix & change extension to .lib in case of cl like compiler"""
from conan.tools.files import rename
import glob
if not conanfile.settings.get_safe("compiler.runtime"):
return
libdirs = getattr(conanfile.cpp.package, "libdirs")
for libdir in libdirs:
for ext in [".dll.a", ".dll.lib", ".a"]:
full_folder = os.path.join(conanfile.package_folder, libdir)
for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")):
libname = os.path.basename(filepath)[0:-len(ext)]
if remove_lib_prefix and libname[0:3] == "lib":
libname = libname[3:]
rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib"))

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)
find_package(dav1d REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE dav1d::dav1d)

View 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")

View File

@@ -0,0 +1,9 @@
#include "dav1d/dav1d.h"
#include <stdio.h>
int main()
{
printf("dav1d version: %s\n", dav1d_version());
return 0;
}

9
recipes/dav1d/config.yml Normal file
View File

@@ -0,0 +1,9 @@
versions:
"1.4.3":
folder: "all"
"1.4.1":
folder: "all"
"1.3.0":
folder: "all"
"1.2.1":
folder: "all"

View File

@@ -0,0 +1,62 @@
sources:
"7.0.1":
url: "https://ffmpeg.org//releases/ffmpeg-7.0.1.tar.bz2"
sha256: "5e77e84b6434d656106fafe3bceccc77176449014f3eba24d33db3fbd0939dc9"
"6.1.1":
url: "https://ffmpeg.org/releases/ffmpeg-6.1.1.tar.bz2"
sha256: "5e3133939a61ef64ac9b47ffd29a5ea6e337a4023ef0ad972094b4da844e3a20"
"6.1":
url: "https://ffmpeg.org/releases/ffmpeg-6.1.tar.bz2"
sha256: "eb7da3de7dd3ce48a9946ab447a7346bd11a3a85e6efb8f2c2ce637e7f547611"
"6.0.1":
url: "https://ffmpeg.org/releases/ffmpeg-6.0.1.tar.bz2"
sha256: "2c6e294569d1ba8e99cbf1acbe49e060a23454228a540a0f45d679d72ec69a06"
"5.1.3":
url: "https://ffmpeg.org/releases/ffmpeg-5.1.3.tar.bz2"
sha256: "5d5bef6a11f0c500588f9870ec965a30acc0d54d8b1e535da6554a32902d236d"
"5.0.3":
url: "https://ffmpeg.org/releases/ffmpeg-5.0.3.tar.bz2"
sha256: "664e8fa8ac4cc5dce03277f022798461998d9bb8d96b9e1859b24e74511229fd"
"4.4.4":
url: "https://ffmpeg.org/releases/ffmpeg-4.4.4.tar.bz2"
sha256: "47b1fbf70a2c090d9c0fae5910da11c6406ca92408bb69d8c935cd46c622c7ce"
patches:
"5.1.3":
- patch_file: "patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch"
patch_description: "Compatibility with libsvtav1 > 1.2.0"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/031f1561cd286596cdb374da32f8aa816ce3b135"
- patch_file: "patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch"
patch_description: "Compatibility with libsvtav1 > 1.2.0"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/1c6fd7d756afe0f8b7df14dbf7a95df275f8f5ee"
- patch_file: "patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch"
patch_description: "Compatibility with libsvtav1 > 1.2.0"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/96748ac54f998ba6fe22802799c16b4eba8d4ccc"
- patch_file: "patches/5.0-0001-fix-hwcontext_vulkan.patch"
patch_description: "Compatibility with vulkan >= 1.3.239"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/eb0455d64690eed0068e5cb202f72ecdf899837c"
- patch_file: "patches/5.1-0004-fix-binutils.patch"
patch_description: "Compatibility with binutils >= 2.41"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb"
"5.0.3":
- patch_file: "patches/5.0-0001-fix-hwcontext_vulkan.patch"
patch_description: "Compatibility with vulkan >= 1.3.239"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/eb0455d64690eed0068e5cb202f72ecdf899837c"
- patch_file: "patches/5.1-0004-fix-binutils.patch"
patch_description: "Compatibility with binutils >= 2.41"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb"
"4.4.4":
- patch_file: "patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch"
patch_description: "Compatibility with shared libaom"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/d92fdc714496d43234733c315894abe0beeb3529"
- patch_file: "patches/5.1-0004-fix-binutils.patch"
patch_description: "Compatibility with binutils >= 2.41"
patch_type: "portability"
patch_source: "https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/effadce6c756247ea8bae32dc13bb3e6f464f0eb"

View File

@@ -0,0 +1,937 @@
from conan import ConanFile, conan_version
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import cross_building
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import (
apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename,
replace_in_file, rm, rmdir, save, load
)
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.microsoft import check_min_vs, is_msvc, unix_path
from conan.tools.scm import Version
import os
import glob
import shutil
import re
required_conan_version = ">=1.57.0"
class FFMpegConan(ConanFile):
name = "ffmpeg"
url = "https://github.com/conan-io/conan-center-index"
description = "A complete, cross-platform solution to record, convert and stream audio and video"
# https://github.com/FFmpeg/FFmpeg/blob/master/LICENSE.md
license = ("LGPL-2.1-or-later", "GPL-2.0-or-later")
homepage = "https://ffmpeg.org"
topics = ("multimedia", "audio", "video", "encoder", "decoder", "encoding", "decoding",
"transcoding", "multiplexer", "demultiplexer", "streaming")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"avdevice": [True, False],
"avcodec": [True, False],
"avformat": [True, False],
"swresample": [True, False],
"swscale": [True, False],
"postproc": [True, False],
"avfilter": [True, False],
"with_asm": [True, False],
"with_zlib": [True, False],
"with_bzip2": [True, False],
"with_lzma": [True, False],
"with_libiconv": [True, False],
"with_freetype": [True, False],
"with_openjpeg": [True, False],
"with_openh264": [True, False],
"with_opus": [True, False],
"with_vorbis": [True, False],
"with_zeromq": [True, False],
"with_sdl": [True, False],
"with_libx264": [True, False],
"with_libx265": [True, False],
"with_libvpx": [True, False],
"with_libmp3lame": [True, False],
"with_libfdk_aac": [True, False],
"with_libwebp": [True, False],
"with_ssl": [False, "openssl", "securetransport"],
"with_libalsa": [True, False],
"with_pulse": [True, False],
"with_vaapi": [True, False],
"with_vdpau": [True, False],
"with_vulkan": [True, False],
"with_xcb": [True, False],
"with_appkit": [True, False],
"with_avfoundation": [True, False],
"with_coreimage": [True, False],
"with_audiotoolbox": [True, False],
"with_videotoolbox": [True, False],
"with_programs": [True, False],
"with_libsvtav1": [True, False],
"with_libaom": [True, False],
"with_libdav1d": [True, False],
"with_libdrm": [True, False],
"with_jni": [True, False],
"with_mediacodec": [True, False],
"with_xlib": [True, False],
"disable_everything": [True, False],
"disable_all_encoders": [True, False],
"disable_encoders": [None, "ANY"],
"enable_encoders": [None, "ANY"],
"disable_all_decoders": [True, False],
"disable_decoders": [None, "ANY"],
"enable_decoders": [None, "ANY"],
"disable_all_hardware_accelerators": [True, False],
"disable_hardware_accelerators": [None, "ANY"],
"enable_hardware_accelerators": [None, "ANY"],
"disable_all_muxers": [True, False],
"disable_muxers": [None, "ANY"],
"enable_muxers": [None, "ANY"],
"disable_all_demuxers": [True, False],
"disable_demuxers": [None, "ANY"],
"enable_demuxers": [None, "ANY"],
"disable_all_parsers": [True, False],
"disable_parsers": [None, "ANY"],
"enable_parsers": [None, "ANY"],
"disable_all_bitstream_filters": [True, False],
"disable_bitstream_filters": [None, "ANY"],
"enable_bitstream_filters": [None, "ANY"],
"disable_all_protocols": [True, False],
"disable_protocols": [None, "ANY"],
"enable_protocols": [None, "ANY"],
"disable_all_devices": [True, False],
"disable_all_input_devices": [True, False],
"disable_input_devices": [None, "ANY"],
"enable_input_devices": [None, "ANY"],
"disable_all_output_devices": [True, False],
"disable_output_devices": [None, "ANY"],
"enable_output_devices": [None, "ANY"],
"disable_all_filters": [True, False],
"disable_filters": [None, "ANY"],
"enable_filters": [None, "ANY"],
}
default_options = {
"shared": False,
"fPIC": True,
"avdevice": True,
"avcodec": True,
"avformat": True,
"swresample": True,
"swscale": True,
"postproc": True,
"avfilter": True,
"with_asm": True,
"with_zlib": True,
"with_bzip2": True,
"with_lzma": True,
"with_libiconv": True,
"with_freetype": True,
"with_openjpeg": True,
"with_openh264": True,
"with_opus": True,
"with_vorbis": True,
"with_zeromq": False,
"with_sdl": False,
"with_libx264": True,
"with_libx265": True,
"with_libvpx": True,
"with_libmp3lame": True,
"with_libfdk_aac": True,
"with_libwebp": True,
"with_ssl": "openssl",
"with_libalsa": True,
"with_pulse": True,
"with_vaapi": True,
"with_vdpau": True,
"with_vulkan": False,
"with_xcb": True,
"with_appkit": True,
"with_avfoundation": True,
"with_coreimage": True,
"with_audiotoolbox": True,
"with_videotoolbox": True,
"with_programs": False,
"with_libsvtav1": True,
"with_libaom": True,
"with_libdav1d": True,
"with_libdrm": False,
"with_jni": False,
"with_mediacodec": False,
"with_xlib": True,
"disable_everything": False,
"disable_all_encoders": False,
"disable_encoders": None,
"enable_encoders": None,
"disable_all_decoders": False,
"disable_decoders": None,
"enable_decoders": None,
"disable_all_hardware_accelerators": False,
"disable_hardware_accelerators": None,
"enable_hardware_accelerators": None,
"disable_all_muxers": False,
"disable_muxers": None,
"enable_muxers": None,
"disable_all_demuxers": False,
"disable_demuxers": None,
"enable_demuxers": None,
"disable_all_parsers": False,
"disable_parsers": None,
"enable_parsers": None,
"disable_all_bitstream_filters": False,
"disable_bitstream_filters": None,
"enable_bitstream_filters": None,
"disable_all_protocols": False,
"disable_protocols": None,
"enable_protocols": None,
"disable_all_devices": False,
"disable_all_input_devices": False,
"disable_input_devices": None,
"enable_input_devices": None,
"disable_all_output_devices": False,
"disable_output_devices": None,
"enable_output_devices": None,
"disable_all_filters": False,
"disable_filters": None,
"enable_filters": None,
}
@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)
@property
def _dependencies(self):
return {
"avformat": ["avcodec"],
"avdevice": ["avcodec", "avformat"],
"avfilter": ["avformat"],
"with_bzip2": ["avformat"],
"with_ssl": ["avformat"],
"with_zlib": ["avcodec"],
"with_lzma": ["avcodec"],
"with_libiconv": ["avcodec"],
"with_openjpeg": ["avcodec"],
"with_openh264": ["avcodec"],
"with_vorbis": ["avcodec"],
"with_opus": ["avcodec"],
"with_libx264": ["avcodec"],
"with_libx265": ["avcodec"],
"with_libvpx": ["avcodec"],
"with_libmp3lame": ["avcodec"],
"with_libfdk_aac": ["avcodec"],
"with_libwebp": ["avcodec"],
"with_freetype": ["avfilter"],
"with_zeromq": ["avfilter", "avformat"],
"with_libalsa": ["avdevice"],
"with_xcb": ["avdevice"],
"with_pulse": ["avdevice"],
"with_sdl": ["with_programs"],
"with_libsvtav1": ["avcodec"],
"with_libaom": ["avcodec"],
"with_libdav1d": ["avcodec"],
"with_mediacodec": ["with_jni"],
"with_xlib": ["avdevice"],
}
@property
def _version_supports_libsvtav1(self):
return Version(self.version) >= "5.1.0"
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.settings.os not in ["Linux", "FreeBSD"]:
del self.options.with_vaapi
del self.options.with_vdpau
del self.options.with_vulkan
del self.options.with_xcb
del self.options.with_libalsa
del self.options.with_pulse
del self.options.with_xlib
del self.options.with_libdrm
if self.settings.os != "Macos":
del self.options.with_appkit
if self.settings.os not in ["Macos", "iOS", "tvOS"]:
del self.options.with_coreimage
del self.options.with_audiotoolbox
del self.options.with_videotoolbox
if not is_apple_os(self):
del self.options.with_avfoundation
if not self.settings.os == "Android":
del self.options.with_jni
del self.options.with_mediacodec
if not self._version_supports_libsvtav1:
self.options.rm_safe("with_libsvtav1")
if self.settings.os == "Android":
del self.options.with_libfdk_aac
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 layout(self):
basic_layout(self, src_folder="src")
def requirements(self):
if self.options.with_zlib:
self.requires("zlib/[>=1.2.11 <2]")
if self.options.with_bzip2:
self.requires("bzip2/1.0.8")
if self.options.with_lzma:
self.requires("xz_utils/5.4.5")
if self.options.with_libiconv:
self.requires("libiconv/1.17")
if self.options.with_freetype:
self.requires("freetype/2.13.2")
if self.options.with_openjpeg:
self.requires("openjpeg/2.5.2")
if self.options.with_openh264:
self.requires("openh264/2.4.1")
if self.options.with_vorbis:
self.requires("vorbis/1.3.7")
if self.options.with_opus:
self.requires("opus/1.4")
if self.options.with_zeromq:
self.requires("zeromq/4.3.5")
if self.options.with_sdl:
self.requires("sdl/2.28.5")
if self.options.with_libx264:
self.requires("libx264/cci.20240224")
if self.options.with_libx265:
self.requires("libx265/3.4")
if self.options.with_libvpx:
self.requires("libvpx/1.14.1")
if self.options.with_libmp3lame:
self.requires("libmp3lame/3.100")
if self.options.get_safe("with_libfdk_aac"):
self.requires("libfdk_aac/2.0.3")
if self.options.with_libwebp:
self.requires("libwebp/1.3.2")
if self.options.with_ssl == "openssl":
self.requires("openssl/[>=1.1 <4]")
if self.options.get_safe("with_libalsa"):
self.requires("libalsa/1.2.10")
if self.options.get_safe("with_xcb") or self.options.get_safe("with_xlib"):
self.requires("xorg/system")
if self.options.get_safe("with_pulse"):
self.requires("pulseaudio/14.2")
if self.options.get_safe("with_vaapi"):
self.requires("vaapi/system")
if self.options.get_safe("with_vdpau"):
self.requires("vdpau/system")
if self.options.get_safe("with_vulkan"):
self.requires("vulkan-loader/1.3.243.0")
if self.options.get_safe("with_libsvtav1"):
self.requires("libsvtav1/2.1.0")
if self.options.with_libaom:
self.requires("libaom-av1/3.6.1")
if self.options.get_safe("with_libdav1d"):
self.requires("dav1d/1.4.3")
if self.options.get_safe("with_libdrm"):
self.requires("libdrm/2.4.119")
def validate(self):
if self.options.with_ssl == "securetransport" and not is_apple_os(self):
raise ConanInvalidConfiguration(
"securetransport is only available on Apple")
for dependency, features in self._dependencies.items():
if not self.options.get_safe(dependency):
continue
used = False
for feature in features:
used = used or self.options.get_safe(feature)
if not used:
raise ConanInvalidConfiguration("FFmpeg '{}' option requires '{}' option to be enabled".format(
dependency, "' or '".join(features)))
if Version(self.version) >= "6.1" and conan_version.major == 1 and is_msvc(self) and self.options.shared:
# Linking fails with "Argument list too long" for some reason on Conan v1
raise ConanInvalidConfiguration("MSVC shared build is not supported for Conan v1")
if Version(self.version) == "7.0.1" and self.settings.build_type == "Debug":
# FIXME: FFMpeg fails to build in Debug mode with the following error:
# ld: libavcodec/libavcodec.a(vvcdsp_init.o): in function `ff_vvc_put_pixels2_8_sse4':
# src/libavcodec/x86/vvc/vvcdsp_init.c:69: undefined reference to `ff_h2656_put_pixels2_8_sse4'
# May be related https://github.com/ffvvc/FFmpeg/issues/234
raise ConanInvalidConfiguration(f"{self.ref} Conan recipe does not support build_type=Debug. Contributions are welcome to fix this issue.")
def build_requirements(self):
if self.settings.arch in ("x86", "x86_64"):
#if Version(self.version) >= "7.0":
# INFO: FFmpeg 7.0+ added avcodec vvc_mc.asm which fails to assemble with yasm 1.3.0
# src/libavcodec/x86/vvc/vvc_mc.asm:55: error: operand 1: expression is not simple or relocatable
# self.tool_requires("nasm/2.16.01")
#else:
#self.tool_requires("yasm/1.3.0")
self.tool_requires("nasm/[>=2.16.01]")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/[>=2.1.0]")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
@property
def _target_arch(self):
# Taken from acceptable values https://github.com/FFmpeg/FFmpeg/blob/0684e58886881a998f1a7b510d73600ff1df2b90/configure#L5010
if str(self.settings.arch).startswith("armv8"):
return "aarch64"
elif self.settings.arch == "x86":
return "i686"
return str(self.settings.arch)
@property
def _target_os(self):
if self.settings.os == "Windows":
return "mingw32" if self.settings.compiler == "gcc" else "win32"
elif is_apple_os(self):
return "darwin"
# Taken from https://github.com/FFmpeg/FFmpeg/blob/0684e58886881a998f1a7b510d73600ff1df2b90/configure#L5485
# This is the map of Conan OS settings to FFmpeg acceptable values
return {
"AIX": "aix",
"Android": "android",
"FreeBSD": "freebsd",
"Linux": "linux",
"Neutrino": "qnx",
"SunOS": "sunos",
}.get(str(self.settings.os), "none")
def _patch_sources(self):
apply_conandata_patches(self)
if Version(self.version) < "5.1":
# suppress MSVC linker warnings: https://trac.ffmpeg.org/ticket/7396
# warning LNK4049: locally defined symbol x264_levels imported
# warning LNK4049: locally defined symbol x264_bit_depth imported
replace_in_file(self, os.path.join(self.source_folder, "libavcodec", "libx264.c"),
"#define X264_API_IMPORTS 1", "")
if self.options.with_ssl == "openssl":
# https://trac.ffmpeg.org/ticket/5675
openssl_libs = load(self, os.path.join(self.build_folder, "openssl_libs.list"))
replace_in_file(self, os.path.join(self.source_folder, "configure"),
"check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||",
f"check_lib openssl openssl/ssl.h OPENSSL_init_ssl {openssl_libs} || ")
replace_in_file(self, os.path.join(self.source_folder, "configure"), "echo libx264.lib", "echo x264.lib")
@property
def _default_compilers(self):
if self.settings.compiler == "gcc":
return {"cc": "gcc", "cxx": "g++"}
elif self.settings.compiler in ["clang", "apple-clang"]:
return {"cc": "clang", "cxx": "clang++"}
elif is_msvc(self):
return {"cc": "cl.exe", "cxx": "cl.exe"}
return {}
def _create_toolchain(self):
tc = AutotoolsToolchain(self)
# Custom configure script of ffmpeg understands:
# --prefix, --bindir, --datadir, --docdir, --incdir, --libdir, --mandir
# Options --datadir, --docdir, --incdir, and --mandir are not injected by AutotoolsToolchain but their default value
# in ffmpeg script matches expected conan install layout.
# Several options injected by AutotoolsToolchain are unknown from this configure script and must be pruned.
# This must be done before modifying tc.configure_args, because update_configre_args currently removes
# duplicate configuration keys, even when they have different values, such as list of encoder flags.
# See https://github.com/conan-io/conan-center-index/issues/17140 for further information.
tc.update_configure_args({
"--sbindir": None,
"--includedir": None,
"--oldincludedir": None,
"--datarootdir": None,
"--build": None,
"--host": None,
"--target": None,
})
return tc
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
if not cross_building(self):
env = VirtualRunEnv(self)
env.generate(scope="build")
def opt_enable_disable(what, v):
return "--{}-{}".format("enable" if v else "disable", what)
def opt_append_disable_if_set(args, what, v):
if v:
args.append(f"--disable-{what}")
tc = self._create_toolchain()
args = [
"--pkg-config-flags=--static",
"--disable-doc",
opt_enable_disable("cross-compile", cross_building(self)),
opt_enable_disable("asm", self.options.with_asm),
# Libraries
opt_enable_disable("shared", self.options.shared),
opt_enable_disable("static", not self.options.shared),
opt_enable_disable("pic", self.options.get_safe("fPIC", True)),
# Components
opt_enable_disable("avdevice", self.options.avdevice),
opt_enable_disable("avcodec", self.options.avcodec),
opt_enable_disable("avformat", self.options.avformat),
opt_enable_disable("swresample", self.options.swresample),
opt_enable_disable("swscale", self.options.swscale),
opt_enable_disable("postproc", self.options.postproc),
opt_enable_disable("avfilter", self.options.avfilter),
# Dependencies
opt_enable_disable("bzlib", self.options.with_bzip2),
opt_enable_disable("zlib", self.options.with_zlib),
opt_enable_disable("lzma", self.options.with_lzma),
opt_enable_disable("iconv", self.options.with_libiconv),
opt_enable_disable("libopenjpeg", self.options.with_openjpeg),
opt_enable_disable("libopenh264", self.options.with_openh264),
opt_enable_disable("libvorbis", self.options.with_vorbis),
opt_enable_disable("libopus", self.options.with_opus),
opt_enable_disable("libzmq", self.options.with_zeromq),
opt_enable_disable("sdl2", self.options.with_sdl),
opt_enable_disable("libx264", self.options.with_libx264),
opt_enable_disable("libx265", self.options.with_libx265),
opt_enable_disable("libvpx", self.options.with_libvpx),
opt_enable_disable("libmp3lame", self.options.with_libmp3lame),
opt_enable_disable("libfdk-aac", self.options.get_safe("with_libfdk_aac")),
opt_enable_disable("libwebp", self.options.with_libwebp),
opt_enable_disable("libaom", self.options.with_libaom),
opt_enable_disable("openssl", self.options.with_ssl == "openssl"),
opt_enable_disable("alsa", self.options.get_safe("with_libalsa")),
opt_enable_disable("libpulse", self.options.get_safe("with_pulse")),
opt_enable_disable("vaapi", self.options.get_safe("with_vaapi")),
opt_enable_disable("libdrm", self.options.get_safe("with_libdrm")),
opt_enable_disable("vdpau", self.options.get_safe("with_vdpau")),
opt_enable_disable("libxcb", self.options.get_safe("with_xcb")),
opt_enable_disable("libxcb-shm", self.options.get_safe("with_xcb")),
opt_enable_disable("libxcb-shape", self.options.get_safe("with_xcb")),
opt_enable_disable("libxcb-xfixes", self.options.get_safe("with_xcb")),
opt_enable_disable("appkit", self.options.get_safe("with_appkit")),
opt_enable_disable("avfoundation", self.options.get_safe("with_avfoundation")),
opt_enable_disable("coreimage", self.options.get_safe("with_coreimage")),
opt_enable_disable("audiotoolbox", self.options.get_safe("with_audiotoolbox")),
opt_enable_disable("videotoolbox", self.options.get_safe("with_videotoolbox")),
opt_enable_disable("securetransport", self.options.with_ssl == "securetransport"),
opt_enable_disable("vulkan", self.options.get_safe("with_vulkan")),
opt_enable_disable("libdav1d", self.options.get_safe("with_libdav1d")),
opt_enable_disable("jni", self.options.get_safe("with_jni")),
opt_enable_disable("mediacodec", self.options.get_safe("with_mediacodec")),
opt_enable_disable("xlib", self.options.get_safe("with_xlib")),
"--disable-cuda", # FIXME: CUDA support
"--disable-cuvid", # FIXME: CUVID support
# Licenses
opt_enable_disable("nonfree", self.options.get_safe("with_libfdk_aac") or (self.options.with_ssl and (
self.options.with_libx264 or self.options.with_libx265 or self.options.postproc))),
opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc)
]
# Individual Component Options
opt_append_disable_if_set(args, "everything", self.options.disable_everything)
opt_append_disable_if_set(args, "encoders", self.options.disable_all_encoders)
opt_append_disable_if_set(args, "decoders", self.options.disable_all_decoders)
opt_append_disable_if_set(args, "hwaccels", self.options.disable_all_hardware_accelerators)
opt_append_disable_if_set(args, "muxers", self.options.disable_all_muxers)
opt_append_disable_if_set(args, "demuxers", self.options.disable_all_demuxers)
opt_append_disable_if_set(args, "parsers", self.options.disable_all_parsers)
opt_append_disable_if_set(args, "bsfs", self.options.disable_all_bitstream_filters)
opt_append_disable_if_set(args, "protocols", self.options.disable_all_protocols)
opt_append_disable_if_set(args, "devices", self.options.disable_all_devices)
opt_append_disable_if_set(args, "indevs", self.options.disable_all_input_devices)
opt_append_disable_if_set(args, "outdevs", self.options.disable_all_output_devices)
opt_append_disable_if_set(args, "filters", self.options.disable_all_filters)
args.extend(self._split_and_format_options_string(
"enable-encoder", self.options.enable_encoders))
args.extend(self._split_and_format_options_string(
"disable-encoder", self.options.disable_encoders))
args.extend(self._split_and_format_options_string(
"enable-decoder", self.options.enable_decoders))
args.extend(self._split_and_format_options_string(
"disable-decoder", self.options.disable_decoders))
args.extend(self._split_and_format_options_string(
"enable-hwaccel", self.options.enable_hardware_accelerators))
args.extend(self._split_and_format_options_string(
"disable-hwaccel", self.options.disable_hardware_accelerators))
args.extend(self._split_and_format_options_string(
"enable-muxer", self.options.enable_muxers))
args.extend(self._split_and_format_options_string(
"disable-muxer", self.options.disable_muxers))
args.extend(self._split_and_format_options_string(
"enable-demuxer", self.options.enable_demuxers))
args.extend(self._split_and_format_options_string(
"disable-demuxer", self.options.disable_demuxers))
args.extend(self._split_and_format_options_string(
"enable-parser", self.options.enable_parsers))
args.extend(self._split_and_format_options_string(
"disable-parser", self.options.disable_parsers))
args.extend(self._split_and_format_options_string(
"enable-bsf", self.options.enable_bitstream_filters))
args.extend(self._split_and_format_options_string(
"disable-bsf", self.options.disable_bitstream_filters))
args.extend(self._split_and_format_options_string(
"enable-protocol", self.options.enable_protocols))
args.extend(self._split_and_format_options_string(
"disable-protocol", self.options.disable_protocols))
args.extend(self._split_and_format_options_string(
"enable-indev", self.options.enable_input_devices))
args.extend(self._split_and_format_options_string(
"disable-indev", self.options.disable_input_devices))
args.extend(self._split_and_format_options_string(
"enable-outdev", self.options.enable_output_devices))
args.extend(self._split_and_format_options_string(
"disable-outdev", self.options.disable_output_devices))
args.extend(self._split_and_format_options_string(
"enable-filter", self.options.enable_filters))
args.extend(self._split_and_format_options_string(
"disable-filter", self.options.disable_filters))
if self._version_supports_libsvtav1:
args.append(opt_enable_disable("libsvtav1", self.options.get_safe("with_libsvtav1")))
if is_apple_os(self):
# relocatable shared libs
args.append("--install-name-dir=@rpath")
args.append(f"--arch={self._target_arch}")
if self.settings.build_type == "Debug":
args.extend([
"--disable-optimizations",
"--disable-mmx",
"--disable-stripping",
"--enable-debug",
])
if not self.options.with_programs:
args.append("--disable-programs")
# since ffmpeg"s build system ignores CC and CXX
compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict)
buildenv_vars = VirtualBuildEnv(self).vars()
nm = buildenv_vars.get("NM")
if nm:
args.append(f"--nm={unix_path(self, nm)}")
ar = buildenv_vars.get("AR")
if ar:
args.append(f"--ar={unix_path(self, ar)}")
if self.options.with_asm:
asm = compilers_from_conf.get("asm", buildenv_vars.get("AS"))
if asm:
args.append(f"--as={unix_path(self, asm)}")
strip = buildenv_vars.get("STRIP")
if strip:
args.append(f"--strip={unix_path(self, strip)}")
cc = compilers_from_conf.get("c", buildenv_vars.get("CC", self._default_compilers.get("cc")))
if cc:
args.append(f"--cc={unix_path(self, cc)}")
cxx = compilers_from_conf.get("cpp", buildenv_vars.get("CXX", self._default_compilers.get("cxx")))
if cxx:
args.append(f"--cxx={unix_path(self, cxx)}")
ld = buildenv_vars.get("LD")
if ld:
args.append(f"--ld={unix_path(self, ld)}")
ranlib = buildenv_vars.get("RANLIB")
if ranlib:
args.append(f"--ranlib={unix_path(self, ranlib)}")
# for some reason pkgconf from conan can't find .pc files on Linux in the context of ffmpeg configure...
if self._settings_build.os != "Linux":
pkg_config = self.conf.get("tools.gnu:pkg_config", default=buildenv_vars.get("PKG_CONFIG"), check_type=str)
if pkg_config:
args.append(f"--pkg-config={unix_path(self, pkg_config)}")
if is_msvc(self):
args.append("--toolchain=msvc")
if not check_min_vs(self, "190", raise_invalid=False):
# Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
tc.extra_defines.append("inline=__inline")
if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) >= "15":
# Workaround for link error "ld: building exports trie: duplicate symbol '_av_ac3_parse_header'"
tc.extra_ldflags.append("-Wl,-ld_classic")
if cross_building(self):
args.append(f"--target-os={self._target_os}")
if is_apple_os(self) and self.options.with_audiotoolbox:
args.append("--disable-outdev=audiotoolbox")
if tc.cflags:
args.append("--extra-cflags={}".format(" ".join(tc.cflags)))
if tc.ldflags:
args.append("--extra-ldflags={}".format(" ".join(tc.ldflags)))
tc.configure_args.extend(args)
tc.generate()
if is_msvc(self):
# Custom AutotoolsDeps for cl like compilers
# workaround for https://github.com/conan-io/conan/issues/12784
includedirs = []
defines = []
libs = []
libdirs = []
linkflags = []
cxxflags = []
cflags = []
for dependency in self.dependencies.values():
deps_cpp_info = dependency.cpp_info.aggregated_components()
includedirs.extend(deps_cpp_info.includedirs)
defines.extend(deps_cpp_info.defines)
libs.extend(deps_cpp_info.libs + deps_cpp_info.system_libs)
libdirs.extend(deps_cpp_info.libdirs)
linkflags.extend(deps_cpp_info.sharedlinkflags + deps_cpp_info.exelinkflags)
cxxflags.extend(deps_cpp_info.cxxflags)
cflags.extend(deps_cpp_info.cflags)
env = Environment()
env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in includedirs] + [f"-D{d}" for d in defines])
env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in libs])
env.append("LDFLAGS", [f"-LIBPATH:{unix_path(self, p)}" for p in libdirs] + linkflags)
env.append("CXXFLAGS", cxxflags)
env.append("CFLAGS", cflags)
env.vars(self).save_script("conanautotoolsdeps_cl_workaround")
else:
deps = AutotoolsDeps(self)
deps.generate()
deps = PkgConfigDeps(self)
deps.generate()
if self.options.with_ssl == "openssl":
openssl_libs = " ".join([f"-l{lib}" for lib in self.dependencies["openssl"].cpp_info.aggregated_components().libs])
save(self, os.path.join(self.build_folder, "openssl_libs.list"), openssl_libs)
def _split_and_format_options_string(self, flag_name, options_list):
if not options_list:
return []
def _format_options_list_item(flag_name, options_item):
return f"--{flag_name}={options_item}"
def _split_options_string(options_string):
return list(filter(None, "".join(options_string.split()).split(",")))
options_string = str(options_list)
return [_format_options_list_item(flag_name, item) for item in _split_options_string(options_string)]
def build(self):
self._patch_sources()
if self.options.with_libx264:
# ffmepg expects libx264.pc instead of x264.pc
with chdir(self, self.generators_folder):
shutil.copy("x264.pc", "libx264.pc")
autotools = Autotools(self)
autotools.configure()
autotools.make()
def package(self):
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
autotools = Autotools(self)
autotools.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))
if is_msvc(self):
if self.options.shared:
# ffmpeg created `.lib` files in the `/bin` folder
for fn in os.listdir(os.path.join(self.package_folder, "bin")):
if fn.endswith(".lib"):
rename(self, os.path.join(self.package_folder, "bin", fn),
os.path.join(self.package_folder, "lib", fn))
rm(self, "*.def", os.path.join(self.package_folder, "lib"))
else:
# ffmpeg produces `.a` files that are actually `.lib` files
with chdir(self, os.path.join(self.package_folder, "lib")):
for lib in glob.glob("*.a"):
rename(self, lib, lib[3:-2] + ".lib")
def _read_component_version(self, component_name):
# since 5.1, major version may be defined in version_major.h instead of version.h
component_folder = os.path.join(self.package_folder, "include", f"lib{component_name}")
version_file_name = os.path.join(component_folder, "version.h")
version_major_file_name = os.path.join(component_folder, "version_major.h")
pattern = f"define LIB{component_name.upper()}_VERSION_(MAJOR|MINOR|MICRO)[ \t]+(\\d+)"
version = dict()
for file in (version_file_name, version_major_file_name):
if os.path.isfile(file):
with open(file, "r", encoding="utf-8") as f:
for line in f:
match = re.search(pattern, line)
if match:
version[match[1]] = match[2]
if "MAJOR" in version and "MINOR" in version and "MICRO" in version:
return f"{version['MAJOR']}.{version['MINOR']}.{version['MICRO']}"
return None
def _set_component_version(self, component_name):
version = self._read_component_version(component_name)
if version is not None:
self.cpp_info.components[component_name].set_property("component_version", version)
# TODO: to remove once support of conan v1 dropped
self.cpp_info.components[component_name].version = version
else:
self.output.warning(f"cannot determine version of lib{component_name} packaged with ffmpeg!")
def package_info(self):
if self.options.with_programs:
if self.options.with_sdl:
self.cpp_info.components["programs"].requires = ["sdl::libsdl2"]
def _add_component(name, dependencies):
component = self.cpp_info.components[name]
component.set_property("pkg_config_name", f"lib{name}")
self._set_component_version(name)
component.libs = [name]
if name != "avutil":
component.requires = ["avutil"]
for dep in dependencies:
if self.options.get_safe(dep):
component.requires.append(dep)
if self.settings.os in ("FreeBSD", "Linux"):
component.system_libs.append("m")
return component
avutil = _add_component("avutil", [])
if self.options.avdevice:
avdevice = _add_component("avdevice", ["avfilter", "swscale", "avformat", "avcodec", "swresample", "postproc"])
if self.options.avfilter:
avfilter = _add_component("avfilter", ["swscale", "avformat", "avcodec", "swresample", "postproc"])
if self.options.avformat:
avformat = _add_component("avformat", ["avcodec", "swscale"])
if self.options.avcodec:
avcodec = _add_component("avcodec", ["swresample"])
if self.options.swscale:
_add_component("swscale", [])
if self.options.swresample:
_add_component("swresample", [])
if self.options.postproc:
_add_component("postproc", [])
if self.settings.os in ("FreeBSD", "Linux"):
avutil.system_libs.extend(["pthread", "dl"])
if self.options.get_safe("fPIC"):
if self.settings.compiler in ("gcc", "clang"):
# https://trac.ffmpeg.org/ticket/1713
# https://ffmpeg.org/platform.html#Advanced-linking-configuration
# https://ffmpeg.org/pipermail/libav-user/2014-December/007719.html
avcodec.exelinkflags.append("-Wl,-Bsymbolic")
avcodec.sharedlinkflags.append("-Wl,-Bsymbolic")
if self.options.avfilter:
avfilter.system_libs.append("pthread")
elif self.settings.os == "Windows":
if self.options.avcodec:
avcodec.system_libs = ["mfplat", "mfuuid", "strmiids"]
if self.options.avdevice:
avdevice.system_libs = ["ole32", "psapi", "strmiids", "uuid", "oleaut32", "shlwapi", "gdi32", "vfw32"]
avutil.system_libs = ["user32", "bcrypt"]
avformat.system_libs = ["secur32"]
elif is_apple_os(self):
if self.options.avdevice:
avdevice.frameworks = ["CoreFoundation", "Foundation", "CoreGraphics"]
if self.options.avfilter:
avfilter.frameworks = ["CoreGraphics"]
if self.options.avcodec:
avcodec.frameworks = ["CoreFoundation", "CoreVideo", "CoreMedia"]
if self.settings.os == "Macos":
if self.options.avdevice:
avdevice.frameworks.append("OpenGL")
if self.options.avfilter:
avfilter.frameworks.append("OpenGL")
if self.options.avdevice:
if self.options.get_safe("with_libalsa"):
avdevice.requires.append("libalsa::libalsa")
if self.options.get_safe("with_xcb"):
avdevice.requires.extend(["xorg::xcb", "xorg::xcb-shm", "xorg::xcb-xfixes", "xorg::xcb-shape", "xorg::xv", "xorg::xext"])
if self.options.get_safe("with_xlib"):
avdevice.requires.extend(["xorg::x11", "xorg::xext", "xorg::xv"])
if self.options.get_safe("with_pulse"):
avdevice.requires.append("pulseaudio::pulseaudio")
if self.options.get_safe("with_appkit"):
avdevice.frameworks.append("AppKit")
if self.options.get_safe("with_avfoundation"):
avdevice.frameworks.append("AVFoundation")
if self.options.get_safe("with_audiotoolbox"):
avdevice.frameworks.append("CoreAudio")
if self.settings.os == "Android" and not self.options.shared:
avdevice.system_libs.extend(["android", "camera2ndk", "mediandk"])
if self.options.avcodec:
if self.options.with_zlib:
avcodec.requires.append("zlib::zlib")
if self.options.with_lzma:
avcodec.requires.append("xz_utils::xz_utils")
if self.options.with_libiconv:
avcodec.requires.append("libiconv::libiconv")
if self.options.with_openjpeg:
avcodec.requires.append("openjpeg::openjpeg")
if self.options.with_openh264:
avcodec.requires.append("openh264::openh264")
if self.options.with_vorbis:
avcodec.requires.append("vorbis::vorbis")
if self.options.with_opus:
avcodec.requires.append("opus::opus")
if self.options.with_libx264:
avcodec.requires.append("libx264::libx264")
if self.options.with_libx265:
avcodec.requires.append("libx265::libx265")
if self.options.with_libvpx:
avcodec.requires.append("libvpx::libvpx")
if self.options.with_libmp3lame:
avcodec.requires.append("libmp3lame::libmp3lame")
if self.options.get_safe("with_libfdk_aac"):
avcodec.requires.append("libfdk_aac::libfdk_aac")
if self.options.with_libwebp:
avcodec.requires.append("libwebp::libwebp")
if self.options.get_safe("with_audiotoolbox"):
avcodec.frameworks.append("AudioToolbox")
if self.options.get_safe("with_videotoolbox"):
avcodec.frameworks.append("VideoToolbox")
if self.options.get_safe("with_libsvtav1"):
avcodec.requires.extend(["libsvtav1::decoder", "libsvtav1::encoder"])
if self.options.get_safe("with_libaom"):
avcodec.requires.append("libaom-av1::libaom-av1")
if self.options.get_safe("with_libdav1d"):
avcodec.requires.append("dav1d::dav1d")
if self.options.avformat:
if self.options.with_bzip2:
avformat.requires.append("bzip2::bzip2")
if self.options.with_zeromq:
avformat.requires.append("zeromq::libzmq")
if self.options.with_ssl == "openssl":
avformat.requires.append("openssl::ssl")
elif self.options.with_ssl == "securetransport":
avformat.frameworks.append("Security")
if self.options.avfilter:
if self.options.with_freetype:
avfilter.requires.append("freetype::freetype")
if self.options.with_zeromq:
avfilter.requires.append("zeromq::libzmq")
if self.options.get_safe("with_appkit"):
avfilter.frameworks.append("AppKit")
if self.options.get_safe("with_coreimage"):
avfilter.frameworks.append("CoreImage")
if Version(self.version) >= "5.0" and is_apple_os(self):
avfilter.frameworks.append("Metal")
if self.options.get_safe("with_libdrm"):
avutil.requires.append("libdrm::libdrm_libdrm")
if self.options.get_safe("with_vaapi"):
avutil.requires.append("vaapi::vaapi")
if self.options.get_safe("with_xcb"):
avutil.requires.append("xorg::x11")
if self.options.get_safe("with_vdpau"):
avutil.requires.append("vdpau::vdpau")
if self.options.with_ssl == "openssl":
avutil.requires.append("openssl::ssl")
if self.options.get_safe("with_vulkan"):
avutil.requires.append("vulkan-loader::vulkan-loader")

View File

@@ -0,0 +1,11 @@
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -224,7 +224,7 @@ static av_cold int aom_free(AVCodecContext *avctx)
static av_cold int av1_init(AVCodecContext *avctx)
{
- return aom_init(avctx, &aom_codec_av1_dx_algo);
+ return aom_init(avctx, aom_codec_av1_dx());
}
AVCodec ff_libaom_av1_decoder = {

View File

@@ -0,0 +1,17 @@
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -354,14 +354,6 @@ static const VulkanOptExtension optional_device_exts[] = {
{ VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY },
{ VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM },
#endif
-
- /* Video encoding/decoding */
- { VK_KHR_VIDEO_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
- { VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
};
/* Converts return values to strings */

View File

@@ -0,0 +1,22 @@
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -124,16 +124,12 @@ static int svt_print_error(void *log_ctx, EbErrorType err,
static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
{
- const int pack_mode_10bit =
- (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0;
- const size_t luma_size_8bit =
- config->source_width * config->source_height * (1 << pack_mode_10bit);
- const size_t luma_size_10bit =
- (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0;
+ const size_t luma_size = config->source_width * config->source_height *
+ (config->encoder_bit_depth > 8 ? 2 : 1);
EbSvtIOFormat *in_data;
- svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2;
+ svt_enc->raw_size = luma_size * 3 / 2;
// allocate buffer for in and out
svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf));

View File

@@ -0,0 +1,20 @@
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -179,7 +179,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
param->min_qp_allowed = avctx->qmin;
}
param->max_bit_rate = avctx->rc_max_rate;
- param->vbv_bufsize = avctx->rc_buffer_size;
+ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
if (svt_enc->crf > 0) {
param->qp = svt_enc->crf;
@@ -296,7 +296,7 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
avctx->bit_rate = param->rate_control_mode > 0 ?
param->target_bit_rate : 0;
avctx->rc_max_rate = param->max_bit_rate;
- avctx->rc_buffer_size = param->vbv_bufsize;
+ avctx->rc_buffer_size = param->maximum_buffer_size_ms * avctx->bit_rate / 1000LL;
if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) {
AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx);

View File

@@ -0,0 +1,12 @@
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -179,7 +179,8 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
param->min_qp_allowed = avctx->qmin;
}
param->max_bit_rate = avctx->rc_max_rate;
- param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
+ if (avctx->bit_rate && avctx->rc_buffer_size)
+ param->maximum_buffer_size_ms = avctx->rc_buffer_size * 1000LL / avctx->bit_rate;
if (svt_enc->crf > 0) {
param->qp = svt_enc->crf;

View File

@@ -0,0 +1,73 @@
From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 16 Jul 2023 18:18:02 +0300
Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift
instructions within inline assembly
Fixes assembling with binutil as >= 2.41
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 6298f5ed1983b..ca7e2dffc1076 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -35,12 +35,20 @@
static av_always_inline av_const int MULL(int a, int b, unsigned shift)
{
int rt, dummy;
+ if (__builtin_constant_p(shift))
__asm__ (
"imull %3 \n\t"
"shrdl %4, %%edx, %%eax \n\t"
:"=a"(rt), "=d"(dummy)
- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+ :"a"(a), "rm"(b), "i"(shift & 0x1F)
);
+ else
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+ :"a"(a), "rm"(b), "c"((uint8_t)shift)
+ );
return rt;
}
@@ -113,19 +121,31 @@ __asm__ volatile(\
// avoid +32 for shift optimization (gcc should do that ...)
#define NEG_SSR32 NEG_SSR32
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
+ if (__builtin_constant_p(s))
__asm__ ("sarl %1, %0\n\t"
: "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
);
+ else
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+ : "c" ((uint8_t)(-s))
+ );
return a;
}
#define NEG_USR32 NEG_USR32
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+ if (__builtin_constant_p(s))
__asm__ ("shrl %1, %0\n\t"
: "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
);
+ else
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+ : "c" ((uint8_t)(-s))
+ );
return a;
}

View File

@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)
find_package(ffmpeg REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avutil)
if (TARGET ffmpeg::avdevice)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVDEVICE)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avdevice)
endif ()
if (TARGET ffmpeg::avfilter)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFILTER)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avfilter)
endif ()
if (TARGET ffmpeg::avformat)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFORMAT)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avformat)
endif ()
if (TARGET ffmpeg::avcodec)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVCODEC)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avcodec)
endif ()
if (TARGET ffmpeg::swscale)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWSCALE)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swscale)
endif ()
if (TARGET ffmpeg::swresample)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWRESAMPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swresample)
endif ()
if (TARGET ffmpeg::postproc)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_POSTPROC)
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::postproc)
endif ()

View 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 = "CMakeDeps", "CMakeToolchain", "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")

View File

@@ -0,0 +1,55 @@
#ifdef HAVE_FFMPEG_AVCODEC
# include <libavcodec/avcodec.h>
#endif
#ifdef HAVE_FFMPEG_AVFORMAT
# include <libavformat/avformat.h>
#endif
#ifdef HAVE_FFMPEG_AVFILTER
# include <libavfilter/avfilter.h>
#endif
#ifdef HAVE_FFMPEG_AVDEVICE
# include <libavdevice/avdevice.h>
#endif
#ifdef HAVE_FFMPEG_SWRESAMPLE
# include <libswresample/swresample.h>
#endif
#ifdef HAVE_FFMPEG_SWSCALE
# include <libswscale/swscale.h>
#endif
#include <libavutil/hwcontext.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
#ifdef HAVE_FFMPEG_AVCODEC
printf("configuration: %s\n", avcodec_configuration());
printf("avcodec version: %d.%d.%d\n", AV_VERSION_MAJOR(avcodec_version()), AV_VERSION_MINOR(avcodec_version()), AV_VERSION_MICRO(avcodec_version()));
#else
printf("avcodec is disabled!\n");
#endif
#ifdef HAVE_FFMPEG_AVFILTER
printf("avfilter version: %d.%d.%d\n", AV_VERSION_MAJOR(avfilter_version()), AV_VERSION_MINOR(avfilter_version()), AV_VERSION_MICRO(avfilter_version()));
#else
printf("avfilter is disabled!\n");
#endif
#ifdef HAVE_FFMPEG_AVDEVICE
avdevice_register_all();
printf("avdevice version: %d.%d.%d\n", AV_VERSION_MAJOR(avdevice_version()), AV_VERSION_MINOR(avdevice_version()), AV_VERSION_MICRO(avdevice_version()));
#else
printf("avdevice is disabled!\n");
#endif
#ifdef HAVE_FFMPEG_SWRESAMPLE
printf("swresample version: %d.%d.%d\n", AV_VERSION_MAJOR(swresample_version()), AV_VERSION_MINOR(swresample_version()), AV_VERSION_MICRO(swresample_version()));
#else
printf("swresample is disabled!\n");
#endif
#ifdef HAVE_FFMPEG_SWSCALE
printf("swscale version: %d.%d.%d\n", AV_VERSION_MAJOR(swscale_version()), AV_VERSION_MINOR(swscale_version()), AV_VERSION_MICRO(swscale_version()));
#else
printf("swscale is disabled!\n");
#endif
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

View File

@@ -0,0 +1,20 @@
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self):
if self.options["ffmpeg"].with_programs:
self.run("ffmpeg --help", run_environment=True)
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

15
recipes/ffmpeg/config.yml Normal file
View File

@@ -0,0 +1,15 @@
versions:
"7.0.1":
folder: "all"
"6.1.1":
folder: "all"
"6.1":
folder: "all"
"6.0.1":
folder: "all"
"5.1.3":
folder: "all"
"5.0.3":
folder: "all"
"4.4.4":
folder: "all"

View File

@@ -0,0 +1,23 @@
sources:
"1.4.3":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/flac/releases/download/1.4.3/flac-1.4.3.tar.xz"
sha256: "6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70"
"1.4.2":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/flac/releases/download/1.4.2/flac-1.4.2.tar.xz"
sha256: "e322d58a1f48d23d9dd38f432672865f6f79e73a6f9cc5a5f57fcaa83eb5a8e4"
"1.3.3":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/flac/archive/1.3.3.tar.gz"
sha256: "668cdeab898a7dd43cf84739f7e1f3ed6b35ece2ef9968a5c7079fe9adfe1689"
patches:
"1.4.3":
- patch_file: "patches/1.4.2-002-ignore-dll_export-define.patch"
patch_description: "Ignore autotools-specific DLL_EXPORT define in export.h"
patch_type: "conan"
"1.4.2":
- patch_file: "patches/1.4.2-002-ignore-dll_export-define.patch"
patch_description: "Ignore autotools-specific DLL_EXPORT define in export.h"
patch_type: "conan"
"1.3.3":
- patch_file: "patches/fix-cmake-1.3.3.patch"
patch_description: "Various adaptations in CMakeLists.txt files to improve compatibility with Conan."
patch_type: "conan"

View File

@@ -0,0 +1,121 @@
from conan import ConanFile
from conan.tools.apple import is_apple_os
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir, replace_in_file
from conan.tools.scm import Version
import os
required_conan_version = ">=1.54.0"
class FlacConan(ConanFile):
name = "flac"
description = "Free Lossless Audio Codec"
topics = ("flac", "codec", "audio", )
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/xiph/flac"
license = ("BSD-3-Clause", "GPL-2.0-or-later", "LPGL-2.1-or-later", "GFDL-1.2")
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def requirements(self):
self.requires("ogg/1.3.5")
def build_requirements(self):
if Version(self.version) < "1.4.2" and self.settings.arch in ["x86", "x86_64"]:
self.tool_requires("nasm/2.15.05")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_EXAMPLES"] = False
tc.variables["BUILD_DOCS"] = False
tc.variables["BUILD_PROGRAMS"] = not is_apple_os(self) or self.settings.os == "Macos"
tc.variables["BUILD_TESTING"] = False
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()
cd = CMakeDeps(self)
cd.generate()
if self.settings.arch in ["x86", "x86_64"]:
envbuild = VirtualBuildEnv(self)
envbuild.generate(scope="build")
def _patch_sources(self):
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "src", "share", "getopt", "CMakeLists.txt"),
"find_package(Intl)", "")
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
copy(self, "COPYING.*", src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"), keep_path=False)
copy(self, "*.h", src=os.path.join(self.source_folder, "include", "share"),
dst=os.path.join(self.package_folder, "include", "share"), keep_path=False)
copy(self, "*.h", src=os.path.join(self.source_folder, "include", "share", "grabbag"),
dst=os.path.join(self.package_folder, "include", "share", "grabbag"), keep_path=False)
rmdir(self, os.path.join(self.package_folder, "share"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "flac")
self.cpp_info.components["libflac"].set_property("cmake_target_name", "FLAC::FLAC")
self.cpp_info.components["libflac"].set_property("pkg_config_name", "flac")
self.cpp_info.components["libflac"].libs = ["FLAC"]
self.cpp_info.components["libflac"].requires = ["ogg::ogg"]
self.cpp_info.components["libflac++"].set_property("cmake_target_name", "FLAC::FLAC++")
self.cpp_info.components["libflac++"].set_property("pkg_config_name", "flac++")
self.cpp_info.components["libflac++"].libs = ["FLAC++"]
self.cpp_info.components["libflac++"].requires = ["libflac"]
if not self.options.shared:
self.cpp_info.components["libflac"].defines = ["FLAC__NO_DLL"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["libflac"].system_libs += ["m"]
bin_path = os.path.join(self.package_folder, "bin")
self.env_info.PATH.append(bin_path)
# TODO: to remove in conan v2
self.cpp_info.filenames["cmake_find_package"] = "flac"
self.cpp_info.filenames["cmake_find_package_multi"] = "flac"
self.cpp_info.names["cmake_find_package"] = "FLAC"
self.cpp_info.names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac++"].names["cmake_find_package"] = "FLAC++"
self.cpp_info.components["libflac++"].names["cmake_find_package_multi"] = "FLAC++"

View File

@@ -0,0 +1,22 @@
--- include/FLAC/export.h
+++ include/FLAC/export.h
@@ -74,7 +74,7 @@
*/
#if defined(_WIN32)
-#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
+#if defined(FLAC__NO_DLL)
#define FLAC_API
#else
#ifdef FLAC_API_EXPORTS
--- include/FLAC++/export.h
+++ include/FLAC++/export.h
@@ -73,7 +73,7 @@
* by libtool, must override FLAC__NO_DLL on building shared components
*/
#if defined(_WIN32)
-#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
+#if defined(FLAC__NO_DLL)
#define FLACPP_API
#else
#ifdef FLACPP_API_EXPORTS

View File

@@ -0,0 +1,48 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,9 +25,6 @@ endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef")
endif()
-if(CMAKE_C_COMPILER_ID MATCHES "GNU")
- set(CMAKE_EXE_LINKER_FLAGS -no-pie)
-endif()
include(CMakePackageConfigHelpers)
include(CPack)
@@ -76,7 +73,7 @@ add_compile_options(
$<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${HAVE_DECL_AFTER_STMT_FLAG}>>:-Wdeclaration-after-statement>)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG)
- add_compile_options(-mstackrealign)
+ add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-mstackrealign>)
endif()
include_directories("include")
--- a/src/flac/CMakeLists.txt
+++ b/src/flac/CMakeLists.txt
@@ -21,4 +21,4 @@ if(TARGET win_utf8_io)
endif()
install(TARGETS flacapp EXPORT targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
--- a/src/libFLAC/CMakeLists.txt
+++ b/src/libFLAC/CMakeLists.txt
@@ -102,7 +102,7 @@ target_compile_definitions(FLAC
target_include_directories(FLAC INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
-target_link_libraries(FLAC PRIVATE $<$<BOOL:${HAVE_LROUND}>:m>)
+target_link_libraries(FLAC PUBLIC $<$<BOOL:${HAVE_LROUND}>:m>)
if(TARGET Ogg::ogg)
target_link_libraries(FLAC PUBLIC Ogg::ogg)
endif()
--- a/src/metaflac/CMakeLists.txt
+++ b/src/metaflac/CMakeLists.txt
@@ -15,4 +15,4 @@ if(TARGET win_utf8_io)
endif()
install(TARGETS metaflac EXPORT targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)
find_package(flac REQUIRED FLAC++ CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE FLAC::FLAC++)

View File

@@ -0,0 +1,25 @@
from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
def requirements(self):
self.requires(self.tested_reference_str)
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not cross_building(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,21 @@
#include <cstdlib>
#include <iostream>
#include "FLAC++/encoder.h"
class OurEncoder: public FLAC::Encoder::File {
public:
OurEncoder(): FLAC::Encoder::File() {}
protected:
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
{}
};
int main()
{
OurEncoder encoder;
if(!encoder) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

7
recipes/flac/config.yml Normal file
View File

@@ -0,0 +1,7 @@
versions:
"1.4.3":
folder: all
"1.4.2":
folder: all
"1.3.3":
folder: all

View 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"

View 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

View File

@@ -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

View 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)

View 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")

View File

@@ -0,0 +1,8 @@
#include <stdio.h>
#include <alsa/global.h>
int main()
{
printf("libalsa version %s\n", snd_asoundlib_version());
return 0;
}

View File

@@ -0,0 +1,19 @@
versions:
"1.2.13":
folder: all
"1.2.12":
folder: all
"1.2.10":
folder: all
"1.2.7.2":
folder: all
"1.2.7":
folder: all
"1.2.5.1":
folder: all
"1.2.4":
folder: all
"1.2.2":
folder: all
"1.1.9":
folder: all

View 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.

View 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"]

View 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

View 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()

View 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()

View 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)

View 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")

View 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;
}

View File

@@ -0,0 +1,11 @@
versions:
"3.8.0":
folder: all
"3.6.1":
folder: all
"3.5.0":
folder: all
"3.4.0":
folder: all
"2.0.1":
folder: all

View File

@@ -0,0 +1,122 @@
sources:
"2.70":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.70.tar.xz"
sha256: "23a6ef8aadaf1e3e875f633bb2d116cfef8952dba7bc7c569b13458e1952b30f"
"2.69":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.69.tar.xz"
sha256: "f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb"
"2.68":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.68.tar.xz"
sha256: "90be3b6d41be5f81ae4b03ec76012b0d27c829293684f6c05b65d5f9cce724b2"
"2.66":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz"
sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2"
"2.65":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz"
sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd"
"2.62":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz"
sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2"
"2.58":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz"
sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b"
"2.57":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz"
sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab"
"2.50":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz"
sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261"
"2.48":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz"
sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2"
"2.46":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz"
sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4"
"2.45":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz"
sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286"
patches:
"2.70":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.69":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.68":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.66":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.65":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.62":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.58":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.57":
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.50":
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.48":
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.46":
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"
"2.45":
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
patch_description: "allow to configure fPIC option from conan recipe"
patch_type: "conan"
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
patch_description: "allow to override compiler via environment variables"
patch_type: "conan"

View File

@@ -0,0 +1,104 @@
import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.files import apply_conandata_patches, copy, chdir, export_conandata_patches, get, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
required_conan_version = ">=1.53.0"
class LibcapConan(ConanFile):
name = "libcap"
license = ("GPL-2.0-only", "BSD-3-Clause")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git"
description = "This is a library for getting and setting POSIX.1e" \
" (formerly POSIX 6) draft 15 capabilities"
topics = ("capabilities")
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"psx_syscals": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"psx_syscals": False,
}
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.name} only supports Linux")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = AutotoolsToolchain(self)
tc.fpic = self.options.get_safe("fPIC", True)
env = tc.environment()
env.define("SHARED", "yes" if self.options.shared else "no")
env.define("PTHREADS", "yes" if self.options.psx_syscals else "no")
env.define("DESTDIR", self.package_folder)
env.define("prefix", "/")
env.define("lib", "lib")
if cross_building(self):
# libcap needs to run an executable that is compiled from sources
# during the build - so it needs a native compiler (it doesn't matter which)
# Assume the `cc` command points to a working C compiler
env.define("BUILD_CC", "cc")
tc.generate(env)
def build(self):
apply_conandata_patches(self)
autotools = Autotools(self)
with chdir(self, os.path.join(self.source_folder, "libcap")):
autotools.make()
def package(self):
copy(self, "License", self.source_folder, os.path.join(self.package_folder, "licenses"))
autotools = Autotools(self)
with chdir(self, os.path.join(self.source_folder, "libcap")):
autotools.make(target="install-common-cap")
install_cap = ("install-shared-cap" if self.options.shared
else "install-static-cap")
autotools.make(target=install_cap)
if self.options.psx_syscals:
autotools.make(target="install-common-psx")
install_psx = ("install-shared-psx" if self.options.shared
else "install-static-psx")
autotools.make(target=install_psx)
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
def package_info(self):
self.cpp_info.components["cap"].set_property("pkg_config_name", "libcap")
self.cpp_info.components["cap"].libs = ["cap"]
if self.options.psx_syscals:
self.cpp_info.components["psx"].set_property("pkg_config_name", "libpsx")
self.cpp_info.components["psx"].libs = ["psx"]
self.cpp_info.components["psx"].system_libs = ["pthread"]
self.cpp_info.components["psx"].exelinkflags = ["-Wl,-wrap,pthread_create"]
# trick to avoid conflicts with cap component
self.cpp_info.set_property("pkg_config_name", "libcap-do-not-use")

View File

@@ -0,0 +1,26 @@
From bb2c4e80928e8221a31c3631f5a802c7b022aebd Mon Sep 17 00:00:00 2001
From: Sergey Bobrenok <bobrofon@gmail.com>
Date: Sun, 29 Aug 2021 12:02:23 +0300
Subject: [PATCH 1/2] Make.Rules: Remove hardcoded -fPIC
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
---
Make.Rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Make.Rules b/Make.Rules
index cc6f95b..91099c6 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -52,7 +52,7 @@ GOMAJOR=0
# Compilation specifics
KERNEL_HEADERS := $(topdir)/libcap/include/uapi
-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
+IPATH += -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
CC := $(CROSS_COMPILE)gcc
DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
--
2.31.1

View File

@@ -0,0 +1,36 @@
From 76e637ad20faa811f4091a8a08af4b29c528697b Mon Sep 17 00:00:00 2001
From: Sergey Bobrenok <bobrofon@gmail.com>
Date: Sun, 29 Aug 2021 12:06:18 +0300
Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
---
Make.Rules | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Make.Rules b/Make.Rules
index 91099c6..cd25495 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -54,15 +54,15 @@ GOMAJOR=0
KERNEL_HEADERS := $(topdir)/libcap/include/uapi
IPATH += -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
-CC := $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
COPTS ?= -O2
CFLAGS ?= $(COPTS) $(DEFINES)
BUILD_CC ?= $(CC)
BUILD_COPTS ?= -O2
BUILD_CFLAGS ?= $(BUILD_COPTS) $(DEFINES) $(IPATH)
-AR := $(CROSS_COMPILE)ar
-RANLIB := $(CROSS_COMPILE)ranlib
+AR ?= $(CROSS_COMPILE)ar
+RANLIB ?= $(CROSS_COMPILE)ranlib
DEBUG = -g #-DDEBUG
WARNINGS=-Wall -Wwrite-strings \
-Wpointer-arith -Wcast-qual -Wcast-align \
--
2.31.1

View File

@@ -0,0 +1,27 @@
From b70454fccba1816b14d50813b1715e9a50d7cca0 Mon Sep 17 00:00:00 2001
From: Sergey Bobrenok <bobrofon@gmail.com>
Date: Sat, 11 Sep 2021 20:39:49 +0300
Subject: [PATCH 1/2] libcap: Remove hardcoded -fPIC
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
---
libcap/Makefile | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libcap/Makefile b/libcap/Makefile
index 7706063..1b52eb9 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -18,9 +18,6 @@ CAPMAGICOBJ=cap_magic.o
PSXFILES=../psx/psx
PSXMAGICOBJ=psx_magic.o
-# Always build libcap sources this way:
-CFLAGS += -fPIC
-
# The linker magic needed to build a dynamic library as independently
# executable
MAGIC=-Wl,-e,__so_start
--
2.31.1

View File

@@ -0,0 +1,33 @@
From a38f5a330d65cc877fcc1da02836526d11ead4f0 Mon Sep 17 00:00:00 2001
From: Sergey Bobrenok <bobrofon@gmail.com>
Date: Sat, 11 Sep 2021 20:44:07 +0300
Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
---
Make.Rules | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Make.Rules b/Make.Rules
index 00f2a03..34831ae 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -66,11 +66,11 @@ DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
SYSTEM_HEADERS = /usr/include
SUDO := sudo
-CC := $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD := $(CC) -Wl,-x -shared
-AR := $(CROSS_COMPILE)ar
-RANLIB := $(CROSS_COMPILE)ranlib
-OBJCOPY := $(CROSS_COMPILE)objcopy
+AR ?= $(CROSS_COMPILE)ar
+RANLIB ?= $(CROSS_COMPILE)ranlib
+OBJCOPY ?= $(CROSS_COMPILE)objcopy
# Reference:
# CPPFLAGS used for building .o files from .c & .h files
--
2.31.1

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::CAP)

View File

@@ -0,0 +1,30 @@
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build_requirements(self):
self.tool_requires("pkgconf/[>=2.0.3]")
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")

View File

@@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/capability.h>
int main(void) {
puts("Allocate cap state");
cap_t cap = cap_get_proc();
if (!cap) {
puts("Failed");
return EXIT_FAILURE;
}
puts("Success");
cap_free(cap);
}

25
recipes/libcap/config.yml Normal file
View File

@@ -0,0 +1,25 @@
versions:
"2.70":
folder: all
"2.69":
folder: all
"2.68":
folder: all
"2.66":
folder: all
"2.65":
folder: all
"2.62":
folder: all
"2.58":
folder: all
"2.57":
folder: all
"2.50":
folder: all
"2.48":
folder: all
"2.46":
folder: all
"2.45":
folder: all

View File

@@ -0,0 +1,13 @@
sources:
"2.0.3":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.3.tar.gz"
sha256: "829b6b89eef382409cda6857fd82af84fabb63417b08ede9ea7a553f811cb79e"
"2.0.2":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.2.tar.gz"
sha256: "c9e8630cf9d433f3cead74906a1520d2223f89bcd3fa9254861017440b8eb22f"
"2.0.1":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.1.tar.gz"
sha256: "840133aa9412153894af03b27b03dde1188772442c316a4ce2a24ed70093f271"
"2.0.0":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.0.tar.gz"
sha256: "f7d6e60f978ff1db952f7d5c3e96751816f5aef238ecf1d876972697b85fd96c"

View File

@@ -0,0 +1,166 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import chdir, copy, get, rename, replace_in_file, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, NMakeToolchain
from conan.tools.build import cross_building
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.55.0"
class LibFDKAACConan(ConanFile):
name = "libfdk_aac"
url = "https://github.com/conan-io/conan-center-index"
description = "A standalone library of the Fraunhofer FDK AAC code from Android"
license = "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE"
homepage = "https://sourceforge.net/projects/opencore-amr/"
topics = ("multimedia", "audio", "fraunhofer", "aac", "decoder", "encoding", "decoding")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)
@property
def _use_cmake(self):
return Version(self.version) >= "2.0.2"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def validate_build(self):
if cross_building(self) and self.settings.os == "Android":
# https://github.com/mstorsjo/fdk-aac/issues/124#issuecomment-653473956
# INFO: It's possible to inject a log.h to fix the error, but there is no official support.
raise ConanInvalidConfiguration(f"{self.ref} cross-building for Android is not supported. Please, try native build.")
def layout(self):
if self._use_cmake:
cmake_layout(self, src_folder="src")
else:
basic_layout(self, src_folder="src")
def build_requirements(self):
if not self._use_cmake and not is_msvc(self):
# self.tool_requires("libtool/2.4.7")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
if self._use_cmake:
tc = CMakeToolchain(self)
tc.variables["BUILD_PROGRAMS"] = False
tc.variables["FDK_AAC_INSTALL_CMAKE_CONFIG_MODULE"] = False
tc.variables["FDK_AAC_INSTALL_PKGCONFIG_MODULE"] = False
tc.generate()
elif is_msvc(self):
tc = NMakeToolchain(self)
tc.generate()
else:
env = VirtualBuildEnv(self)
env.generate()
tc = AutotoolsToolchain(self)
tc.generate()
def build(self):
if self._use_cmake:
cmake = CMake(self)
cmake.configure()
cmake.build()
elif is_msvc(self):
makefile_vc = os.path.join(self.source_folder, "Makefile.vc")
replace_in_file(self, makefile_vc, "CFLAGS = /nologo /W3 /Ox /MT", "CFLAGS = /nologo")
replace_in_file(self, makefile_vc, "MKDIR_FLAGS = -p", "MKDIR_FLAGS =")
# Build either shared or static, and don't build utility (it always depends on static lib)
replace_in_file(self, makefile_vc, "copy $(PROGS) $(bindir)", "")
replace_in_file(self, makefile_vc, "copy $(LIB_DEF) $(libdir)", "")
if self.options.shared:
replace_in_file(
self, makefile_vc,
"all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)",
"all: $(LIB_DEF) $(SHARED_LIB) $(IMP_LIB)",
)
replace_in_file(self, makefile_vc, "copy $(STATIC_LIB) $(libdir)", "")
else:
replace_in_file(
self, makefile_vc,
"all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)",
"all: $(STATIC_LIB)",
)
replace_in_file(self, makefile_vc, "copy $(IMP_LIB) $(libdir)", "")
replace_in_file(self, makefile_vc, "copy $(SHARED_LIB) $(bindir)", "")
with chdir(self, self.source_folder):
self.run("nmake -f Makefile.vc")
else:
autotools = Autotools(self)
autotools.autoreconf()
if self.settings.os == "Android" and self._settings_build.os == "Windows":
# remove escape for quotation marks, to make ndk on windows happy
replace_in_file(
self, os.path.join(self.source_folder, "configure"),
"s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g",
)
autotools.configure()
autotools.make()
def package(self):
copy(self, "NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
if self._use_cmake:
cmake = CMake(self)
cmake.install()
elif is_msvc(self):
with chdir(self, self.source_folder):
self.run(f"nmake -f Makefile.vc prefix=\"{self.package_folder}\" install")
if self.options.shared:
rename(self, os.path.join(self.package_folder, "lib", "fdk-aac.dll.lib"),
os.path.join(self.package_folder, "lib", "fdk-aac.lib"))
else:
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"))
fix_apple_shared_install_name(self)
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "fdk-aac")
self.cpp_info.set_property("cmake_target_name", "FDK-AAC::fdk-aac")
self.cpp_info.set_property("pkg_config_name", "fdk-aac")
# TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
self.cpp_info.components["fdk-aac"].libs = ["fdk-aac"]
if self.settings.os in ["Linux", "FreeBSD", "Android"]:
self.cpp_info.components["fdk-aac"].system_libs.append("m")
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "fdk-aac"
self.cpp_info.filenames["cmake_find_package_multi"] = "fdk-aac"
self.cpp_info.names["cmake_find_package"] = "FDK-AAC"
self.cpp_info.names["cmake_find_package_multi"] = "FDK-AAC"
self.cpp_info.components["fdk-aac"].names["cmake_find_package"] = "fdk-aac"
self.cpp_info.components["fdk-aac"].names["cmake_find_package_multi"] = "fdk-aac"
self.cpp_info.components["fdk-aac"].set_property("cmake_target_name", "FDK-AAC::fdk-aac")

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES C)
find_package(fdk-aac REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE FDK-AAC::fdk-aac)
target_compile_features(${PROJECT_NAME} PRIVATE c_std_99)

View 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")

View File

@@ -0,0 +1,33 @@
#include <fdk-aac/aacenc_lib.h>
#include <fdk-aac/aacdecoder_lib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main()
{
LIB_INFO info[FDK_MODULE_LAST];
memset(&info, 0, sizeof(info));
int ret = aacDecoder_GetLibInfo(info);
if (0 != ret) {
fprintf(stderr, "aacDecoder_GetLibInfo failed with %u\n", ret);
return EXIT_FAILURE;
}
ret = aacEncGetLibInfo(info);
if (0 != ret) {
fprintf(stderr, "aacEncGetLibInfo failed with %u\n", ret);
return EXIT_FAILURE;
}
for (int i = 0; i < FDK_MODULE_LAST; ++i) {
if (FDK_AACDEC == info[i].module_id || FDK_AACENC == info[i].module_id) {
printf("title: %s\n", info[i].title);
printf("build date: %s\n", info[i].build_date);
printf("build time: %s\n", info[i].build_time);
printf("version: %s\n", info[i].versionStr);
printf("========================================\n");
}
}
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,9 @@
versions:
"2.0.3":
folder: all
"2.0.2":
folder: all
"2.0.1":
folder: all
"2.0.0":
folder: all

View File

@@ -0,0 +1,13 @@
sources:
"1.17":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-ftp_gnu_org/gnu/libiconv/libiconv-1.17.tar.gz"
sha256: "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313"
"1.16":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-ftp_gnu_org/gnu/libiconv/libiconv-1.16.tar.gz"
sha256: "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04"
"1.15":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-ftp_gnu_org/gnu/libiconv/libiconv-1.15.tar.gz"
sha256: "ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178"
patches:
"1.16":
- patch_file: "patches/0001-libcharset-fix-linkage.patch"

View File

@@ -0,0 +1,182 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.build import cross_building
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import (
apply_conandata_patches,
copy,
export_conandata_patches,
get,
rename,
rm,
rmdir,
replace_in_file
)
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, unix_path
from conan.tools.scm import Version
import os
required_conan_version = ">=1.54.0"
class LibiconvConan(ConanFile):
name = "libiconv"
description = "Convert text to and from Unicode"
license = ("LGPL-2.0-or-later", "LGPL-2.1-or-later")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.gnu.org/software/libiconv/"
topics = ("iconv", "text", "encoding", "locale", "unicode", "conversion")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
@property
def _is_clang_cl(self):
return self.settings.compiler == "clang" and self.settings.os == "Windows" and \
self.settings.compiler.get_safe("runtime")
@property
def _msvc_tools(self):
return ("clang-cl", "llvm-lib", "lld-link") if self._is_clang_cl else ("cl", "lib", "link")
@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
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")
if Version(self.version) >= "1.17":
self.license = "LGPL-2.1-or-later"
else:
self.license = "LGPL-2.0-or-later"
def layout(self):
basic_layout(self, src_folder="src")
def build_requirements(self):
if self._settings_build.os == "Windows":
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
self.win_bash = True
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = AutotoolsToolchain(self)
if self.settings.os == "Windows" and self.settings.compiler == "gcc":
if self.settings.arch == "x86":
tc.update_configure_args({
"--host": "i686-w64-mingw32",
"RC": "windres --target=pe-i386",
"WINDRES": "windres --target=pe-i386",
})
elif self.settings.arch == "x86_64" and cross_building(self) and self.options.shared:
tc.update_configure_args({
"--host": "x86_64-w64-mingw32",
"RC": "x86_64-w64-mingw32.shared-windres --target=pe-x86-64",
"WINDRES": "x86_64-w64-mingw32.shared-windres --target=pe-x86-64",
})
elif self.settings.arch == "x86_64" and cross_building(self):
tc.update_configure_args({
"--host": "x86_64-w64-mingw32",
"RC": "x86_64-w64-mingw32.static-windres --target=pe-x86-64",
"WINDRES": "x86_64-w64-mingw32.static-windres --target=pe-x86-64",
})
elif self.settings.arch == "x86_64":
tc.update_configure_args({
"--host": "x86_64-w64-mingw32",
"RC": "windres --target=pe-x86-64",
"WINDRES": "windres --target=pe-x86-64",
})
msvc_version = {"Visual Studio": "12", "msvc": "180"}
if is_msvc(self) and Version(self.settings.compiler.version) >= msvc_version[str(self.settings.compiler)]:
# https://github.com/conan-io/conan/issues/6514
tc.extra_cflags.append("-FS")
if cross_building(self) and is_msvc(self):
triplet_arch_windows = {"x86_64": "x86_64", "x86": "i686", "armv8": "aarch64"}
# ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546)
host_arch = triplet_arch_windows.get(str(self.settings.arch))
build_arch = triplet_arch_windows.get(str(self._settings_build.arch))
if host_arch and build_arch:
host = f"{host_arch}-w64-mingw32"
build = f"{build_arch}-w64-mingw32"
tc.configure_args.extend([
f"--host={host}",
f"--build={build}",
])
env = tc.environment()
if is_msvc(self) or self._is_clang_cl:
cc, lib, link = self._msvc_tools
build_aux_path = os.path.join(self.source_folder, "build-aux")
lt_compile = unix_path(self, os.path.join(build_aux_path, "compile"))
lt_ar = unix_path(self, os.path.join(build_aux_path, "ar-lib"))
env.define("CC", f"{lt_compile} {cc} -nologo")
env.define("CXX", f"{lt_compile} {cc} -nologo")
env.define("LD", link)
env.define("STRIP", ":")
env.define("AR", f"{lt_ar} {lib}")
env.define("RANLIB", ":")
env.define("NM", "dumpbin -symbols")
env.define("win32_target", "_WIN32_WINNT_VISTA")
tc.generate(env)
def _apply_resource_patch(self):
if self.settings.arch == "x86":
windres_options_path = os.path.join(self.source_folder, "windows", "windres-options")
self.output.info("Applying {} resource patch: {}".format(self.settings.arch, windres_options_path))
replace_in_file(self, windres_options_path, '# PACKAGE_VERSION_SUBMINOR', '# PACKAGE_VERSION_SUBMINOR\necho "--target=pe-i386"', strict=True)
def build(self):
apply_conandata_patches(self)
self._apply_resource_patch()
autotools = Autotools(self)
autotools.configure()
autotools.make()
def package(self):
copy(self, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses"))
autotools = Autotools(self)
autotools.install()
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rmdir(self, os.path.join(self.package_folder, "share"))
fix_apple_shared_install_name(self)
if (is_msvc(self) or self._is_clang_cl) and self.options.shared:
for import_lib in ["iconv", "charset"]:
rename(self, os.path.join(self.package_folder, "lib", f"{import_lib}.dll.lib"),
os.path.join(self.package_folder, "lib", f"{import_lib}.lib"))
def package_info(self):
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_file_name", "Iconv")
self.cpp_info.set_property("cmake_target_name", "Iconv::Iconv")
self.cpp_info.libs = ["iconv", "charset"]
# TODO: to remove in conan v2
self.cpp_info.names["cmake_find_package"] = "Iconv"
self.cpp_info.names["cmake_find_package_multi"] = "Iconv"
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))

View File

@@ -0,0 +1,657 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libcharset configure 1.5, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/configure --disable-option-checking --prefix=/ --disable-shared --enable-static '--bindir=${precludedir=${prefix}/include' CC=x86_64-linux-gnu-gcc-12 'CFLAGS= -m64 -fPIC -O3' 'LDFLAGS= -m64' 'CPPFLAGS= -DNDEBUG' --cache-file=/dev/null --srcdir=/home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset
## --------- ##
## Platform. ##
## --------- ##
hostname = DL-0153
uname -m = x86_64
uname -r = 6.8.0-49-generic
uname -s = Linux
uname -v = #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024
/usr/bin/uname -p = x86_64
/bin/uname -X = unknown
/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /home/aleksandr.vodyanov/Documents/Avroid/Conan/venv/bin/
PATH: /usr/local/sbin/
PATH: /usr/local/bin/
PATH: /usr/sbin/
PATH: /usr/bin/
PATH: /sbin/
PATH: /bin/
PATH: /usr/games/
PATH: /usr/local/games/
PATH: /snap/bin/
PATH: /snap/bin/
PATH: /home/aleksandr.vodyanov/.fzf/bin/
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2410: looking for aux files: ltmain.sh config.guess config.sub install-sh
configure:2423: trying /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/build-aux/
configure:2452: /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/build-aux/ltmain.sh found
configure:2452: /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/build-aux/config.guess found
configure:2452: /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/build-aux/config.sub found
configure:2434: /home/aleksandr.vodyanov/.conan2/p/b/libic2832ce1941ef4/b/src/libcharset/build-aux/install-sh found
configure:2567: checking whether make sets $(MAKE)
configure:2590: result: yes
configure:2663: checking for gcc
configure:2695: result: x86_64-linux-gnu-gcc-12
configure:3048: checking for C compiler version
configure:3057: x86_64-linux-gnu-gcc-12 --version >&5
x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-17ubuntu1) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3068: $? = 0
configure:3057: x86_64-linux-gnu-gcc-12 -v >&5
Using built-in specs.
COLLECT_GCC=x86_64-linux-gnu-gcc-12
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 12.3.0-17ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-4qxEZC/gcc-12-12.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-4qxEZC/gcc-12-12.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.0 (Ubuntu 12.3.0-17ubuntu1)
... rest of stderr output deleted ...
configure:3068: $? = 0
configure:3057: x86_64-linux-gnu-gcc-12 -V >&5
x86_64-linux-gnu-gcc-12: error: unrecognized command-line option '-V'
x86_64-linux-gnu-gcc-12: fatal error: no input files
compilation terminated.
configure:3068: $? = 1
configure:3057: x86_64-linux-gnu-gcc-12 -qversion >&5
x86_64-linux-gnu-gcc-12: error: unrecognized command-line option '-qversion'; did you mean '--version'?
x86_64-linux-gnu-gcc-12: fatal error: no input files
compilation terminated.
configure:3068: $? = 1
configure:3057: x86_64-linux-gnu-gcc-12 -version >&5
x86_64-linux-gnu-gcc-12: error: unrecognized command-line option '-version'
x86_64-linux-gnu-gcc-12: fatal error: no input files
compilation terminated.
configure:3068: $? = 1
configure:3088: checking whether the C compiler works
configure:3110: x86_64-linux-gnu-gcc-12 -m64 -fPIC -O3 -DNDEBUG -m64 conftest.c >&5
configure:3114: $? = 0
configure:3164: result: yes
configure:3167: checking for C compiler default output file name
configure:3169: result: a.out
configure:3175: checking for suffix of executables
configure:3182: x86_64-linux-gnu-gcc-12 -o conftest -m64 -fPIC -O3 -DNDEBUG -m64 conftest.c >&5
configure:3186: $? = 0
configure:3209: result:
configure:3231: checking whether we are cross compiling
configure:3239: x86_64-linux-gnu-gcc-12 -o conftest -m64 -fPIC -O3 -DNDEBUG -m64 conftest.c >&5
configure:3243: $? = 0
configure:3250: ./conftest
configure:3254: $? = 0
configure:3269: result: no
configure:3274: checking for suffix of object files
configure:3297: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3301: $? = 0
configure:3323: result: o
configure:3327: checking whether the compiler supports GNU C
configure:3347: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3347: $? = 0
configure:3357: result: yes
configure:3368: checking whether x86_64-linux-gnu-gcc-12 accepts -g
configure:3389: x86_64-linux-gnu-gcc-12 -c -g -DNDEBUG conftest.c >&5
configure:3389: $? = 0
configure:3433: result: yes
configure:3453: checking for x86_64-linux-gnu-gcc-12 option to enable C11 features
configure:3468: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3468: $? = 0
configure:3486: result: none needed
configure:3601: checking how to run the C preprocessor
configure:3627: x86_64-linux-gnu-gcc-12 -E -DNDEBUG conftest.c
configure:3627: $? = 0
configure:3642: x86_64-linux-gnu-gcc-12 -E -DNDEBUG conftest.c
conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory
9 | #include <ac_nonexistent.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:3642: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libcharset"
| #define PACKAGE_TARNAME "libcharset"
| #define PACKAGE_VERSION "1.5"
| #define PACKAGE_STRING "libcharset 1.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:3669: result: x86_64-linux-gnu-gcc-12 -E
configure:3683: x86_64-linux-gnu-gcc-12 -E -DNDEBUG conftest.c
configure:3683: $? = 0
configure:3698: x86_64-linux-gnu-gcc-12 -E -DNDEBUG conftest.c
conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory
9 | #include <ac_nonexistent.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
configure:3698: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libcharset"
| #define PACKAGE_TARNAME "libcharset"
| #define PACKAGE_VERSION "1.5"
| #define PACKAGE_STRING "libcharset 1.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:3744: checking for a BSD-compatible install
configure:3817: result: /usr/bin/install -c
configure:3836: checking build system type
configure:3851: result: x86_64-pc-linux-gnu
configure:3871: checking host system type
configure:3885: result: x86_64-pc-linux-gnu
configure:3914: checking for stdio.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for stdlib.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for string.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for inttypes.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for stdint.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for strings.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for sys/stat.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for sys/types.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for unistd.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for wchar.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3914: $? = 0
configure:3914: result: yes
configure:3914: checking for minix/config.h
configure:3914: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
conftest.c:47:10: fatal error: minix/config.h: No such file or directory
47 | #include <minix/config.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
configure:3914: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libcharset"
| #define PACKAGE_TARNAME "libcharset"
| #define PACKAGE_VERSION "1.5"
| #define PACKAGE_STRING "libcharset 1.5"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_WCHAR_H 1
| /* end confdefs.h. */
| #include <stddef.h>
| #ifdef HAVE_STDIO_H
| # include <stdio.h>
| #endif
| #ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| #endif
| #ifdef HAVE_STRING_H
| # include <string.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <minix/config.h>
configure:3914: result: no
configure:3945: checking whether it is safe to define __EXTENSIONS__
configure:3964: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3964: $? = 0
configure:3972: result: yes
configure:3975: checking whether _XOPEN_SOURCE should be defined
configure:3997: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:3997: $? = 0
configure:4024: result: no
configure:4134: checking how to print strings
configure:4161: result: printf
configure:4182: checking for a sed that does not truncate output
configure:4252: result: /usr/bin/sed
configure:4270: checking for grep that handles long lines and -e
configure:4334: result: /usr/bin/grep
configure:4339: checking for egrep
configure:4407: result: /usr/bin/grep -E
configure:4412: checking for fgrep
configure:4480: result: /usr/bin/grep -F
configure:4516: checking for ld used by x86_64-linux-gnu-gcc-12
configure:4584: result: /usr/bin/ld
configure:4591: checking if the linker (/usr/bin/ld) is GNU ld
configure:4607: result: yes
configure:4619: checking for BSD- or MS-compatible name lister (nm)
configure:4674: result: /usr/bin/nm -B
configure:4814: checking the name lister (/usr/bin/nm -B) interface
configure:4822: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:4825: /usr/bin/nm -B "conftest.o"
configure:4828: output
0000000000000000 B some_variable
configure:4835: result: BSD nm
configure:4838: checking whether ln -s works
configure:4842: result: yes
configure:4850: checking the maximum length of command line arguments
configure:4982: result: 1572864
configure:5030: checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format
configure:5071: result: func_convert_file_noop
configure:5078: checking how to convert x86_64-pc-linux-gnu file names to toolchain format
configure:5099: result: func_convert_file_noop
configure:5106: checking for /usr/bin/ld option to reload object files
configure:5114: result: -r
configure:5193: checking for file
configure:5214: found /usr/bin/file
configure:5225: result: file
configure:5301: checking for objdump
configure:5322: found /usr/bin/objdump
configure:5333: result: objdump
configure:5362: checking how to recognize dependent libraries
configure:5563: result: pass_all
configure:5653: checking for dlltool
configure:5688: result: no
configure:5715: checking how to associate runtime and link libraries
configure:5743: result: printf %s\n
configure:5808: checking for ar
configure:5829: found /usr/bin/ar
configure:5840: result: ar
configure:5893: checking for archiver @FILE support
configure:5911: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:5911: $? = 0
configure:5915: ar cr libconftest.a @conftest.lst >&5
configure:5918: $? = 0
configure:5923: ar cr libconftest.a @conftest.lst >&5
ar: conftest.o: No such file or directory
configure:5926: $? = 1
configure:5938: result: @
configure:6001: checking for strip
configure:6022: found /usr/bin/strip
configure:6033: result: strip
configure:6110: checking for ranlib
configure:6131: found /usr/bin/ranlib
configure:6142: result: ranlib
configure:6219: checking for gawk
configure:6254: result: no
configure:6219: checking for mawk
configure:6240: found /usr/bin/mawk
configure:6251: result: mawk
configure:6291: checking command to parse /usr/bin/nm -B output from x86_64-linux-gnu-gcc-12 object
configure:6445: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:6448: $? = 0
configure:6452: /usr/bin/nm -B conftest.o \| /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' \> conftest.nm
configure:6455: $? = 0
configure:6521: x86_64-linux-gnu-gcc-12 -o conftest -m64 -fPIC -O3 -DNDEBUG -m64 conftest.c conftstm.o >&5
configure:6524: $? = 0
configure:6562: result: ok
configure:6609: checking for sysroot
configure:6640: result: no
configure:6647: checking for a working dd
configure:6691: result: /usr/bin/dd
configure:6695: checking how to truncate binary pipes
configure:6711: result: /usr/bin/dd bs=4096 count=1
configure:6848: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:6851: $? = 0
configure:7048: checking for mt
configure:7069: found /usr/bin/mt
configure:7080: result: mt
configure:7103: checking if mt is a manifest tool
configure:7110: mt '-?'
configure:7118: result: no
configure:7839: checking for dlfcn.h
configure:7839: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:7839: $? = 0
configure:7839: result: yes
configure:8426: checking for objdir
configure:8442: result: .libs
configure:8706: checking if x86_64-linux-gnu-gcc-12 supports -fno-rtti -fno-exceptions
configure:8725: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for C
configure:8729: $? = 0
configure:8742: result: no
configure:9100: checking for x86_64-linux-gnu-gcc-12 option to produce PIC
configure:9108: result: -fPIC -DPIC
configure:9116: checking if x86_64-linux-gnu-gcc-12 PIC flag -fPIC -DPIC works
configure:9135: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG -fPIC -DPIC -DPIC conftest.c >&5
configure:9139: $? = 0
configure:9152: result: yes
configure:9181: checking if x86_64-linux-gnu-gcc-12 static flag -static works
configure:9210: result: yes
configure:9225: checking if x86_64-linux-gnu-gcc-12 supports -c -o file.o
configure:9247: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG -o out/conftest2.o conftest.c >&5
configure:9251: $? = 0
configure:9273: result: yes
configure:9281: checking if x86_64-linux-gnu-gcc-12 supports -c -o file.o
configure:9329: result: yes
configure:9362: checking whether the x86_64-linux-gnu-gcc-12 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries
configure:10630: result: yes
configure:10871: checking dynamic linker characteristics
configure:11453: x86_64-linux-gnu-gcc-12 -o conftest -m64 -fPIC -O3 -DNDEBUG -m64 -Wl,-rpath -Wl,/foo conftest.c >&5
configure:11453: $? = 0
configure:11692: result: GNU/Linux ld.so
configure:11814: checking how to hardcode library paths into programs
configure:11839: result: immediate
configure:12391: checking whether stripping libraries is possible
configure:12400: result: yes
configure:12442: checking if libtool supports shared libraries
configure:12444: result: yes
configure:12447: checking whether to build shared libraries
configure:12472: result: no
configure:12475: checking whether to build static libraries
configure:12479: result: yes
configure:12540: checking for ld
configure:12671: result: /usr/bin/ld -m elf_x86_64
configure:12678: checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld
configure:12694: result: yes
configure:12701: checking 32-bit host C ABI
configure:12768: x86_64-linux-gnu-gcc-12 -c -m64 -fPIC -O3 -DNDEBUG conftest.c >&5
configure:12768: $? = 0
configure:12964: result: no
configure:12970: checking for shared library path variable
configure:12984: result: LD_LIBRARY_PATH
configure:12989: checking whether to activate relocatable installation
configure:13005: result: no
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-linux-gnu-gcc-12
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=' -m64 -fPIC -O3'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=' -DNDEBUG'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=' -m64'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_header_dlfcn_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_minix_config_h=no
ac_cv_header_stdint_h=yes
ac_cv_header_stdio_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_header_wchar_h=yes
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_objext=o
ac_cv_path_EGREP='/usr/bin/grep -E'
ac_cv_path_FGREP='/usr/bin/grep -F'
ac_cv_path_GREP=/usr/bin/grep
ac_cv_path_SED=/usr/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_lt_DD=/usr/bin/dd
ac_cv_prog_AWK=mawk
ac_cv_prog_CPP='x86_64-linux-gnu-gcc-12 -E'
ac_cv_prog_ac_ct_AR=ar
ac_cv_prog_ac_ct_CC=x86_64-linux-gnu-gcc-12
ac_cv_prog_ac_ct_FILECMD=file
ac_cv_prog_ac_ct_MANIFEST_TOOL=mt
ac_cv_prog_ac_ct_OBJDUMP=objdump
ac_cv_prog_ac_ct_RANLIB=ranlib
ac_cv_prog_ac_ct_STRIP=strip
ac_cv_prog_cc_c11=
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_make_make_set=yes
ac_cv_safe_to_define___extensions__=yes
ac_cv_should_define__xopen_source=no
acl_cv_libpath=LD_LIBRARY_PATH
acl_cv_prog_gnu_ld=yes
acl_cv_shlibpath_var=LD_LIBRARY_PATH
gl_cv_host_cpu_c_abi_32bit=no
lt_cv_ar_at_file=@
lt_cv_deplibs_check_method=pass_all
lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
lt_cv_ld_reload_flag=-r
lt_cv_nm_interface='BSD nm'
lt_cv_objdir=.libs
lt_cv_path_LD=/usr/bin/ld
lt_cv_path_NM='/usr/bin/nm -B'
lt_cv_path_mainfest_tool=no
lt_cv_prog_compiler_c_o=yes
lt_cv_prog_compiler_pic='-fPIC -DPIC'
lt_cv_prog_compiler_pic_works=yes
lt_cv_prog_compiler_rtti_exceptions=no
lt_cv_prog_compiler_static_works=yes
lt_cv_prog_gnu_ld=yes
lt_cv_sharedlib_from_linklib_cmd='printf %s\n'
lt_cv_shlibpath_overrides_runpath=yes
lt_cv_sys_global_symbol_pipe='/usr/bin/sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'' | /usr/bin/sed '\''/ __gnu_lto/d'\'''
lt_cv_sys_global_symbol_to_c_name_address='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"\1", (void *) \&\1},/p'\'''
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='/usr/bin/sed -n -e '\''s/^: \(.*\) .*$/ {"\1", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(lib.*\)$/ {"\1", (void *) \&\1},/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/ {"lib\1", (void *) \&\1},/p'\'''
lt_cv_sys_global_symbol_to_cdecl='/usr/bin/sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
lt_cv_sys_global_symbol_to_import=
lt_cv_sys_max_cmd_len=1572864
lt_cv_to_host_file_cmd=func_convert_file_noop
lt_cv_to_tool_file_cmd=func_convert_file_noop
lt_cv_truncate_bin='/usr/bin/dd bs=4096 count=1'
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR='ar'
AS='as'
AWK='mawk'
CC='x86_64-linux-gnu-gcc-12'
CFLAGS=' -m64 -fPIC -O3'
CFLAG_VISIBILITY=''
CPP='x86_64-linux-gnu-gcc-12 -E'
CPPFLAGS=' -DNDEBUG'
DEFS=''
DLLTOOL='false'
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/usr/bin/grep -E'
EXEEXT=''
FGREP='/usr/bin/grep -F'
FILECMD='file'
GREP='/usr/bin/grep'
HAVE_VISIBILITY=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_PROGRAM_ENV=''
INSTALL_SCRIPT='${INSTALL}'
LD='/usr/bin/ld -m elf_x86_64'
LDFLAGS=' -m64'
LIBOBJS=''
LIBS=''
LIBTOOL='/bin/sh $(top_builddir)/libtool'
LIPO=''
LN_S='ln -s'
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MANIFEST_TOOL=':'
NM='/usr/bin/nm -B'
NMEDIT=''
OBJDUMP='objdump'
OBJEXT='o'
OTOOL64=''
OTOOL=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME='libcharset'
PACKAGE_STRING='libcharset 1.5'
PACKAGE_TARNAME='libcharset'
PACKAGE_URL=''
PACKAGE_VERSION='1.5'
PATH_SEPARATOR=':'
RANLIB='ranlib'
RELOCATABLE='no'
RELOCATABLE_BUILD_DIR=''
RELOCATABLE_CONFIG_H_DIR=''
RELOCATABLE_LDFLAGS=''
RELOCATABLE_LIBRARY_PATH=''
RELOCATABLE_SRC_DIR=''
RELOCATABLE_STRIP=''
RELOCATABLE_VIA_LD_FALSE=''
RELOCATABLE_VIA_LD_TRUE=''
RELOCATABLE_VIA_WRAPPER_FALSE=''
RELOCATABLE_VIA_WRAPPER_TRUE=''
SED='/usr/bin/sed'
SET_MAKE=''
SHELL='/bin/sh'
STRIP='strip'
ac_ct_AR='ar'
ac_ct_CC='x86_64-linux-gnu-gcc-12'
ac_ct_DUMPBIN=''
bindir='${precludedir=${prefix}/include'
build='x86_64-pc-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-pc-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "libcharset"
#define PACKAGE_TARNAME "libcharset"
#define PACKAGE_VERSION "1.5"
#define PACKAGE_STRING "libcharset 1.5"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE_WCHAR_H 1
#define STDC_HEADERS 1
#define _ALL_SOURCE 1
#define _DARWIN_C_SOURCE 1
#define _GNU_SOURCE 1
#define _HPUX_ALT_XOPEN_SOCKET_API 1
#define _NETBSD_SOURCE 1
#define _OPENBSD_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
#define __STDC_WANT_IEC_60559_BFP_EXT__ 1
#define __STDC_WANT_IEC_60559_DFP_EXT__ 1
#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
#define __STDC_WANT_LIB_EXT2__ 1
#define __STDC_WANT_MATH_SPEC_FUNCS__ 1
#define _TANDEM_SOURCE 1
#define __EXTENSIONS__ 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
configure: exit 2

View File

@@ -0,0 +1,155 @@
diff --git a/libcharset/Makefile.in b/libcharset/Makefile.in
index 5f599fe..e6ba91a 100644
--- a/libcharset/Makefile.in
+++ b/libcharset/Makefile.in
@@ -30,25 +30,22 @@ mkinstalldirs = $(SHELL) @top_srcdir@/build-aux/mkinstalldirs
SHELL = @SHELL@
-all : include/libcharset.h force
+all : force
cd lib && $(MAKE) all
-include/libcharset.h :
- if [ ! -d include ] ; then mkdir include ; fi
- $(CP) $(srcdir)/include/libcharset.h.in include/libcharset.h
-
# Installs the library and include files only. Typically called with only
# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
install-lib : all force
cd lib && $(MAKE) install-lib libdir='$(libdir)' includedir='$(includedir)'
$(mkinstalldirs) $(includedir)
- $(INSTALL_DATA) include/libcharset.h $(includedir)/libcharset.h
- $(INSTALL_DATA) include/localcharset.h.inst $(includedir)/localcharset.h
+ $(INSTALL_DATA) include/libcharset.h.inst $(includedir)/libcharset.h
+# Here, use the include file that contains LIBCHARSET_DLL_EXPORTED annotations.
+ $(INSTALL_DATA) include/localcharset.h $(includedir)/localcharset.h
-install : include/libcharset.h include/localcharset.h force
+install : all force
cd lib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
$(mkinstalldirs) $(DESTDIR)$(includedir)
- $(INSTALL_DATA) include/libcharset.h $(DESTDIR)$(includedir)/libcharset.h
+ $(INSTALL_DATA) include/libcharset.h.inst $(DESTDIR)$(includedir)/libcharset.h
$(INSTALL_DATA) include/localcharset.h.inst $(DESTDIR)$(includedir)/localcharset.h
install-strip : install
@@ -73,12 +70,12 @@ clean : force
distclean : force
cd lib && if test -f Makefile; then $(MAKE) distclean; fi
- $(RM) include/libcharset.h include/localcharset.h include/localcharset.h.inst
+ $(RM) include/libcharset.h include/libcharset.h.inst include/localcharset.h include/localcharset.h.inst
$(RM) config.status config.log config.cache Makefile config.h libtool
maintainer-clean : force
cd lib && if test -f Makefile; then $(MAKE) maintainer-clean; fi
- $(RM) include/libcharset.h include/localcharset.h include/localcharset.h.inst
+ $(RM) include/libcharset.h include/libcharset.h.inst include/localcharset.h include/localcharset.h.inst
$(RM) config.status config.log config.cache Makefile config.h libtool
# List of source files.
@@ -133,6 +130,7 @@ IMPORTED_FILES = \
# List of distributed files generated by autotools or Makefile.devel.
GENERATED_FILES = \
autoconf/aclocal.m4 configure config.h.in \
+ include/libcharset.h.build.in \
include/localcharset.h.build.in
# List of distributed files generated by "make".
DISTRIBUTED_BUILT_FILES =
diff --git a/libcharset/configure b/libcharset/configure
index cf4f9d2..8844aca 100755
--- a/libcharset/configure
+++ b/libcharset/configure
@@ -12346,6 +12346,10 @@ ac_config_files="$ac_config_files Makefile"
ac_config_files="$ac_config_files lib/Makefile"
+ac_config_files="$ac_config_files include/libcharset.h:include/libcharset.h.build.in"
+
+ac_config_files="$ac_config_files include/libcharset.h.inst:include/libcharset.h.in"
+
ac_config_files="$ac_config_files include/localcharset.h:include/localcharset.h.build.in"
ac_config_files="$ac_config_files include/localcharset.h.inst:include/localcharset.h.in"
@@ -13346,6 +13350,8 @@ do
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
+ "include/libcharset.h") CONFIG_FILES="$CONFIG_FILES include/libcharset.h:include/libcharset.h.build.in" ;;
+ "include/libcharset.h.inst") CONFIG_FILES="$CONFIG_FILES include/libcharset.h.inst:include/libcharset.h.in" ;;
"include/localcharset.h") CONFIG_FILES="$CONFIG_FILES include/localcharset.h:include/localcharset.h.build.in" ;;
"include/localcharset.h.inst") CONFIG_FILES="$CONFIG_FILES include/localcharset.h.inst:include/localcharset.h.in" ;;
diff --git a/libcharset/configure.ac b/libcharset/configure.ac
index 362bde3..a071d25 100644
--- a/libcharset/configure.ac
+++ b/libcharset/configure.ac
@@ -60,6 +60,8 @@ AC_CHECK_FUNCS([setlocale])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([lib/Makefile])
+AC_CONFIG_FILES([include/libcharset.h:include/libcharset.h.build.in])
+AC_CONFIG_FILES([include/libcharset.h.inst:include/libcharset.h.in])
AC_CONFIG_FILES([include/localcharset.h:include/localcharset.h.build.in])
AC_CONFIG_FILES([include/localcharset.h.inst:include/localcharset.h.in])
AC_OUTPUT
diff --git a/libcharset/include/libcharset.h.build.in b/libcharset/include/libcharset.h.build.in
new file mode 100644
index 0000000..46e911a
--- /dev/null
+++ b/libcharset/include/libcharset.h.build.in
@@ -0,0 +1,53 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU CHARSET Library.
+
+ The GNU CHARSET Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU CHARSET Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
+ see <https://www.gnu.org/licenses/>. */
+
+#ifndef _LIBCHARSET_H
+#define _LIBCHARSET_H
+
+#if @HAVE_VISIBILITY@ && BUILDING_LIBCHARSET
+#define LIBCHARSET_DLL_EXPORTED __attribute__((__visibility__("default")))
+#elif defined _MSC_VER && BUILDING_LIBCHARSET
+#define LIBCHARSET_DLL_EXPORTED __declspec(dllexport)
+#else
+#define LIBCHARSET_DLL_EXPORTED
+#endif
+
+#include <localcharset.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Support for relocatable packages. */
+
+/* Sets the original and the current installation prefix of the package.
+ Relocation simply replaces a pathname starting with the original prefix
+ by the corresponding pathname with the current prefix instead. Both
+ prefixes should be directory names without trailing slash (i.e. use ""
+ instead of "/"). */
+extern LIBCHARSET_DLL_EXPORTED void libcharset_set_relocation_prefix (const char *orig_prefix,
+ const char *curr_prefix);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LIBCHARSET_H */

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)
find_package(Iconv REQUIRED)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE Iconv::Iconv)

View File

@@ -0,0 +1,27 @@
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def requirements(self):
self.requires(self.tested_reference_str)
def layout(self):
cmake_layout(self)
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")

View File

@@ -0,0 +1,50 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h> //for EXIT_FAILURE
#include <locale.h>
#if _MSC_VER && _MSC_VER < 1600
typedef unsigned __int32 uint32_t;
#else
#include <stdint.h>
#endif
#include "iconv.h"
#include "libcharset.h"
int main()
{
// Test libiconv
char in_bytes[4] = {'c', 'i', 'a', 'o'};
char *in_buffer = (char *)&in_bytes;
size_t in_bytes_left = sizeof(char) * 4;
uint32_t ou_bytes[4] = {(uint32_t)-1, (uint32_t)-1, (uint32_t)-1, (uint32_t)-1};
size_t ou_bytes_left = sizeof(uint32_t) * 4;
char *ou_buffer = (char *)&ou_bytes;
iconv_t context;
size_t rv;
context = iconv_open("UCS-4-INTERNAL", "US-ASCII");
if ((iconv_t)(-1) == context)
{
fprintf(stderr, "iconv_open failed\n");
return EXIT_FAILURE;
}
rv = iconv(context, &in_buffer, &in_bytes_left, &ou_buffer, &ou_bytes_left);
if ((size_t)(-1) == rv)
{
fprintf(stderr, "icon failed\n");
return EXIT_FAILURE;
}
printf("retval libiconv: %lu %u %u %u %u\n", rv, ou_bytes[0], ou_bytes[1], ou_bytes[2], ou_bytes[3]);
iconv_close(context);
// Test libcharset
setlocale(LC_ALL, "");
printf("retval libcharset: %s\n", locale_charset());
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

View File

@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self):
self.run(os.path.join("bin", "test_package"), run_environment=True)

View File

@@ -0,0 +1,7 @@
versions:
"1.17":
folder: all
"1.16":
folder: all
"1.15":
folder: all

View File

@@ -0,0 +1,17 @@
sources:
"3.100":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/lame/files/lame/3.100/lame-3.100.tar.gz"
sha256: "ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e"
patches:
"3.100":
- patch_file: "patches/6410.patch"
patch_type: "backport"
patch_description: "bug tracker item #487: v3.100 breaks Windows compatibility"
patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]"
- patch_file: "patches/6416.patch"
patch_type: "backport"
patch_description: "lame patches ticket #75: Fix for completing svn-r6410"
patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]"
- patch_file: "patches/android.patch"
patch_type: "portability"
patch_description: "Add __ANDROID__ test to one bit"

View File

@@ -0,0 +1,152 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, NMakeToolchain
import os
import shutil
required_conan_version = ">=1.55.0"
class LibMP3LameConan(ConanFile):
name = "libmp3lame"
url = "https://github.com/conan-io/conan-center-index"
description = "LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL."
homepage = "http://lame.sourceforge.net"
topics = "multimedia", "audio", "mp3", "decoder", "encoding", "decoding"
license = "LGPL-2.0"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
@property
def _is_clang_cl(self):
return str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ['Windows']
@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
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 layout(self):
basic_layout(self, src_folder="src")
def build_requirements(self):
if not is_msvc(self) and not self._is_clang_cl:
#self.tool_requires("gnu-config/cci.20210814")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
if is_msvc(self) or self._is_clang_cl:
tc = NMakeToolchain(self)
tc.generate()
else:
env = VirtualBuildEnv(self)
env.generate()
tc = AutotoolsToolchain(self)
tc.configure_args.append("--disable-frontend")
if self.settings.compiler == "clang" and self.settings.arch in ["x86", "x86_64"]:
tc.extra_cxxflags.extend(["-mmmx", "-msse"])
tc.generate()
def _build_vs(self):
with chdir(self, self.source_folder):
shutil.copy2("configMS.h", "config.h")
# Honor vc runtime
replace_in_file(self, "Makefile.MSVC", "CC_OPTS = $(CC_OPTS) /MT", "")
# Do not hardcode LTO
replace_in_file(self, "Makefile.MSVC", " /GL", "")
replace_in_file(self, "Makefile.MSVC", " /LTCG", "")
replace_in_file(self, "Makefile.MSVC", "ADDL_OBJ = bufferoverflowU.lib", "")
command = "nmake -f Makefile.MSVC comp=msvc"
if self._is_clang_cl:
compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict)
buildenv_vars = VirtualBuildEnv(self).vars()
cl = compilers_from_conf.get("c", buildenv_vars.get("CC", "clang-cl"))
link = buildenv_vars.get("LD", "lld-link")
replace_in_file(self, "Makefile.MSVC", "CC = cl", f"CC = {cl}")
replace_in_file(self, "Makefile.MSVC", "LN = link", f"LN = {link}")
# what is /GAy? MSDN doesn't know it
# clang-cl: error: no such file or directory: '/GAy'
# https://docs.microsoft.com/en-us/cpp/build/reference/ga-optimize-for-windows-application?view=msvc-170
replace_in_file(self, "Makefile.MSVC", "/GAy", "/GA")
if self.settings.arch == "x86_64":
replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:X64")
command += " MSVCVER=Win64 asm=yes"
elif self.settings.arch == "armv8":
replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:ARM64")
command += " MSVCVER=Win64"
else:
command += " asm=yes"
command += " libmp3lame.dll" if self.options.shared else " libmp3lame-static.lib"
self.run(command)
def _build_autotools(self):
for gnu_config in [
self.conf.get("user.gnu-config:config_guess", check_type=str),
self.conf.get("user.gnu-config:config_sub", check_type=str),
]:
if gnu_config:
copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder)
autotools = Autotools(self)
autotools.configure()
autotools.make()
def build(self):
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "include", "libmp3lame.sym"), "lame_init_old\n", "")
if is_msvc(self) or self._is_clang_cl:
self._build_vs()
else:
self._build_autotools()
def package(self):
copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses"))
if is_msvc(self) or self._is_clang_cl:
copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder,"include", "lame"))
name = "libmp3lame.lib" if self.options.shared else "libmp3lame-static.lib"
copy(self, name, src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"lib"))
if self.options.shared:
copy(self, pattern="*.dll", src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"bin"))
rename(self, os.path.join(self.package_folder, "lib", name),
os.path.join(self.package_folder, "lib", "mp3lame.lib"))
else:
autotools = Autotools(self)
autotools.install()
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))
fix_apple_shared_install_name(self)
def package_info(self):
self.cpp_info.libs = ["mp3lame"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m"]

View File

@@ -0,0 +1,77 @@
--- a/frontend/parse.c
+++ b/frontend/parse.c
@@ -70,8 +70,10 @@
#ifdef HAVE_ICONV
#include <iconv.h>
#include <errno.h>
+#ifdef HAVE_LANGINFO
#include <locale.h>
#include <langinfo.h>
+#endif
#endif
#if defined _ALLOW_INTERNAL_OPTIONS
@@ -146,6 +148,18 @@
return n;
}
+static char*
+currentCharacterEncoding()
+{
+#ifdef HAVE_LANGINFO
+ char* cur_code = nl_langinfo(CODESET);
+#else
+ char* env_lang = getenv("LANG");
+ char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.');
+ char* cur_code = xxx_code == NULL ? "" : xxx_code+1;
+#endif
+ return cur_code;
+}
static size_t
currCharCodeSize(void)
@@ -153,7 +167,7 @@
size_t n = 1;
char dst[32];
char* src = "A";
- char* cur_code = nl_langinfo(CODESET);
+ char* cur_code = currentCharacterEncoding();
iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
if (xiconv != (iconv_t)-1) {
for (n = 0; n < 32; ++n) {
@@ -181,7 +195,7 @@
size_t const n = l*4;
dst = calloc(n+4, 4);
if (dst != 0) {
- char* cur_code = nl_langinfo(CODESET);
+ char* cur_code = currentCharacterEncoding();
iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1");
if (xiconv != (iconv_t)-1) {
char* i_ptr = src;
@@ -205,7 +219,7 @@
size_t const n = l*4;
dst = calloc(n+4, 4);
if (dst != 0) {
- char* cur_code = nl_langinfo(CODESET);
+ char* cur_code = currentCharacterEncoding();
iconv_t xiconv = iconv_open(cur_code, "UTF-16LE");
if (xiconv != (iconv_t)-1) {
char* i_ptr = (char*)src;
@@ -231,7 +245,7 @@
size_t const n = l*4;
dst = calloc(n+4, 4);
if (dst != 0) {
- char* cur_code = nl_langinfo(CODESET);
+ char* cur_code = currentCharacterEncoding();
iconv_t xiconv = iconv_open("ISO_8859-1//TRANSLIT", cur_code);
if (xiconv != (iconv_t)-1) {
char* i_ptr = (char*)src;
@@ -257,7 +271,7 @@
size_t const n = (l+1)*4;
dst = calloc(n+4, 4);
if (dst != 0) {
- char* cur_code = nl_langinfo(CODESET);
+ char* cur_code = currentCharacterEncoding();
iconv_t xiconv = iconv_open("UTF-16LE//TRANSLIT", cur_code);
dst[0] = 0xff;
dst[1] = 0xfe;

View File

@@ -0,0 +1,39 @@
--- a/configure.in
+++ b/configure.in
@@ -421,6 +421,7 @@
AC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
AC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
+AC_CHECK_HEADERS(langinfo.h, AC_CHECK_FUNCS(nl_langinfo))
AM_ICONV
--- a/frontend/parse.c
+++ b/frontend/parse.c
@@ -70,7 +70,7 @@
#ifdef HAVE_ICONV
#include <iconv.h>
#include <errno.h>
-#ifdef HAVE_LANGINFO
+#ifdef HAVE_LANGINFO_H
#include <locale.h>
#include <langinfo.h>
#endif
@@ -151,7 +151,7 @@
static char*
currentCharacterEncoding()
{
-#ifdef HAVE_LANGINFO
+#ifdef HAVE_LANGINFO_H
char* cur_code = nl_langinfo(CODESET);
#else
char* env_lang = getenv("LANG");
@@ -1527,7 +1527,7 @@
enum TextEncoding id3_tenc = TENC_LATIN1;
#endif
-#ifdef HAVE_ICONV
+#ifdef HAVE_LANGINFO_H
setlocale(LC_CTYPE, "");
#endif
inPath[0] = '\0';

View File

@@ -0,0 +1,11 @@
--- a/libmp3lame/util.c
+++ b/libmp3lame/util.c
@@ -911,7 +911,7 @@
mask &= ~(_EM_OVERFLOW | _EM_ZERODIVIDE | _EM_INVALID);
_FPU_SETCW(mask);
}
-# elif defined(__linux__)
+# elif defined(__linux__) && !defined(__ANDROID__)
{
# include <fpu_control.h>

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)
find_package(libmp3lame REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE libmp3lame::libmp3lame)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "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")

View File

@@ -0,0 +1,10 @@
#include <lame/lame.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%s\n", get_lame_version());
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,3 @@
versions:
"3.100":
folder: all

View File

@@ -0,0 +1,33 @@
sources:
"1.2.2":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2.tar.xz"
sha256: "3799ca9924d3125038880367bf1468e53a1b7e3686a934f098b7e1d286cdb80e"
"1.2.0":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libsndfile/libsndfile/releases/download/1.2.0/libsndfile-1.2.0.tar.xz"
sha256: "0e30e7072f83dc84863e2e55f299175c7e04a5902ae79cfb99d4249ee8f6d60a"
"1.0.31":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libsndfile/libsndfile/releases/download/1.0.31/libsndfile-1.0.31.tar.bz2"
sha256: "a8cfb1c09ea6e90eff4ca87322d4168cdbe5035cb48717b40bf77e751cc02163"
"1.0.30":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libsndfile/libsndfile/releases/download/v1.0.30/libsndfile-1.0.30.tar.bz2"
sha256: "9df273302c4fa160567f412e10cc4f76666b66281e7ba48370fb544e87e4611a"
"1.0.29":
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/libsndfile/libsndfile/releases/download/v1.0.29/libsndfile-1.0.29.tar.bz2"
sha256: "2ba20d44817c8176f097ab25eff44ef0aeec9e00973def5a7174c5ae0764b22f"
patches:
"1.2.2":
- patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch"
patch_description: "always set CMP0091"
patch_type: "portability"
"1.2.0":
- patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch"
patch_description: "always set CMP0091"
patch_type: "portability"
"1.0.31":
- patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch"
patch_description: "always set CMP0091"
patch_type: "portability"
"1.0.30":
- patch_file: "patches/1.0.30-0001-disable-static-libgcc-mingw.patch"
patch_description: "disable link libgcc statically on MINGW"
patch_type: "portability"

View File

@@ -0,0 +1,151 @@
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
from conan.tools.scm import Version
import os
required_conan_version = ">=1.54.0"
class LibsndfileConan(ConanFile):
name = "libsndfile"
license = "LGPL-2.1"
url = "https://github.com/conan-io/conan-center-index"
homepage = "http://www.mega-nerd.com/libsndfile"
description = (
"Libsndfile is a library of C routines for reading and writing files "
"containing sampled audio data."
)
topics = ("audio",)
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"programs": [True, False],
"experimental": [True, False],
"with_alsa": [True, False],
"with_external_libs": [True, False],
"with_mpeg": [True, False],
"with_sndio": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"programs": True,
"experimental": False,
"with_alsa": False,
"with_external_libs": True,
"with_mpeg": True,
"with_sndio": False,
}
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
del self.options.with_alsa
if Version(self.version) < "1.1.0":
del self.options.with_mpeg
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 validate(self):
if self.options.with_sndio:
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")
def requirements(self):
if self.options.with_sndio:
self.requires("libsndio/1.9.0", options={"with_alsa": self.options.get_safe("with_alsa")})
if self.options.get_safe("with_alsa"):
self.requires("libalsa/1.2.10")
if self.options.with_external_libs:
self.requires("ogg/1.3.5")
self.requires("vorbis/1.3.7")
self.requires("flac/1.4.2")
self.requires("opus/1.4")
if self.options.get_safe("with_mpeg"):
self.requires("mpg123/1.31.2")
self.requires("libmp3lame/3.100")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
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:
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Ogg"] = True
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Vorbis"] = True
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_FLAC"] = True
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_Opus"] = True
if not self.options.get_safe("with_alsa", False):
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_ALSA"] = True
tc.variables["BUILD_PROGRAMS"] = self.options.programs
tc.variables["BUILD_EXAMPLES"] = False
tc.variables["BUILD_TESTING"] = False
tc.variables["ENABLE_CPACK"] = False
tc.variables["ENABLE_EXPERIMENTAL"] = self.options.experimental
if is_msvc(self) and Version(self.version) < "1.0.30":
tc.variables["ENABLE_STATIC_RUNTIME"] = is_msvc_static_runtime(self)
tc.variables["BUILD_REGTEST"] = False
# https://github.com/libsndfile/libsndfile/commit/663a59aa6ea5e24cf5159b8e1c2b0735712ea74e#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a
if Version(self.version) >= "1.1.0":
tc.variables["ENABLE_MPEG"] = self.options.with_mpeg
# Fix iOS/tvOS/watchOS
tc.variables["CMAKE_MACOSX_BUNDLE"] = False
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "COPYING", 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", "cmake"))
rmdir(self, os.path.join(self.package_folder, "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "SndFile")
self.cpp_info.set_property("cmake_target_name", "SndFile::sndfile")
self.cpp_info.set_property("pkg_config_name", "sndfile")
self.cpp_info.libs = ["sndfile"]
if self.options.with_sndio:
self.cpp_info.requires.append("libsndio::libsndio")
if self.options.with_external_libs:
self.cpp_info.requires.extend([
"ogg::ogg", "vorbis::vorbismain", "vorbis::vorbisenc",
"flac::flac", "opus::opus",
])
if self.options.get_safe("with_mpeg", False):
self.cpp_info.requires.append("mpg123::mpg123")
self.cpp_info.requires.append("libmp3lame::libmp3lame")
if self.options.get_safe("with_alsa"):
self.cpp_info.requires.append("libalsa::libalsa")
if not self.options.shared:
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m", "dl", "pthread", "rt"]
elif self.settings.os == "Windows":
self.cpp_info.system_libs.append("winmm")

View File

@@ -0,0 +1,11 @@
--- a/cmake/SndFileChecks.cmake
+++ b/cmake/SndFileChecks.cmake
@@ -213,7 +213,7 @@ if (MSVC)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
endif (MSVC)
-if (MINGW)
+if (FALSE)
if (CMAKE_C_COMPILER_ID STREQUAL GNU)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")

View File

@@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ if (POLICY CMP0091)
return ()
endif ()
- if (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
+ if (1)
cmake_policy (SET CMP0091 NEW)
else ()
cmake_policy (SET CMP0091 OLD)

View File

@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C CXX)
find_package(SndFile REQUIRED CONFIG)
add_executable(${PROJECT_NAME}_c test_package.c)
target_link_libraries(${PROJECT_NAME}_c PRIVATE SndFile::sndfile)
add_executable(${PROJECT_NAME}_cxx test_package.cpp)
target_link_libraries(${PROJECT_NAME}_cxx PRIVATE SndFile::sndfile)

View File

@@ -0,0 +1,28 @@
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.bindir, "test_package_c")
self.run(bin_path, env="conanrun")
bin_path = os.path.join(self.cpp.build.bindir, "test_package_cxx")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,14 @@
#include "sndfile.h"
#include <stdio.h>
int main(int argc, char *argv[]) {
if (argc < 2) {
puts("Usage: example <file.wav>\n");
return 0;
}
SF_INFO sfinfo;
SNDFILE *infile = sf_open (argv[1], SFM_READ, &sfinfo);
printf("Sample rate: %d\n", sfinfo.samplerate);
return 0;
}

View File

@@ -0,0 +1,17 @@
#include "sndfile.hh"
#if __cplusplus < 201100 && defined(_MSC_VER)
#undef nullptr
#endif
#include <iostream>
int main(int argc, char *argv[]) {
if (argc < 2) {
std::cout << "Usage: example <file.wav>\n";
return 0;
}
SndfileHandle handle(argv[1]);
std::cout << "Sample rate: " << handle.samplerate() << "\n";
return 0;
}

View File

@@ -0,0 +1,11 @@
versions:
"1.2.2":
folder: "all"
"1.2.0":
folder: "all"
"1.0.31":
folder: "all"
"1.0.30":
folder: "all"
"1.0.29":
folder: "all"

View File

@@ -0,0 +1,27 @@
sources:
"2.2.1":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/archive/v2.2.1/SVT-AV1-v2.2.1.tar.gz"
sha256: "d02b54685542de0236bce4be1b50912aba68aff997c43b350d84a518df0cf4e5"
"2.1.2":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/archive/v2.1.2/SVT-AV1-v2.1.2.tar.gz"
sha256: "65e90af18f31f8c8d2e9febf909a7d61f36172536abb25a7089f152210847cd9"
"2.1.0":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/archive/v2.1.0/SVT-AV1-v2.1.0.tar.gz"
sha256: "72a076807544f3b269518ab11656f77358284da7782cece497781ab64ed4cb8a"
"1.7.0":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/archive/v1.7.0/SVT-AV1-v1.7.0.tar.gz"
sha256: "ce0973584f1a187aa4abf63f509ff8464397120878e322a3153f87e9c161fc4f"
"1.6.0":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/archive/v1.6.0/SVT-AV1-v1.6.0.tar.bz2"
sha256: "c6b49111a2d4c5113f1ada0c2f716d94bd4a8db704623d453066826401ecdab5"
patches:
"1.7.0":
- patch_file: "patches/external-cpuinfo-1.7.0.patch"
patch_type: "portability"
patch_source: https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/merge_requests/2178
patch_description: "Allow compiling with external cpuinfo"
"1.6.0":
- patch_file: "patches/external-cpuinfo-1.6.0.patch"
patch_type: "portability"
patch_source: https://nexus.avroid.tech/repository/all-raw-proxy-gitlab_com/AOMediaCodec/SVT-AV1/-/merge_requests/2178
patch_description: "Allow compiling with external cpuinfo"

View File

@@ -0,0 +1,146 @@
import os
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake
from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
required_conan_version = ">=1.54.0"
class SVTAV1Conan(ConanFile):
name = "libsvtav1"
description = "An AV1-compliant software encoder/decoder library"
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://gitlab.com/AOMediaCodec/SVT-AV1"
topics = ("av1", "codec", "encoder", "decoder", "video")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"build_encoder": [True, False],
"build_decoder": [True, False],
"minimal_build": [True, False],
"with_neon": [True, False],
"with_arm_crc32": [True, False],
"with_neon_dotprod": [True, False],
"with_neon_i8mm": [True, False],
"with_neon_sve": [True, False],
"with_neon_sve2": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"build_encoder": True,
"build_decoder": True,
"minimal_build": False,
"with_neon": True,
"with_arm_crc32": True,
"with_neon_dotprod": True,
"with_neon_i8mm": True,
"with_neon_sve": True,
"with_neon_sve2": True,
}
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")
if Version(self.version) < "2.0.0":
del self.options.minimal_build
if Version(self.version) >= "2.1.1":
# https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/c949fe4f14fe288a9b2b47aa3e61335422a83645/CHANGELOG.md#211---2024-06-25
del self.options.build_decoder
if Version(self.version) < "2.2.1" or self.settings.arch not in ("armv8", "armv8.3"):
del self.options.with_neon
del self.options.with_arm_crc32
del self.options.with_neon_dotprod
del self.options.with_neon_i8mm
del self.options.with_neon_sve
del self.options.with_neon_sve2
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
self.requires("cpuinfo/cci.20231129")
def validate(self):
# https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2081
# https://gitlab.com/AOMediaCodec/SVT-AV1/-/commit/800a81b09db1cf8c9c289ecf6f70381d7888b98c
if Version(self.version) < "1.9.0" and self.settings.os == "Android":
raise ConanInvalidConfiguration(f"{self.ref} does not support Android before version 1.9.0.")
def build_requirements(self):
# if Version(self.version) >= "1.3.0":
# self.tool_requires("cmake/[>=3.16 <4]")
if self.settings.arch in ("x86", "x86_64"):
self.tool_requires("nasm/2.16.01")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_APPS"] = False
if Version(self.version) < "2.1.1":
tc.variables["BUILD_DEC"] = self.options.build_decoder
tc.variables["BUILD_ENC"] = self.options.build_encoder
tc.variables["USE_EXTERNAL_CPUINFO"] = True
if self.settings.arch in ("x86", "x86_64"):
tc.variables["ENABLE_NASM"] = True
tc.variables["MINIMAL_BUILD"] = self.options.get_safe("minimal_build", False)
if "with_neon" in self.options:
tc.variables["ENABLE_NEON"] = self.options.with_neon
if "with_arm_crc32" in self.options:
tc.variables["ENABLE_ARM_CRC32"] = self.options.with_arm_crc32
if "with_neon_dotprod" in self.options:
tc.variables["ENABLE_NEON_DOTPROD"] = self.options.with_neon_dotprod
if "with_neon_i8mm" in self.options:
tc.variables["ENABLE_NEON_i8MM"] = self.options.with_neon_i8mm
if "with_sve" in self.options:
tc.variables["ENABLE_SVE"] = self.options.with_sve
if "with_sve2" in self.options:
tc.variables["ENABLE_SVE2"] = self.options.with_sve2
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
for license_file in ("LICENSE.md", "PATENTS.md"):
copy(self, license_file, self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.configure()
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
def package_info(self):
if self.options.build_encoder:
self.cpp_info.components["encoder"].libs = ["SvtAv1Enc"]
self.cpp_info.components["encoder"].includedirs = ["include/svt-av1"]
self.cpp_info.components["encoder"].set_property("pkg_config_name", "SvtAv1Enc")
self.cpp_info.components["encoder"].requires = ["cpuinfo::cpuinfo"]
if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"]
if self.options.get_safe("build_decoder"):
self.cpp_info.components["decoder"].libs = ["SvtAv1Dec"]
self.cpp_info.components["decoder"].includedirs = ["include/svt-av1"]
self.cpp_info.components["decoder"].set_property("pkg_config_name", "SvtAv1Dec")
self.cpp_info.components["decoder"].requires = ["cpuinfo::cpuinfo"]
if self.settings.os in ("FreeBSD", "Linux"):
self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"]

View File

@@ -0,0 +1,68 @@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f98c8675acc06b3c998f29fcc712ac8befcda129..f464ead3ea55bacd71451a24252cbaf33194292c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -151,7 +151,7 @@ set(lib_list
$<TARGET_OBJECTS:ENCODER_ASM_AVX512>
$<TARGET_OBJECTS:ENCODER_GLOBALS>
$<TARGET_OBJECTS:ENCODER_CODEC>
- cpuinfo_public
+ $<IF:$<BOOL:${USE_EXTERNAL_CPUINFO}>,cpuinfo::cpuinfo,cpuinfo_public>
gtest_all)
if(UNIX)
# App Source Files
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b651306f208f2ff0e577e89ce37fed3e80eea0ce..25df70551b8db09becab23cfa5000f03b90a9c77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,11 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
option(COMPILE_C_ONLY "Compile only C code with no simds (autodetect, default off for x86)" OFF)
+option(USE_EXTERNAL_CPUINFO "Consume system cpuinfo library only" OFF)
+
+if(USE_EXTERNAL_CPUINFO)
+ find_package(cpuinfo CONFIG REQUIRED)
+endif()
include(CheckCSourceCompiles)
@@ -590,7 +595,7 @@ endif()
add_subdirectory(third_party/fastfeat)
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(NOT USE_EXTERNAL_CPUINFO AND NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
add_subdirectory(third_party/cpuinfo)
endif()
diff --git a/Source/Lib/Encoder/CMakeLists.txt b/Source/Lib/Encoder/CMakeLists.txt
index 88553bfc4511ffcd5571300d1d45c9302d9316a6..a587e7c6ba15f7528482f476b46506b09c12cf2e 100644
--- a/Source/Lib/Encoder/CMakeLists.txt
+++ b/Source/Lib/Encoder/CMakeLists.txt
@@ -129,7 +129,9 @@ set_target_properties(SvtAv1Enc PROPERTIES VERSION ${ENC_VERSION})
set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR})
set_target_properties(SvtAv1Enc PROPERTIES C_VISIBILITY_PRESET hidden)
target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS})
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(USE_EXTERNAL_CPUINFO)
+ target_link_libraries(SvtAv1Enc PRIVATE cpuinfo::cpuinfo)
+elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public)
endif()
diff --git a/Source/Lib/Decoder/CMakeLists.txt b/Source/Lib/Decoder/CMakeLists.txt
index 0f220a78a6db783ef2b5d6dd6cc182766c4362a3..8fb88f1c958fa965bc8f9ed9c1d563ee3858baee 100644
--- a/Source/Lib/Decoder/CMakeLists.txt
+++ b/Source/Lib/Decoder/CMakeLists.txt
@@ -147,7 +147,9 @@ set_target_properties(SvtAv1Dec PROPERTIES SOVERSION ${DEC_VERSION_MAJOR})
set_target_properties(SvtAv1Dec PROPERTIES C_VISIBILITY_PRESET hidden)
add_dependencies(SvtAv1Dec EbVersionHeaderGen)
target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS})
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(USE_EXTERNAL_CPUINFO)
+ target_link_libraries(SvtAv1Dec PRIVATE cpuinfo::cpuinfo)
+elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public)
endif()

View File

@@ -0,0 +1,68 @@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3ed7c05a28ad1b46f2a79e23630d6ad17e6c6741..251a592a46046ae1878e2913683f3417db0260ad 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -152,7 +152,7 @@ set(lib_list
$<TARGET_OBJECTS:ENCODER_ASM_AVX512>
$<TARGET_OBJECTS:ENCODER_GLOBALS>
$<TARGET_OBJECTS:ENCODER_CODEC>
- cpuinfo_public
+ $<IF:$<BOOL:${USE_EXTERNAL_CPUINFO}>,cpuinfo::cpuinfo,cpuinfo_public>
gtest_all)
if(UNIX)
# App Source Files
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58642d108e2a4b042e2f7a66180e1ba2d06f043e..5b7d001473af01305d396b3d2f312adc0b3f5b81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,11 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
option(COMPILE_C_ONLY "Compile only C code with no simds (autodetect, default off for x86)" OFF)
+option(USE_EXTERNAL_CPUINFO "Consume system cpuinfo library only" OFF)
+
+if(USE_EXTERNAL_CPUINFO)
+ find_package(cpuinfo CONFIG REQUIRED)
+endif()
include(CheckCSourceCompiles)
@@ -590,7 +595,7 @@ endif()
add_subdirectory(third_party/fastfeat)
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(NOT USE_EXTERNAL_CPUINFO AND NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
add_subdirectory(third_party/cpuinfo)
endif()
diff --git a/Source/Lib/Decoder/CMakeLists.txt b/Source/Lib/Decoder/CMakeLists.txt
index 0f220a78a6db783ef2b5d6dd6cc182766c4362a3..8fb88f1c958fa965bc8f9ed9c1d563ee3858baee 100644
--- a/Source/Lib/Decoder/CMakeLists.txt
+++ b/Source/Lib/Decoder/CMakeLists.txt
@@ -147,7 +147,9 @@ set_target_properties(SvtAv1Dec PROPERTIES SOVERSION ${DEC_VERSION_MAJOR})
set_target_properties(SvtAv1Dec PROPERTIES C_VISIBILITY_PRESET hidden)
add_dependencies(SvtAv1Dec EbVersionHeaderGen)
target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS})
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(USE_EXTERNAL_CPUINFO)
+ target_link_libraries(SvtAv1Dec PRIVATE cpuinfo::cpuinfo)
+elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public)
endif()
diff --git a/Source/Lib/Encoder/CMakeLists.txt b/Source/Lib/Encoder/CMakeLists.txt
index e2a1348aa2c07a7283266323bcf58d15dc278555..13be1227444afa74055cd5172ded084de4474b91 100644
--- a/Source/Lib/Encoder/CMakeLists.txt
+++ b/Source/Lib/Encoder/CMakeLists.txt
@@ -129,7 +129,9 @@ set_target_properties(SvtAv1Enc PROPERTIES VERSION ${ENC_VERSION})
set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR})
set_target_properties(SvtAv1Enc PROPERTIES C_VISIBILITY_PRESET hidden)
target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS})
-if(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
+if(USE_EXTERNAL_CPUINFO)
+ target_link_libraries(SvtAv1Enc PRIVATE cpuinfo::cpuinfo)
+elseif(NOT COMPILE_C_ONLY AND HAVE_X86_PLATFORM)
target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public)
endif()

View File

@@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25a40f09..9c861554 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -203,10 +203,12 @@ endif()
if(UNIX)
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
- set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
- set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
+ if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
+ set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
+ endif()
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()

View File

@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(libsvtav1 REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::encoder)
if (TARGET libsvtav1::decoder)
target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::decoder)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_DECODER)
endif()

Some files were not shown because too many files have changed in this diff Show More