diff --git a/recipes/cpuinfo/all/conandata.yml b/recipes/cpuinfo/all/conandata.yml new file mode 100644 index 0000000..9318114 --- /dev/null +++ b/recipes/cpuinfo/all/conandata.yml @@ -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" diff --git a/recipes/cpuinfo/all/conanfile.py b/recipes/cpuinfo/all/conanfile.py new file mode 100644 index 0000000..58abd36 --- /dev/null +++ b/recipes/cpuinfo/all/conanfile.py @@ -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") diff --git a/recipes/cpuinfo/all/test_package/CMakeLists.txt b/recipes/cpuinfo/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..96ba94c --- /dev/null +++ b/recipes/cpuinfo/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/cpuinfo/all/test_package/conanfile.py b/recipes/cpuinfo/all/test_package/conanfile.py new file mode 100644 index 0000000..2690818 --- /dev/null +++ b/recipes/cpuinfo/all/test_package/conanfile.py @@ -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") diff --git a/recipes/cpuinfo/all/test_package/test_package.c b/recipes/cpuinfo/all/test_package/test_package.c new file mode 100644 index 0000000..7287813 --- /dev/null +++ b/recipes/cpuinfo/all/test_package/test_package.c @@ -0,0 +1,23 @@ +#include + +#include + +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; +} diff --git a/recipes/cpuinfo/config.yml b/recipes/cpuinfo/config.yml new file mode 100644 index 0000000..a71ccd4 --- /dev/null +++ b/recipes/cpuinfo/config.yml @@ -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 diff --git a/recipes/dav1d/all/conandata.yml b/recipes/dav1d/all/conandata.yml new file mode 100644 index 0000000..0197b90 --- /dev/null +++ b/recipes/dav1d/all/conandata.yml @@ -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" diff --git a/recipes/dav1d/all/conanfile.py b/recipes/dav1d/all/conanfile.py new file mode 100644 index 0000000..255c0d0 --- /dev/null +++ b/recipes/dav1d/all/conanfile.py @@ -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")) diff --git a/recipes/dav1d/all/test_package/CMakeLists.txt b/recipes/dav1d/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..7ef9974 --- /dev/null +++ b/recipes/dav1d/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/dav1d/all/test_package/conanfile.py b/recipes/dav1d/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/dav1d/all/test_package/conanfile.py @@ -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") diff --git a/recipes/dav1d/all/test_package/test_package.c b/recipes/dav1d/all/test_package/test_package.c new file mode 100644 index 0000000..cfddab4 --- /dev/null +++ b/recipes/dav1d/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include "dav1d/dav1d.h" + +#include + +int main() +{ + printf("dav1d version: %s\n", dav1d_version()); + return 0; +} diff --git a/recipes/dav1d/config.yml b/recipes/dav1d/config.yml new file mode 100644 index 0000000..d5bc79e --- /dev/null +++ b/recipes/dav1d/config.yml @@ -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" diff --git a/recipes/ffmpeg/all/conandata.yml b/recipes/ffmpeg/all/conandata.yml new file mode 100644 index 0000000..ce04568 --- /dev/null +++ b/recipes/ffmpeg/all/conandata.yml @@ -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" diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py new file mode 100644 index 0000000..77f71ce --- /dev/null +++ b/recipes/ffmpeg/all/conanfile.py @@ -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") diff --git a/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch b/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch new file mode 100644 index 0000000..5855404 --- /dev/null +++ b/recipes/ffmpeg/all/patches/4.4-0001-fix-aom_codec_av1_dx_algo.patch @@ -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 = { diff --git a/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch b/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch new file mode 100644 index 0000000..344b5c8 --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.0-0001-fix-hwcontext_vulkan.patch @@ -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 */ diff --git a/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch b/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch new file mode 100644 index 0000000..f60f6d4 --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0001-fix-libsvtav1-compressed_ten_bit_format.patch @@ -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)); diff --git a/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch b/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch new file mode 100644 index 0000000..9df9fbb --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0002-fix-libsvtav1-vbv_bufsize-1.patch @@ -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); diff --git a/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch b/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch new file mode 100644 index 0000000..6bf5219 --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0003-fix-libsvtav1-vbv_bufsize-2.patch @@ -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; diff --git a/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch b/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch new file mode 100644 index 0000000..53a596d --- /dev/null +++ b/recipes/ffmpeg/all/patches/5.1-0004-fix-binutils.patch @@ -0,0 +1,73 @@ +From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= +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 +--- + 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; + } + diff --git a/recipes/ffmpeg/all/test_package/CMakeLists.txt b/recipes/ffmpeg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..e8b1985 --- /dev/null +++ b/recipes/ffmpeg/all/test_package/CMakeLists.txt @@ -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 () diff --git a/recipes/ffmpeg/all/test_package/conanfile.py b/recipes/ffmpeg/all/test_package/conanfile.py new file mode 100644 index 0000000..98ab558 --- /dev/null +++ b/recipes/ffmpeg/all/test_package/conanfile.py @@ -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") diff --git a/recipes/ffmpeg/all/test_package/test_package.c b/recipes/ffmpeg/all/test_package/test_package.c new file mode 100644 index 0000000..a868a90 --- /dev/null +++ b/recipes/ffmpeg/all/test_package/test_package.c @@ -0,0 +1,55 @@ +#ifdef HAVE_FFMPEG_AVCODEC +# include +#endif +#ifdef HAVE_FFMPEG_AVFORMAT +# include +#endif +#ifdef HAVE_FFMPEG_AVFILTER +# include +#endif +#ifdef HAVE_FFMPEG_AVDEVICE +# include +#endif +#ifdef HAVE_FFMPEG_SWRESAMPLE +# include +#endif +#ifdef HAVE_FFMPEG_SWSCALE +# include +#endif +#include + +#include +#include + +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; +} diff --git a/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt b/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000..0d20897 --- /dev/null +++ b/recipes/ffmpeg/all/test_v1_package/CMakeLists.txt @@ -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) diff --git a/recipes/ffmpeg/all/test_v1_package/conanfile.py b/recipes/ffmpeg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000..eab3ab9 --- /dev/null +++ b/recipes/ffmpeg/all/test_v1_package/conanfile.py @@ -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) diff --git a/recipes/ffmpeg/config.yml b/recipes/ffmpeg/config.yml new file mode 100644 index 0000000..024586b --- /dev/null +++ b/recipes/ffmpeg/config.yml @@ -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" diff --git a/recipes/flac/all/conandata.yml b/recipes/flac/all/conandata.yml new file mode 100644 index 0000000..328bd75 --- /dev/null +++ b/recipes/flac/all/conandata.yml @@ -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" diff --git a/recipes/flac/all/conanfile.py b/recipes/flac/all/conanfile.py new file mode 100644 index 0000000..1237188 --- /dev/null +++ b/recipes/flac/all/conanfile.py @@ -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++" diff --git a/recipes/flac/all/patches/1.4.2-002-ignore-dll_export-define.patch b/recipes/flac/all/patches/1.4.2-002-ignore-dll_export-define.patch new file mode 100644 index 0000000..0ce0853 --- /dev/null +++ b/recipes/flac/all/patches/1.4.2-002-ignore-dll_export-define.patch @@ -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 diff --git a/recipes/flac/all/patches/fix-cmake-1.3.3.patch b/recipes/flac/all/patches/fix-cmake-1.3.3.patch new file mode 100644 index 0000000..3c5a864 --- /dev/null +++ b/recipes/flac/all/patches/fix-cmake-1.3.3.patch @@ -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( + $<$,$>:-Wdeclaration-after-statement>) + + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG) +- add_compile_options(-mstackrealign) ++ add_compile_options($<$,$>:-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 + "$" + "$") +-target_link_libraries(FLAC PRIVATE $<$:m>) ++target_link_libraries(FLAC PUBLIC $<$: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}") diff --git a/recipes/flac/all/test_package/CMakeLists.txt b/recipes/flac/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..3b8634d --- /dev/null +++ b/recipes/flac/all/test_package/CMakeLists.txt @@ -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++) diff --git a/recipes/flac/all/test_package/conanfile.py b/recipes/flac/all/test_package/conanfile.py new file mode 100644 index 0000000..3a8c6c5 --- /dev/null +++ b/recipes/flac/all/test_package/conanfile.py @@ -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") diff --git a/recipes/flac/all/test_package/test_package.cpp b/recipes/flac/all/test_package/test_package.cpp new file mode 100644 index 0000000..7cf6cde --- /dev/null +++ b/recipes/flac/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +#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; +} diff --git a/recipes/flac/config.yml b/recipes/flac/config.yml new file mode 100644 index 0000000..05362b1 --- /dev/null +++ b/recipes/flac/config.yml @@ -0,0 +1,7 @@ +versions: + "1.4.3": + folder: all + "1.4.2": + folder: all + "1.3.3": + folder: all diff --git a/recipes/libalsa/all/conandata.yml b/recipes/libalsa/all/conandata.yml new file mode 100644 index 0000000..3454a4b --- /dev/null +++ b/recipes/libalsa/all/conandata.yml @@ -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" diff --git a/recipes/libalsa/all/conanfile.py b/recipes/libalsa/all/conanfile.py new file mode 100644 index 0000000..b47026c --- /dev/null +++ b/recipes/libalsa/all/conanfile.py @@ -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 diff --git a/recipes/libalsa/all/patches/1.2.5.1-0001-control-empty-fix-the-static-build.patch b/recipes/libalsa/all/patches/1.2.5.1-0001-control-empty-fix-the-static-build.patch new file mode 100644 index 0000000..c39bc73 --- /dev/null +++ b/recipes/libalsa/all/patches/1.2.5.1-0001-control-empty-fix-the-static-build.patch @@ -0,0 +1,25 @@ +From 81e7923fbfad45b2f353a4d6e3053af51f5f7d0b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 15 Jun 2021 23:21:42 +0200 +Subject: [PATCH] control: empty - fix the static build + +Reported-by: Jan Palus +Fixes: https://github.com/alsa-project/alsa-lib/issues/157 +Signed-off-by: Jaroslav Kysela +--- + 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 diff --git a/recipes/libalsa/all/test_package/CMakeLists.txt b/recipes/libalsa/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..ab0ad88 --- /dev/null +++ b/recipes/libalsa/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libalsa/all/test_package/conanfile.py b/recipes/libalsa/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/libalsa/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libalsa/all/test_package/test_package.c b/recipes/libalsa/all/test_package/test_package.c new file mode 100644 index 0000000..5fe270f --- /dev/null +++ b/recipes/libalsa/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("libalsa version %s\n", snd_asoundlib_version()); + return 0; +} diff --git a/recipes/libalsa/config.yml b/recipes/libalsa/config.yml new file mode 100644 index 0000000..11dc7bc --- /dev/null +++ b/recipes/libalsa/config.yml @@ -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 diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml new file mode 100644 index 0000000..9f0b3dc --- /dev/null +++ b/recipes/libaom-av1/all/conandata.yml @@ -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. diff --git a/recipes/libaom-av1/all/conanfile.py b/recipes/libaom-av1/all/conanfile.py new file mode 100644 index 0000000..32cc533 --- /dev/null +++ b/recipes/libaom-av1/all/conanfile.py @@ -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"] diff --git a/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch b/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch new file mode 100644 index 0000000..128bfeb --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-2.0.1-fix-install.patch @@ -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 diff --git a/recipes/libaom-av1/all/patches/0001-3.4.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.4.0-fix-install.patch new file mode 100644 index 0000000..cdf8395 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.4.0-fix-install.patch @@ -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() diff --git a/recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch new file mode 100644 index 0000000..1bb2cbd --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.8.0-fix-install.patch @@ -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() diff --git a/recipes/libaom-av1/all/test_package/CMakeLists.txt b/recipes/libaom-av1/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..f5305ce --- /dev/null +++ b/recipes/libaom-av1/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libaom-av1/all/test_package/conanfile.py b/recipes/libaom-av1/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/libaom-av1/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libaom-av1/all/test_package/test_package.c b/recipes/libaom-av1/all/test_package/test_package.c new file mode 100644 index 0000000..eca39e0 --- /dev/null +++ b/recipes/libaom-av1/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include "aom/aom_codec.h" +#include + +int main() { + printf("Version: %s\n", aom_codec_version_str()); + return 0; +} diff --git a/recipes/libaom-av1/config.yml b/recipes/libaom-av1/config.yml new file mode 100644 index 0000000..45dfabb --- /dev/null +++ b/recipes/libaom-av1/config.yml @@ -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 diff --git a/recipes/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml new file mode 100644 index 0000000..946a2ba --- /dev/null +++ b/recipes/libcap/all/conandata.yml @@ -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" diff --git a/recipes/libcap/all/conanfile.py b/recipes/libcap/all/conanfile.py new file mode 100644 index 0000000..0b95333 --- /dev/null +++ b/recipes/libcap/all/conanfile.py @@ -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") diff --git a/recipes/libcap/all/patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch b/recipes/libcap/all/patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch new file mode 100644 index 0000000..b32820b --- /dev/null +++ b/recipes/libcap/all/patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch @@ -0,0 +1,26 @@ +From bb2c4e80928e8221a31c3631f5a802c7b022aebd Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Sun, 29 Aug 2021 12:02:23 +0300 +Subject: [PATCH 1/2] Make.Rules: Remove hardcoded -fPIC + +Signed-off-by: Sergey Bobrenok +--- + 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 + diff --git a/recipes/libcap/all/patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch b/recipes/libcap/all/patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch new file mode 100644 index 0000000..5ac5d36 --- /dev/null +++ b/recipes/libcap/all/patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch @@ -0,0 +1,36 @@ +From 76e637ad20faa811f4091a8a08af4b29c528697b Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Sun, 29 Aug 2021 12:06:18 +0300 +Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable + +Signed-off-by: Sergey Bobrenok +--- + 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 + diff --git a/recipes/libcap/all/patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch b/recipes/libcap/all/patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch new file mode 100644 index 0000000..bc612d7 --- /dev/null +++ b/recipes/libcap/all/patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch @@ -0,0 +1,27 @@ +From b70454fccba1816b14d50813b1715e9a50d7cca0 Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Sat, 11 Sep 2021 20:39:49 +0300 +Subject: [PATCH 1/2] libcap: Remove hardcoded -fPIC + +Signed-off-by: Sergey Bobrenok +--- + 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 + diff --git a/recipes/libcap/all/patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch b/recipes/libcap/all/patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch new file mode 100644 index 0000000..2807835 --- /dev/null +++ b/recipes/libcap/all/patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch @@ -0,0 +1,33 @@ +From a38f5a330d65cc877fcc1da02836526d11ead4f0 Mon Sep 17 00:00:00 2001 +From: Sergey Bobrenok +Date: Sat, 11 Sep 2021 20:44:07 +0300 +Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable + +Signed-off-by: Sergey Bobrenok +--- + 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 + diff --git a/recipes/libcap/all/test_package/CMakeLists.txt b/recipes/libcap/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..9cf6b90 --- /dev/null +++ b/recipes/libcap/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libcap/all/test_package/conanfile.py b/recipes/libcap/all/test_package/conanfile.py new file mode 100644 index 0000000..b567eb6 --- /dev/null +++ b/recipes/libcap/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libcap/all/test_package/test_package.c b/recipes/libcap/all/test_package/test_package.c new file mode 100644 index 0000000..432f01f --- /dev/null +++ b/recipes/libcap/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include +#include + +#include + +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); +} diff --git a/recipes/libcap/config.yml b/recipes/libcap/config.yml new file mode 100644 index 0000000..e8abe4a --- /dev/null +++ b/recipes/libcap/config.yml @@ -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 diff --git a/recipes/libfdk_aac/all/conandata.yml b/recipes/libfdk_aac/all/conandata.yml new file mode 100644 index 0000000..e92d374 --- /dev/null +++ b/recipes/libfdk_aac/all/conandata.yml @@ -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" diff --git a/recipes/libfdk_aac/all/conanfile.py b/recipes/libfdk_aac/all/conanfile.py new file mode 100644 index 0000000..10b59e0 --- /dev/null +++ b/recipes/libfdk_aac/all/conanfile.py @@ -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") diff --git a/recipes/libfdk_aac/all/test_package/CMakeLists.txt b/recipes/libfdk_aac/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..6099762 --- /dev/null +++ b/recipes/libfdk_aac/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libfdk_aac/all/test_package/conanfile.py b/recipes/libfdk_aac/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/libfdk_aac/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libfdk_aac/all/test_package/test_package.c b/recipes/libfdk_aac/all/test_package/test_package.c new file mode 100644 index 0000000..ecb0777 --- /dev/null +++ b/recipes/libfdk_aac/all/test_package/test_package.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include + +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; +} diff --git a/recipes/libfdk_aac/config.yml b/recipes/libfdk_aac/config.yml new file mode 100644 index 0000000..7529da0 --- /dev/null +++ b/recipes/libfdk_aac/config.yml @@ -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 diff --git a/recipes/libiconv/all/conandata.yml b/recipes/libiconv/all/conandata.yml new file mode 100644 index 0000000..382abd7 --- /dev/null +++ b/recipes/libiconv/all/conandata.yml @@ -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" diff --git a/recipes/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py new file mode 100644 index 0000000..6637381 --- /dev/null +++ b/recipes/libiconv/all/conanfile.py @@ -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")) diff --git a/recipes/libiconv/all/config.log b/recipes/libiconv/all/config.log new file mode 100644 index 0000000..1d33d34 --- /dev/null +++ b/recipes/libiconv/all/config.log @@ -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 + | ^~~~~~~~~~~~~~~~~~ +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 +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 + | ^~~~~~~~~~~~~~~~~~ +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 +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 + | ^~~~~~~~~~~~~~~~ +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 +| #ifdef HAVE_STDIO_H +| # include +| #endif +| #ifdef HAVE_STDLIB_H +| # include +| #endif +| #ifdef HAVE_STRING_H +| # include +| #endif +| #ifdef HAVE_INTTYPES_H +| # include +| #endif +| #ifdef HAVE_STDINT_H +| # include +| #endif +| #ifdef HAVE_STRINGS_H +| # include +| #endif +| #ifdef HAVE_SYS_TYPES_H +| # include +| #endif +| #ifdef HAVE_SYS_STAT_H +| # include +| #endif +| #ifdef HAVE_UNISTD_H +| # include +| #endif +| #include +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 diff --git a/recipes/libiconv/all/patches/0001-libcharset-fix-linkage.patch b/recipes/libiconv/all/patches/0001-libcharset-fix-linkage.patch new file mode 100644 index 0000000..f39e0b7 --- /dev/null +++ b/recipes/libiconv/all/patches/0001-libcharset-fix-linkage.patch @@ -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 . */ ++ ++#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 ++ ++ ++#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 */ diff --git a/recipes/libiconv/all/test_package/CMakeLists.txt b/recipes/libiconv/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..64fa90d --- /dev/null +++ b/recipes/libiconv/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libiconv/all/test_package/conanfile.py b/recipes/libiconv/all/test_package/conanfile.py new file mode 100644 index 0000000..12a4269 --- /dev/null +++ b/recipes/libiconv/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libiconv/all/test_package/test_package.c b/recipes/libiconv/all/test_package/test_package.c new file mode 100644 index 0000000..2b5cf12 --- /dev/null +++ b/recipes/libiconv/all/test_package/test_package.c @@ -0,0 +1,50 @@ +#include +#include +#include //for EXIT_FAILURE +#include + +#if _MSC_VER && _MSC_VER < 1600 +typedef unsigned __int32 uint32_t; +#else +#include +#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; +} diff --git a/recipes/libiconv/all/test_v1_package/CMakeLists.txt b/recipes/libiconv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000..0d20897 --- /dev/null +++ b/recipes/libiconv/all/test_v1_package/CMakeLists.txt @@ -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) diff --git a/recipes/libiconv/all/test_v1_package/conanfile.py b/recipes/libiconv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000..a831367 --- /dev/null +++ b/recipes/libiconv/all/test_v1_package/conanfile.py @@ -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) diff --git a/recipes/libiconv/config.yml b/recipes/libiconv/config.yml new file mode 100644 index 0000000..107f427 --- /dev/null +++ b/recipes/libiconv/config.yml @@ -0,0 +1,7 @@ +versions: + "1.17": + folder: all + "1.16": + folder: all + "1.15": + folder: all diff --git a/recipes/libmp3lame/all/conandata.yml b/recipes/libmp3lame/all/conandata.yml new file mode 100644 index 0000000..4e90c24 --- /dev/null +++ b/recipes/libmp3lame/all/conandata.yml @@ -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" diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py new file mode 100644 index 0000000..370cc4c --- /dev/null +++ b/recipes/libmp3lame/all/conanfile.py @@ -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"] diff --git a/recipes/libmp3lame/all/patches/6410.patch b/recipes/libmp3lame/all/patches/6410.patch new file mode 100644 index 0000000..be5b608 --- /dev/null +++ b/recipes/libmp3lame/all/patches/6410.patch @@ -0,0 +1,77 @@ +--- a/frontend/parse.c ++++ b/frontend/parse.c +@@ -70,8 +70,10 @@ + #ifdef HAVE_ICONV + #include + #include ++#ifdef HAVE_LANGINFO + #include + #include ++#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; diff --git a/recipes/libmp3lame/all/patches/6416.patch b/recipes/libmp3lame/all/patches/6416.patch new file mode 100644 index 0000000..65ee30e --- /dev/null +++ b/recipes/libmp3lame/all/patches/6416.patch @@ -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 + #include +-#ifdef HAVE_LANGINFO ++#ifdef HAVE_LANGINFO_H + #include + #include + #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'; diff --git a/recipes/libmp3lame/all/patches/android.patch b/recipes/libmp3lame/all/patches/android.patch new file mode 100644 index 0000000..6ea069c --- /dev/null +++ b/recipes/libmp3lame/all/patches/android.patch @@ -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 diff --git a/recipes/libmp3lame/all/test_package/CMakeLists.txt b/recipes/libmp3lame/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..c1f711f --- /dev/null +++ b/recipes/libmp3lame/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libmp3lame/all/test_package/conanfile.py b/recipes/libmp3lame/all/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/libmp3lame/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libmp3lame/all/test_package/test_package.c b/recipes/libmp3lame/all/test_package/test_package.c new file mode 100644 index 0000000..dc25ae5 --- /dev/null +++ b/recipes/libmp3lame/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include + +#include +#include + +int main() +{ + printf("%s\n", get_lame_version()); + return EXIT_SUCCESS; +} diff --git a/recipes/libmp3lame/config.yml b/recipes/libmp3lame/config.yml new file mode 100644 index 0000000..65d4204 --- /dev/null +++ b/recipes/libmp3lame/config.yml @@ -0,0 +1,3 @@ +versions: + "3.100": + folder: all diff --git a/recipes/libsndfile/all/conandata.yml b/recipes/libsndfile/all/conandata.yml new file mode 100644 index 0000000..86d7961 --- /dev/null +++ b/recipes/libsndfile/all/conandata.yml @@ -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" diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py new file mode 100644 index 0000000..44eae8b --- /dev/null +++ b/recipes/libsndfile/all/conanfile.py @@ -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") diff --git a/recipes/libsndfile/all/patches/1.0.30-0001-disable-static-libgcc-mingw.patch b/recipes/libsndfile/all/patches/1.0.30-0001-disable-static-libgcc-mingw.patch new file mode 100644 index 0000000..f7e1a5b --- /dev/null +++ b/recipes/libsndfile/all/patches/1.0.30-0001-disable-static-libgcc-mingw.patch @@ -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") diff --git a/recipes/libsndfile/all/patches/1.0.31-0001-fix-msvc-runtime-logic.patch b/recipes/libsndfile/all/patches/1.0.31-0001-fix-msvc-runtime-logic.patch new file mode 100644 index 0000000..abada26 --- /dev/null +++ b/recipes/libsndfile/all/patches/1.0.31-0001-fix-msvc-runtime-logic.patch @@ -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) diff --git a/recipes/libsndfile/all/test_package/CMakeLists.txt b/recipes/libsndfile/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..c6050ed --- /dev/null +++ b/recipes/libsndfile/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/libsndfile/all/test_package/conanfile.py b/recipes/libsndfile/all/test_package/conanfile.py new file mode 100644 index 0000000..cc3db8e --- /dev/null +++ b/recipes/libsndfile/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libsndfile/all/test_package/test_package.c b/recipes/libsndfile/all/test_package/test_package.c new file mode 100644 index 0000000..ef4f2a1 --- /dev/null +++ b/recipes/libsndfile/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include "sndfile.h" + +#include + +int main(int argc, char *argv[]) { + if (argc < 2) { + puts("Usage: example \n"); + return 0; + } + SF_INFO sfinfo; + SNDFILE *infile = sf_open (argv[1], SFM_READ, &sfinfo); + printf("Sample rate: %d\n", sfinfo.samplerate); + return 0; +} diff --git a/recipes/libsndfile/all/test_package/test_package.cpp b/recipes/libsndfile/all/test_package/test_package.cpp new file mode 100644 index 0000000..c21e7e8 --- /dev/null +++ b/recipes/libsndfile/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include "sndfile.hh" + +#if __cplusplus < 201100 && defined(_MSC_VER) +#undef nullptr +#endif + +#include + +int main(int argc, char *argv[]) { + if (argc < 2) { + std::cout << "Usage: example \n"; + return 0; + } + SndfileHandle handle(argv[1]); + std::cout << "Sample rate: " << handle.samplerate() << "\n"; + return 0; +} diff --git a/recipes/libsndfile/config.yml b/recipes/libsndfile/config.yml new file mode 100644 index 0000000..47a9d6a --- /dev/null +++ b/recipes/libsndfile/config.yml @@ -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" diff --git a/recipes/libsvtav1/all/conandata.yml b/recipes/libsvtav1/all/conandata.yml new file mode 100644 index 0000000..81b6543 --- /dev/null +++ b/recipes/libsvtav1/all/conandata.yml @@ -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" diff --git a/recipes/libsvtav1/all/conanfile.py b/recipes/libsvtav1/all/conanfile.py new file mode 100644 index 0000000..216a8e2 --- /dev/null +++ b/recipes/libsvtav1/all/conanfile.py @@ -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"] diff --git a/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch b/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch new file mode 100644 index 0000000..02c89e2 --- /dev/null +++ b/recipes/libsvtav1/all/patches/external-cpuinfo-1.6.0.patch @@ -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 + $ + $ + $ +- cpuinfo_public ++ $,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() + diff --git a/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch b/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch new file mode 100644 index 0000000..c6d38c4 --- /dev/null +++ b/recipes/libsvtav1/all/patches/external-cpuinfo-1.7.0.patch @@ -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 + $ + $ + $ +- cpuinfo_public ++ $,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() + diff --git a/recipes/libsvtav1/all/patches/llvm-clang-macos.patch b/recipes/libsvtav1/all/patches/llvm-clang-macos.patch new file mode 100644 index 0000000..f94af5a --- /dev/null +++ b/recipes/libsvtav1/all/patches/llvm-clang-macos.patch @@ -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 " Scr ") +- set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") +- set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") +- set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ if(CMAKE_C_COMPILER_ID MATCHES "AppleClang") ++ set(CMAKE_C_ARCHIVE_CREATE " Scr ") ++ set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") ++ set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ endif() + else() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack -z relro -z now") + endif() diff --git a/recipes/libsvtav1/all/test_package/CMakeLists.txt b/recipes/libsvtav1/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..9a81670 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/CMakeLists.txt @@ -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() diff --git a/recipes/libsvtav1/all/test_package/conanfile.py b/recipes/libsvtav1/all/test_package/conanfile.py new file mode 100644 index 0000000..f76921c --- /dev/null +++ b/recipes/libsvtav1/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +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") diff --git a/recipes/libsvtav1/all/test_package/test_package.cpp b/recipes/libsvtav1/all/test_package/test_package.cpp new file mode 100644 index 0000000..bb98a86 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include "EbSvtAv1Enc.h" +#ifdef HAVE_DECODER +# include "EbSvtAv1Dec.h" +#endif + +#include + +int main() { std::cout << svt_av1_get_version() << "\n"; } diff --git a/recipes/libsvtav1/config.yml b/recipes/libsvtav1/config.yml new file mode 100644 index 0000000..b7b7bfc --- /dev/null +++ b/recipes/libsvtav1/config.yml @@ -0,0 +1,11 @@ +versions: + "2.2.1": + folder: all + "2.1.2": + folder: all + "2.1.0": + folder: all + "1.7.0": + folder: all + "1.6.0": + folder: all diff --git a/recipes/libvpx/all/conandata.yml b/recipes/libvpx/all/conandata.yml new file mode 100644 index 0000000..bb48d3c --- /dev/null +++ b/recipes/libvpx/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + "1.14.1": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/webmproject/libvpx/archive/refs/tags/v1.14.1.tar.gz" + sha256: "901747254d80a7937c933d03bd7c5d41e8e6c883e0665fadcb172542167c7977" + "1.14.0": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/webmproject/libvpx/archive/refs/tags/v1.14.0.tar.gz" + sha256: "5f21d2db27071c8a46f1725928a10227ae45c5cd1cad3727e4aafbe476e321fa" + "1.13.1": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/webmproject/libvpx/archive/refs/tags/v1.13.1.tar.gz" + sha256: "00dae80465567272abd077f59355f95ac91d7809a2d3006f9ace2637dd429d14" + "1.11.0": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/webmproject/libvpx/archive/refs/tags/v1.11.0.tar.gz" + sha256: "965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83" + "1.10.0": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/webmproject/libvpx/archive/refs/tags/v1.10.0.tar.gz" + sha256: "85803ccbdbdd7a3b03d930187cb055f1353596969c1f92ebec2db839fa4f834a" +patches: + "1.11.0": + - patch_file: "patches/0001-extended-support-1.10.0.patch" + patch_type: "portability" + patch_description: "Add support for more compilers" + patch_source: "https://github.com/webmproject/libvpx/commit/cafe7cc1f10cfea74edb2ded7c3df2d69fcf1eee" + "1.10.0": + - patch_file: "patches/0001-extended-support-1.10.0.patch" + patch_type: "portability" + patch_description: "Add support for more compilers" + patch_source: "https://github.com/webmproject/libvpx/commit/cafe7cc1f10cfea74edb2ded7c3df2d69fcf1eee" diff --git a/recipes/libvpx/all/conanfile.py b/recipes/libvpx/all/conanfile.py new file mode 100644 index 0000000..391c74e --- /dev/null +++ b/recipes/libvpx/all/conanfile.py @@ -0,0 +1,274 @@ +import os +import re + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.build import stdcpp_library +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file, \ + rename +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, msvc_runtime_flag +from conan.tools.scm import Version + +required_conan_version = ">=1.57.0" + + +class LibVPXConan(ConanFile): + name = "libvpx" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.webmproject.org/code" + description = "WebM VP8/VP9 Codec SDK" + topics = "vpx", "codec", "web", "VP8", "VP9" + license = "BSD-3-Clause" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + _arch_options = ['mmx', 'sse', 'sse2', 'sse3', 'ssse3', 'sse4_1', 'avx', 'avx2', 'avx512'] + + options.update({name: [True, False] for name in _arch_options}) + default_options.update({name: 'avx' not in name for name in _arch_options}) + + @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 str(self.settings.arch) not in ['x86', 'x86_64']: + for name in self._arch_options: + delattr(self.options, name) + + def configure(self): + if self.settings.os == "Windows": + del self.options.shared + self.package_type = "static-library" + if self.options.get_safe("shared"): + self.options.rm_safe("fPIC") + if self.settings.os == "Android": + del self.options.shared + self.package_type = "static-library" + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if str(self.settings.compiler) not in ["Visual Studio", "msvc", "gcc", "clang", "apple-clang"]: + raise ConanInvalidConfiguration(f"Unsupported compiler {self.settings.compiler}") + if self.settings.os == "Macos" and self.settings.arch == "armv8" and Version(self.version) < "1.10.0": + raise ConanInvalidConfiguration("M1 only supported since 1.10, please upgrade") + if self.settings.os == "iOS" and (self.settings.os.sdk != "iphonesimulator" and self.settings.arch in ["x86_64", "x86"]): + raise ConanInvalidConfiguration("iOS platform with x86/x86_64 architectures only supports 'iphonesimulator' SDK option") + + def build_requirements(self): + self.tool_requires("nasm/2.16.01") + 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 _install_tmp_folder(self): + return "tmp_install" + + @property + def _target_name(self): + arch = {'x86': 'x86', + 'x86_64': 'x86_64', + 'armv7': 'armv7', + 'armv7s': 'armv7s', + 'armv8': 'arm64', + 'mips': 'mips32', + 'mips64': 'mips64', + 'sparc': 'sparc'}.get(str(self.settings.arch)) + compiler = str(self.settings.compiler) + os_name = str(self.settings.os) + if str(self.settings.compiler) == "Visual Studio": + vc_version = self.settings.compiler.version + compiler = f"vs{vc_version}" + elif is_msvc(self): + vc_version = str(self.settings.compiler.version) + vc_version = {"170": "11", "180": "12", "190": "14", "191": "15", "192": "16", "193": "17", "194": "17"}[vc_version] + compiler = f"vs{vc_version}" + elif self.settings.compiler in ["gcc", "clang", "apple-clang"]: + compiler = 'gcc' + host_os = str(self.settings.os) + if host_os == 'Windows': + os_name = 'win32' if self.settings.arch == 'x86' else 'win64' + elif is_apple_os(self): + if self.settings.arch in ["x86", "x86_64"]: + if self.settings.os == "Macos": + os_name = f'darwin11' + else: + os_name = 'iphonesimulator' + elif self.settings.arch == "armv8": + os_name = 'darwin21' + else: + os_name = 'darwin' + elif host_os == 'Linux': + os_name = 'linux' + elif host_os == 'Solaris': + os_name = 'solaris' + elif host_os == 'Android': + os_name = 'android' + return f"{arch}-{os_name}-{compiler}" + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + + if is_apple_os(self) and self.settings.get_safe("compiler.libcxx") == "libc++": + # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++ + tc.extra_ldflags.append("-stdlib=libc++") + + tc.configure_args.extend([ + "--disable-examples", + "--disable-unit-tests", + "--disable-tools", + "--disable-docs", + "--enable-vp9-highbitdepth", + "--as=nasm", + ]) + # Note for MSVC: release libs are always built, we just avoid keeping the release lib + # Note2: Can't use --enable-debug_libs (to help install on Windows), + # the makefile's install step fails as it wants to install a library that doesn't exist. + # Instead, we will copy the desired library manually in the package step. + if self.settings.build_type == "Debug": + tc.configure_args.extend([ + "--enable-debug" + ]) + if is_msvc(self) and is_msvc_static_runtime(self): + tc.configure_args.append("--enable-static-msvcrt") + if str(self.settings.arch) in ["x86", "x86_64"]: + for name in self._arch_options: + if not self.options.get_safe(name): + tc.configure_args.append(f"--disable-{name}") + + tc.update_configure_args({ + # libvpx does not like --prefix=/ as it fails the test for "libdir + # must be a subfolder of prefix" libvpx src/build/make/configure.sh:683 + "--prefix": f"/{self._install_tmp_folder}", + "--libdir": f"/{self._install_tmp_folder}/lib", + # Needed to let libvpx use the correct toolchain for the target platform + "--target": self._target_name, + # several options must not be injected as custom configure doesn't like them + "--host": None, + "--build": None, + "--bindir": None, + "--sbindir": None, + "--includedir": None, + "--oldincludedir": None, + "--datarootdir": None, + }) + + if is_msvc(self): + # gen_msvs_vcxproj.sh doesn't like custom flags + env = Environment() + env.define("CC", "") + else: + env = tc.environment() + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Disable LTO for Visual Studio when CFLAGS doesn't contain -GL + if is_msvc(self): + cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + lto = any(re.finditer("(^| )[/-]GL($| )", cflags)) + if not lto: + self.output.info("Disabling LTO") + replace_in_file(self, + os.path.join(self.source_folder, "build", "make", "gen_msvs_vcxproj.sh"), + "tag_content WholeProgramOptimization true", + "tag_content WholeProgramOptimization false", + ) + else: + self.output.info("Enabling LTO") + + # The compile script wants to use CC for some of the platforms (Linux, etc), + # but incorrectly assumes gcc is the compiler for those platforms. + # This can fail some of the configure tests, and -lpthread isn't added to the link command. + replace_in_file(self, + os.path.join(self.source_folder, "build", "make", "configure.sh"), + " LD=${LD:-${CROSS}${link_with_cc:-ld}}", + """ + LD=${LD:-${CROSS}${link_with_cc:-ld}} + if [ "${link_with_cc}" = "gcc" ] + then + echo "using compiler as linker" + LD=${CC} + fi +""" + ) + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + @property + def _lib_name(self): + suffix = msvc_runtime_flag(self).lower() if is_msvc(self) else "" + return f"vpx{suffix}" + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + + # The workaround requires us to move the outputs into place now + rename(self, + os.path.join(self.package_folder, self._install_tmp_folder, "include"), + os.path.join(self.package_folder, "include") + ) + + if is_msvc(self): + # Libs are still in the build folder, get from there directly. + # The makefile cannot correctly install the debug libs (see note about --enable-debug_libs) + libs_from = os.path.join( + self.build_folder, + "Win32" if self.settings.arch == "x86" else "x64", + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + # Copy for msvc, as it will generate a release and debug library, so take what we want + # Note that libvpx's configure/make doesn't support shared lib builds on windows yet. + copy(self, f"{self._lib_name}.lib", libs_from, os.path.join(self.package_folder, "lib")) + else: + # if not msvc, then libs were installed into package (in the wrong place), move them + libs_from = os.path.join(self.package_folder, self._install_tmp_folder, "lib") + rename(self, libs_from, os.path.join(self.package_folder, "lib")) + + rmdir(self, os.path.join(self.package_folder, self._install_tmp_folder)) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "vpx") + self.cpp_info.libs = [self._lib_name] + if not self.options.get_safe("shared"): + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/libvpx/all/patches/0001-extended-support-1.10.0.patch b/recipes/libvpx/all/patches/0001-extended-support-1.10.0.patch new file mode 100644 index 0000000..b1eadca --- /dev/null +++ b/recipes/libvpx/all/patches/0001-extended-support-1.10.0.patch @@ -0,0 +1,98 @@ +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -774,7 +774,7 @@ process_common_toolchain() { + tgt_isa=x86_64 + tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'` + ;; +- *darwin20*) ++ *darwin2[0-1]*) + tgt_isa=`uname -m` + tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'` + ;; +@@ -918,9 +918,9 @@ process_common_toolchain() { + add_cflags "-mmacosx-version-min=10.15" + add_ldflags "-mmacosx-version-min=10.15" + ;; +- *-darwin20-*) +- add_cflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}" +- add_ldflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}" ++ *-darwin2[0-1]-*) ++ add_cflags "-arch ${toolchain%%-*}" ++ add_ldflags "-arch ${toolchain%%-*}" + ;; + *-iphonesimulator-*) + add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}" +--- a/build/make/gen_msvs_sln.sh ++++ b/build/make/gen_msvs_sln.sh +@@ -219,6 +219,7 @@ for opt in "$@"; do + 14) vs_year=2015 ;; + 15) vs_year=2017 ;; + 16) vs_year=2019 ;; ++ 17) vs_year=2022 ;; + *) die Unrecognized Visual Studio Version in $opt ;; + esac + ;; +@@ -232,7 +233,7 @@ done + outfile=${outfile:-/dev/stdout} + mkoutfile=${mkoutfile:-/dev/stdout} + case "${vs_ver}" in +- 1[4-6]) ++ 1[4-7]) + # VS has used Format Version 12.00 continuously since vs11. + sln_vers="12.00" + sln_vers_str="Visual Studio ${vs_year}" +--- a/build/make/gen_msvs_vcxproj.sh ++++ b/build/make/gen_msvs_vcxproj.sh +@@ -170,7 +170,7 @@ for opt in "$@"; do + --ver=*) + vs_ver="$optval" + case "$optval" in +- 1[4-6]) ++ 1[4-7]) + ;; + *) die Unrecognized Visual Studio Version in $opt + ;; +@@ -344,6 +344,9 @@ generate_vcxproj() { + if [ "$vs_ver" = "16" ]; then + tag_content PlatformToolset v142 + fi ++ if [ "$vs_ver" = "17" ]; then ++ tag_content PlatformToolset v143 ++ fi + tag_content CharacterSet Unicode + if [ "$config" = "Release" ]; then + tag_content WholeProgramOptimization true +--- a/configure ++++ b/configure +@@ -100,6 +100,7 @@ EOF + all_platforms="${all_platforms} arm64-android-gcc" + all_platforms="${all_platforms} arm64-darwin-gcc" + all_platforms="${all_platforms} arm64-darwin20-gcc" ++all_platforms="${all_platforms} arm64-darwin21-gcc" + all_platforms="${all_platforms} arm64-linux-gcc" + all_platforms="${all_platforms} arm64-win64-gcc" + all_platforms="${all_platforms} arm64-win64-vs15" +@@ -139,6 +140,7 @@ all_platforms="${all_platforms} x86-win32-gcc" + all_platforms="${all_platforms} x86-win32-vs14" + all_platforms="${all_platforms} x86-win32-vs15" + all_platforms="${all_platforms} x86-win32-vs16" ++all_platforms="${all_platforms} x86-win32-vs17" + all_platforms="${all_platforms} x86_64-android-gcc" + all_platforms="${all_platforms} x86_64-darwin9-gcc" + all_platforms="${all_platforms} x86_64-darwin10-gcc" +@@ -152,6 +154,7 @@ all_platforms="${all_platforms} x86_64-darwin17-gcc" + all_platforms="${all_platforms} x86_64-darwin18-gcc" + all_platforms="${all_platforms} x86_64-darwin19-gcc" + all_platforms="${all_platforms} x86_64-darwin20-gcc" ++all_platforms="${all_platforms} x86_64-darwin21-gcc" + all_platforms="${all_platforms} x86_64-iphonesimulator-gcc" + all_platforms="${all_platforms} x86_64-linux-gcc" + all_platforms="${all_platforms} x86_64-linux-icc" +@@ -160,6 +163,7 @@ all_platforms="${all_platforms} x86_64-win64-gcc" + all_platforms="${all_platforms} x86_64-win64-vs14" + all_platforms="${all_platforms} x86_64-win64-vs15" + all_platforms="${all_platforms} x86_64-win64-vs16" ++all_platforms="${all_platforms} x86_64-win64-vs17" + all_platforms="${all_platforms} generic-gnu" + + # all_targets is a list of all targets that can be configured diff --git a/recipes/libvpx/all/test_package/CMakeLists.txt b/recipes/libvpx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..2cd854f --- /dev/null +++ b/recipes/libvpx/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libvpx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libvpx::libvpx) diff --git a/recipes/libvpx/all/test_package/conanfile.py b/recipes/libvpx/all/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/libvpx/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libvpx/all/test_package/test_package.c b/recipes/libvpx/all/test_package/test_package.c new file mode 100644 index 0000000..8c17317 --- /dev/null +++ b/recipes/libvpx/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include + +#include + +int main() +{ + printf("vpx version %s\n", vpx_codec_version_str()); + return 0; +} diff --git a/recipes/libvpx/config.yml b/recipes/libvpx/config.yml new file mode 100644 index 0000000..33ef774 --- /dev/null +++ b/recipes/libvpx/config.yml @@ -0,0 +1,11 @@ +versions: + "1.14.1": + folder: all + "1.14.0": + folder: all + "1.13.1": + folder: all + "1.11.0": + folder: all + "1.10.0": + folder: all diff --git a/recipes/libwebp/all/conandata.yml b/recipes/libwebp/all/conandata.yml new file mode 100644 index 0000000..9d0df4c --- /dev/null +++ b/recipes/libwebp/all/conandata.yml @@ -0,0 +1,44 @@ +sources: + "1.4.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/downloads.webmproject.org/releases/webp/libwebp-1.4.0.tar.gz" + sha256: "61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5" + "1.3.2": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/downloads.webmproject.org/releases/webp/libwebp-1.3.2.tar.gz" + sha256: "2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4" + "1.3.1": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/downloads.webmproject.org/releases/webp/libwebp-1.3.1.tar.gz" + sha256: "b3779627c2dfd31e3d8c4485962c2efe17785ef975e2be5c8c0c9e6cd3c4ef66" + "1.2.4": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/downloads.webmproject.org/releases/webp/libwebp-1.2.4.tar.gz" + sha256: "7bf5a8a28cc69bcfa8cb214f2c3095703c6b73ac5fba4d5480c205331d9494df" + "1.1.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-storage_googleapis_com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz" + sha256: "98a052268cc4d5ece27f76572a7f50293f439c17a98e67c4ea0c7ed6f50ef043" +patches: + "1.4.0": + - patch_file: "patches/1.4.0-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" + "1.3.2": + - patch_file: "patches/1.3.1-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" + "1.3.1": + - patch_file: "patches/1.3.1-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" + "1.2.4": + - patch_file: "patches/1.1.0-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + "1.1.0": + - patch_file: "patches/1.1.0-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.1.0-0002-qnx.patch" + patch_description: "work around cmake bug on QNX" + patch_type: "conan" + patch_source: "https://chromium-review.googlesource.com/c/webm/libwebp/+/2637274" + - patch_file: "patches/1.1.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" diff --git a/recipes/libwebp/all/conanfile.py b/recipes/libwebp/all/conanfile.py new file mode 100644 index 0000000..5e7c135 --- /dev/null +++ b/recipes/libwebp/all/conanfile.py @@ -0,0 +1,141 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class LibwebpConan(ConanFile): + name = "libwebp" + description = "Library to encode and decode images in WebP format" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://chromium.googlesource.com/webm/libwebp" + topics = ("image", "libwebp", "webp", "decoding", "encoding") + license = "BSD-3-Clause" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_simd": [True, False], + "near_lossless": [True, False], + "swap_16bit_csp": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_simd": True, + "near_lossless": True, + "swap_16bit_csp": False, + } + + 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): + 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) + # should be an option but it doesn't work yet + tc.variables["WEBP_ENABLE_SIMD"] = self.options.with_simd + tc.variables["WEBP_NEAR_LOSSLESS"] = self.options.near_lossless + tc.variables["WEBP_ENABLE_SWAP_16BIT_CSP"] = self.options.swap_16bit_csp + # avoid finding system libs + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_GIF"] = True + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_PNG"] = True + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_TIFF"] = True + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_JPEG"] = True + tc.variables["WEBP_BUILD_ANIM_UTILS"] = False + tc.variables["WEBP_BUILD_CWEBP"] = False + tc.variables["WEBP_BUILD_DWEBP"] = False + tc.variables["WEBP_BUILD_IMG2WEBP"] = False + tc.variables["WEBP_BUILD_GIF2WEBP"] = False + tc.variables["WEBP_BUILD_VWEBP"] = False + tc.variables["WEBP_BUILD_EXTRAS"] = False + tc.variables["WEBP_BUILD_WEBPINFO"] = False + if Version(self.version) >= "1.2.1": + tc.variables["WEBP_BUILD_LIBWEBPMUX"] = True + tc.variables["WEBP_BUILD_WEBPMUX"] = False + if self.options.shared and is_msvc(self): + # Building a dll (see fix-dll-export patch) + tc.preprocessor_definitions["WEBP_DLL"] = 1 + tc.generate() + + def build(self): + apply_conandata_patches(self) + 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")) + 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", "WebP") + self.cpp_info.set_property("pkg_config_name", "libwebp-all-do-not-use") + + # webpdecoder + self.cpp_info.components["webpdecoder"].set_property("cmake_target_name", "WebP::webpdecoder") + self.cpp_info.components["webpdecoder"].set_property("pkg_config_name", "libwebpdecoder") + self.cpp_info.components["webpdecoder"].libs = ["webpdecoder"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["webpdecoder"].system_libs = ["m", "pthread"] + + # webp + self.cpp_info.components["webp"].set_property("cmake_target_name", "WebP::webp") + self.cpp_info.components["webp"].set_property("pkg_config_name", "libwebp") + self.cpp_info.components["webp"].libs = ["webp"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["webp"].system_libs = ["m", "pthread"] + + if Version(self.version) >= "1.3.0": + # sharpyuv + self.cpp_info.components["sharpyuv"].set_property("cmake_target_name", "WebP::sharpyuv") + self.cpp_info.components["sharpyuv"].set_property("pkg_config_name", "libsharpyuv") + self.cpp_info.components["sharpyuv"].libs = ["sharpyuv"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["sharpyuv"].system_libs = ["m", "pthread"] + # note: webp now depends on sharpyuv + self.cpp_info.components["webp"].requires = ["sharpyuv"] + + # webpdemux + self.cpp_info.components["webpdemux"].set_property("cmake_target_name", "WebP::webpdemux") + self.cpp_info.components["webpdemux"].set_property("pkg_config_name", "libwebpdemux") + self.cpp_info.components["webpdemux"].libs = ["webpdemux"] + self.cpp_info.components["webpdemux"].requires = ["webp"] + + # webpmux + self.cpp_info.components["webpmux"].set_property("cmake_target_name", "WebP::libwebpmux") + self.cpp_info.components["webpmux"].set_property("pkg_config_name", "libwebpmux") + self.cpp_info.components["webpmux"].libs = ["webpmux"] + self.cpp_info.components["webpmux"].requires = ["webp"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["webpmux"].system_libs = ["m"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "WebP" + self.cpp_info.names["cmake_find_package_multi"] = "WebP" + self.cpp_info.names["pkg_config"] = "libwebp-all-do-not-use" + self.cpp_info.components["webpmux"].names["cmake_find_package"] = "libwebpmux" + self.cpp_info.components["webpmux"].names["cmake_find_package_multi"] = "libwebpmux" diff --git a/recipes/libwebp/all/patches/1.1.0-0001-fix-dll-export.patch b/recipes/libwebp/all/patches/1.1.0-0001-fix-dll-export.patch new file mode 100644 index 0000000..ec00b8a --- /dev/null +++ b/recipes/libwebp/all/patches/1.1.0-0001-fix-dll-export.patch @@ -0,0 +1,15 @@ +diff --git a/src/webp/types.h b/src/webp/types.h +index 0ce2622..69f7e89 100644 +--- a/src/webp/types.h ++++ b/src/webp/types.h +@@ -39,7 +39,9 @@ typedef long long int int64_t; + #ifndef WEBP_EXTERN + // This explicitly marks library functions and allows for changing the + // signature for e.g., Windows DLL builds. +-# if defined(__GNUC__) && __GNUC__ >= 4 ++# if defined(_MSC_VER) && defined(WEBP_DLL) ++# define WEBP_EXTERN __declspec(dllexport) ++# elif defined(__GNUC__) && __GNUC__ >= 4 + # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) + # else + # define WEBP_EXTERN extern diff --git a/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch b/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch new file mode 100644 index 0000000..00f5a9a --- /dev/null +++ b/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch @@ -0,0 +1,14 @@ +diff --git a/cmake/deps.cmake b/cmake/deps.cmake +index f19c0378..7b2d7cd7 100644 +--- a/cmake/deps.cmake ++++ b/cmake/deps.cmake +@@ -24,7 +24,8 @@ check_c_source_compiles(" + # Check for libraries. + find_package(Threads) + if(Threads_FOUND) +- if(CMAKE_USE_PTHREADS_INIT) ++ # work around cmake bug on QNX (https://chromium-review.googlesource.com/c/webm/libwebp/+/2637274) ++ if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") + endif() + foreach(PTHREAD_TEST HAVE_PTHREAD_PRIO_INHERIT PTHREAD_CREATE_UNDETACHED) diff --git a/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch b/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch new file mode 100644 index 0000000..a6ef960 --- /dev/null +++ b/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -402,7 +402,7 @@ if(WEBP_BUILD_CWEBP) + install(TARGETS cwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() + +-if(WEBP_BUILD_GIF2WEBP OR WEBP_BUILD_IMG2WEBP) ++if(1) + parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "") + add_library(libwebpmux ${WEBP_MUX_SRCS}) + target_link_libraries(libwebpmux webp) diff --git a/recipes/libwebp/all/patches/1.3.1-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.3.1-0001-fix-cmake.patch new file mode 100644 index 0000000..72ee3a1 --- /dev/null +++ b/recipes/libwebp/all/patches/1.3.1-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad5e14c3..89c836f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,6 @@ if(WEBP_LINK_STATIC) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +@@ -153,7 +152,7 @@ endif() + set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(INSTALLED_LIBRARIES) + +-if(MSVC) ++if(0) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") diff --git a/recipes/libwebp/all/patches/1.4.0-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.4.0-0001-fix-cmake.patch new file mode 100644 index 0000000..f819b1e --- /dev/null +++ b/recipes/libwebp/all/patches/1.4.0-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad5e14c3..89c836f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -60,7 +60,6 @@ if(WEBP_LINK_STATIC) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +@@ -155,7 +154,7 @@ endif() + set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(INSTALLED_LIBRARIES) + +-if(MSVC) ++if(0) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") diff --git a/recipes/libwebp/all/test_package/CMakeLists.txt b/recipes/libwebp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..5c4f1c6 --- /dev/null +++ b/recipes/libwebp/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(WebP REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE WebP::webp) diff --git a/recipes/libwebp/all/test_package/conanfile.py b/recipes/libwebp/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/libwebp/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libwebp/all/test_package/test_package.c b/recipes/libwebp/all/test_package/test_package.c new file mode 100644 index 0000000..de9dbff --- /dev/null +++ b/recipes/libwebp/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include + +int main(void) +{ + int version = WebPGetDecoderVersion(); + printf("Webp Decoder version: %d\n", version); + + return 0; +} diff --git a/recipes/libwebp/config.yml b/recipes/libwebp/config.yml new file mode 100644 index 0000000..c2fa30e --- /dev/null +++ b/recipes/libwebp/config.yml @@ -0,0 +1,11 @@ +versions: + "1.4.0": + folder: all + "1.3.2": + folder: all + "1.3.1": + folder: all + "1.2.4": + folder: all + "1.1.0": + folder: all diff --git a/recipes/libx264/all/conandata.yml b/recipes/libx264/all/conandata.yml new file mode 100644 index 0000000..e42a00e --- /dev/null +++ b/recipes/libx264/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20240224": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-code_videolan_org/videolan/x264/-/archive/7241d020118bb09cc0ad119d7bc9f630a1caad10/x264-7241d020118bb09cc0ad119d7bc9f630a1caad10.tar.bz2" + sha256: "5417c167a69cc19db044c227163f9b9b1dface9fca361a3e83d5417f8e304dd6" + "cci.20220602": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-code_videolan_org/videolan/x264/-/archive/baee400fa9ced6f5481a728138fed6e867b0ff7f/x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.bz2" + sha256: "ce6623b8b289765daee04a297c2fd1a293cb2565a1749c76d66c8d72c7ddc1ab" diff --git a/recipes/libx264/all/conanfile.py b/recipes/libx264/all/conanfile.py new file mode 100644 index 0000000..6aed425 --- /dev/null +++ b/recipes/libx264/all/conanfile.py @@ -0,0 +1,187 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os, XCRun, fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy, rename, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +import os + +required_conan_version = ">=1.57.0" + + +class LibX264Conan(ConanFile): + name = "libx264" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.videolan.org/developers/x264.html" + description = "x264 is a free software library and application for encoding video streams into the " \ + "H.264/MPEG-4 AVC compression format" + topics = ("video", "encoding") + license = "GPL-2.0" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "bit_depth": [8, 10, "all"], + "with_opencl": [True, False], + "with_asm": [True, False] + } + # The project by default enables opencl and asm, it can be opted-out + default_options = { + "shared": False, + "fPIC": True, + "bit_depth": "all", + "with_opencl": True, + "with_asm": True + } + + 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") + + @property + def _with_nasm(self): + return self.settings.arch in ("x86", "x86_64") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + if self._with_nasm: + self.tool_requires("nasm/[>=2.15.05]") + 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): + tc = AutotoolsToolchain(self) + + extra_asflags = [] + extra_cflags = [] + extra_ldflags = [] + args = { + "--bit-depth": self.options.bit_depth, + "--disable-cli": "", + "--sbindir": None, # Not understood by configure + "--oldincludedir": None # Not understood by configure + } + args["--disable-shared"] = None # --disable-shared is not understood + if self.options.shared: + args["--enable-shared"] = "" + else: + args["--enable-static"] = "" + if not self.options.with_opencl: + args["--disable-opencl"] = "" + if not self.options.with_asm: + args["--disable-asm"] = "" + if self.options.get_safe("fPIC", self.settings.os != "Windows"): + args["--enable-pic"] = "" + if self.settings.build_type == "Debug": + args["--enable-debug"] = "" + + if is_apple_os(self) and self.settings.arch == "armv8": + # bitstream-a.S:29:18: error: unknown token in expression + extra_asflags.append("-arch arm64") + extra_ldflags.append("-arch arm64") + args["--host"] = "aarch64-apple-darwin" + if self.settings.os != "Macos": # TODO not sure why this is != "Macos" ... shouldn't it be == ?? + xcrun = XCRun(self) + platform_flags = ["-isysroot", xcrun.sdk_path] + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + platform_flags.append(apple_min_version_flag) + extra_asflags.extend(platform_flags) + extra_cflags.extend(platform_flags) + extra_ldflags.extend(platform_flags) + + if self._with_nasm: + env = Environment() + env.define("AS", unix_path(self, os.path.join(self.dependencies.build["nasm"].package_folder, "bin", "nasm{}".format(".exe" if self.settings.os == "Windows" else "")))) + env.vars(self).save_script("conanbuild_nasm") + + if cross_building(self): + if self.settings.os == "Android": + buildenv_vars = VirtualBuildEnv(self).vars() + ndk_root = self.conf.get("tools.android:ndk_path", buildenv_vars.get("NDK_ROOT")) + + # INFO: Conan package android-ndk does not expose toolchain path. Looks fragile but follows always same for Android NDK + build_os = {"Linux": "linux", "Macos": "darwin", "Windows": "windows"}.get(str(self.settings_build.os)) + toolchain = os.path.join(ndk_root, "toolchains", "llvm", "prebuilt", f"{build_os}-{self.settings_build.arch}") + + sysroot = self.conf.get("tools.build:sysroot", buildenv_vars.get("SYSROOT", f"{toolchain}/sysroot")) + # INFO: x264 will look for strings appended to the cross prefix + cross_prefix = os.path.join(toolchain, "bin", "llvm-") + + compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + + args["--build"] = None # --build is not recognized + args["--cross-prefix"] = cross_prefix + args["--sysroot"] = sysroot + + # the as of ndk does not work well for building libx264 + env = Environment() + cc_as = compilers_from_conf.get("c", buildenv_vars.get("AS", "clang")) + env.define("AS", cc_as) + env_vars = env.vars(self, scope="build") + env_vars.save_script("conanbuild_android") + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.vars(self).save_script("conanbuild_msvc") + + if is_msvc(self) or self.settings.os in ["iOS", "watchOS", "tvOS"]: + # autotools does not know about the msvc and Apple embedded OS canonical name(s) + args["--build"] = None + args["--host"] = None + + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + extra_cflags += ["-fno-finite-math-only"] + + if extra_asflags: + args["--extra-asflags"] = " ".join(extra_asflags) + if extra_cflags: + args["--extra-cflags"] = " ".join(extra_cflags) + if extra_ldflags: + args["--extra-ldflags"] = " ".join(extra_ldflags) + tc.update_configure_args(args) + tc.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, pattern="COPYING", 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")) + if is_msvc(self): + ext = ".dll.lib" if self.options.shared else ".lib" + rename(self, os.path.join(self.package_folder, "lib", f"libx264{ext}"), + os.path.join(self.package_folder, "lib", "x264.lib")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "x264") + self.cpp_info.libs = ["x264"] + if is_msvc(self) and self.options.shared: + self.cpp_info.defines.append("X264_API_IMPORTS") + if self.settings.os in ["FreeBSD", "Linux"]: + self.cpp_info.system_libs.extend(["dl", "pthread", "m"]) + elif self.settings.os == "Android": + self.cpp_info.system_libs.extend(["dl", "m"]) diff --git a/recipes/libx264/all/test_package/CMakeLists.txt b/recipes/libx264/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..9ef0da2 --- /dev/null +++ b/recipes/libx264/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libx264 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libx264::libx264) diff --git a/recipes/libx264/all/test_package/conanfile.py b/recipes/libx264/all/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/libx264/all/test_package/conanfile.py @@ -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") diff --git a/recipes/libx264/all/test_package/test_package.c b/recipes/libx264/all/test_package/test_package.c new file mode 100644 index 0000000..c4d50fb --- /dev/null +++ b/recipes/libx264/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include +#include "x264.h" + +#include + +int main() +{ + x264_param_t preset; + x264_t *encoder; + x264_param_default_preset(&preset, "ultrafast", "zerolatency"); + preset.i_width = 640; + preset.i_height = 480; + encoder = x264_encoder_open(&preset); + x264_encoder_close(encoder); + return EXIT_SUCCESS; +} diff --git a/recipes/libx264/config.yml b/recipes/libx264/config.yml new file mode 100644 index 0000000..cce887c --- /dev/null +++ b/recipes/libx264/config.yml @@ -0,0 +1,9 @@ +versions: + "cci.20240224": + folder: all + "cci.20220602": + folder: all + "20191217": + folder: all + "20190605": + folder: all diff --git a/recipes/libx265/all/conandata.yml b/recipes/libx265/all/conandata.yml new file mode 100644 index 0000000..dac05ca --- /dev/null +++ b/recipes/libx265/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "3.4": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/videolan/x265/archive/refs/tags/3.4.tar.gz" + sha256: "544d147bf146f8994a7bf8521ed878c93067ea1c7c6e93ab602389be3117eaaf" +patches: + "3.4": + - patch_file: "patches/3.2.1-0001-remove_register_classifier.patch" + - patch_file: "patches/3.2.1-0002-cmake-min-required.patch" + - patch_file: "patches/3.4-0001-numa.patch" diff --git a/recipes/libx265/all/conanfile.py b/recipes/libx265/all/conanfile.py new file mode 100644 index 0000000..47a2520 --- /dev/null +++ b/recipes/libx265/all/conanfile.py @@ -0,0 +1,181 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building, stdcpp_library +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rename, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + +required_conan_version = ">=1.53.0" + + +class Libx265Conan(ConanFile): + name = "libx265" + description = "x265 is the leading H.265 / HEVC encoder software library" + topics = ("x265", "codec", "video", "H.265") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.videolan.org/developers/x265.html" + license = ("GPL-2.0-only", "commercial") # https://bitbucket.org/multicoreware/x265/src/default/COPYING + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "assembly": [True, False], + "bit_depth": [8, 10, 12], + "HDR10": [True, False], + "SVG_HEVC_encoder": [True, False], + "with_numa": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "assembly": True, + "bit_depth": 8, + "HDR10": False, + "SVG_HEVC_encoder": False, + "with_numa": False, + } + + 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 != "Linux": + del self.options.with_numa + # FIXME: Disable assembly by default if host is arm and compiler apple-clang for the moment. + # Indeed, apple-clang is not able to understand some asm instructions of libx265 + # FIXME: Disable assembly by default if host is Android for the moment. It fails to build + if (self.settings.compiler == "apple-clang" and "arm" in self.settings.arch) or self.settings.os == "Android": + self.options.assembly = False + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.get_safe("with_numa", False): + self.requires("libnuma/2.0.14") + + def validate_build(self): + if cross_building(self) and self.settings.os == "Android" and self.options.assembly: + # FIXME: x265 uses custom command to invoke clang to compile assembly files. + # clang++ -fPIC -c src/source/common/aarch64/mc-a.S -o mc-a.S.o + # FAILED: mc-a.S.o libx2f309356bd8526/b/build/Release/mc-a.S.o + # clang++ -fPIC -c src/source/common/aarch64/mc-a.S -o mc-a.S.o + # :11:9: error: unknown directive + # .func x265_pixel_avg_pp_4x4_neon + raise ConanInvalidConfiguration(f"{self.ref} fails to build with '&:assembly=True' for Android. Contributions are welcome.") + + def validate(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("shared not supported with static runtime") + + if self.settings.compiler == "apple-clang" and "arm" in self.settings.arch and self.options.assembly: + # Undefined symbols for architecture arm64: + # "x265::setupAssemblyPrimitives(x265::EncoderPrimitives&, int)", referenced from: + # x265::x265_setup_primitives(x265_param*) in libx265.a[20](primitives.cpp.o) + # ld: symbol(s) not found for architecture arm64 + raise ConanInvalidConfiguration(f"{self.ref} fails to build for Mac M1. Contributions are welcome.") + + def build_requirements(self): + if self.options.assembly: + if self.settings.arch in ["x86", "x86_64"]: + self.tool_requires("nasm/[>=2.15.05]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_ASSEMBLY"] = self.options.assembly + tc.variables["ENABLE_LIBNUMA"] = self.options.get_safe("with_numa", False) + if self.settings.os == "Macos": + tc.variables["CMAKE_SHARED_LINKER_FLAGS"] = "-Wl,-read_only_relocs,suppress" + tc.variables["HIGH_BIT_DEPTH"] = self.options.bit_depth != 8 + tc.variables["MAIN12"] = self.options.bit_depth == 12 + tc.variables["ENABLE_HDR10_PLUS"] = self.options.HDR10 + tc.variables["ENABLE_SVT_HEVC"] = self.options.SVG_HEVC_encoder + if is_msvc(self): + tc.variables["STATIC_LINK_CRT"] = is_msvc_static_runtime(self) + if self.settings.os == "Linux": + tc.variables["PLATFORM_LIBS"] = "dl" + if "arm" in self.settings.arch: + tc.variables["CROSS_COMPILE_ARM"] = cross_building(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "source", "CMakeLists.txt") + replace_in_file(self, cmakelists, + "if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))", + "if(FALSE)") + if self.settings.os == "Android": + replace_in_file(self, cmakelists, "list(APPEND PLATFORM_LIBS pthread)", "") + replace_in_file(self, cmakelists, "list(APPEND PLATFORM_LIBS rt)", "") + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, cmakelists, + "add_definitions(-ffast-math)", + "add_definitions(-ffast-math -fno-finite-math-only)") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "source")) + 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() + + if self.options.shared: + if is_msvc(self): + static_lib = "x265-static.lib" + else: + static_lib = "libx265.a" + os.unlink(os.path.join(self.package_folder, "lib", static_lib)) + + if is_msvc(self): + name = "libx265.lib" if self.options.shared else "x265-static.lib" + rename(self, os.path.join(self.package_folder, "lib", name), + os.path.join(self.package_folder, "lib", "x265.lib")) + + if self.settings.os == "Windows" and self.options.shared: + rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) + else: + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "x265") + self.cpp_info.libs = ["x265"] + if self.settings.os == "Windows": + if self.options.shared: + self.cpp_info.defines.append("X265_API_IMPORTS") + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "pthread", "m", "rt"]) + if not self.options.shared: + self.cpp_info.sharedlinkflags = ["-Wl,-Bsymbolic,-znoexecstack"] + elif self.settings.os == "Android": + self.cpp_info.system_libs.extend(["dl", "m"]) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + if self.settings.os == "Android" and self.settings.compiler.libcxx == "c++_static": + self.cpp_info.system_libs.append("c++abi") + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/libx265/all/patches/3.2.1-0001-remove_register_classifier.patch b/recipes/libx265/all/patches/3.2.1-0001-remove_register_classifier.patch new file mode 100644 index 0000000..6ad2d2e --- /dev/null +++ b/recipes/libx265/all/patches/3.2.1-0001-remove_register_classifier.patch @@ -0,0 +1,13 @@ +diff --git a/source/common/md5.cpp b/source/common/md5.cpp +index 285b44a..c4964e7 100644 +--- a/source/common/md5.cpp ++++ b/source/common/md5.cpp +@@ -185,7 +185,7 @@ void MD5Final(MD5Context *ctx, uint8_t *digest) + */ + void MD5Transform(uint32_t *buf, uint32_t *in) + { +- register uint32_t a, b, c, d; ++ uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; diff --git a/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch b/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch new file mode 100644 index 0000000..93f9560 --- /dev/null +++ b/recipes/libx265/all/patches/3.2.1-0002-cmake-min-required.patch @@ -0,0 +1,22 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -1,10 +1,4 @@ +-# vim: syntax=cmake +-if(NOT CMAKE_BUILD_TYPE) +- # default to Release build for GCC builds +- set(CMAKE_BUILD_TYPE Release CACHE STRING +- "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." +- FORCE) +-endif() ++cmake_minimum_required(VERSION 3.1) + message(STATUS "cmake version ${CMAKE_VERSION}") + if(POLICY CMP0025) + cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang +@@ -17,7 +11,6 @@ if(POLICY CMP0054) + endif() + + project (x265) +-cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8 + include(CheckIncludeFiles) + include(CheckFunctionExists) + include(CheckSymbolExists) diff --git a/recipes/libx265/all/patches/3.4-0001-numa.patch b/recipes/libx265/all/patches/3.4-0001-numa.patch new file mode 100644 index 0000000..789c574 --- /dev/null +++ b/recipes/libx265/all/patches/3.4-0001-numa.patch @@ -0,0 +1,27 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -90,20 +90,10 @@ if(UNIX) + endif() + option(ENABLE_LIBNUMA "Enable libnuma usage (Linux only)" ON) + if(ENABLE_LIBNUMA) +- find_package(Numa) +- if(NUMA_FOUND) +- link_directories(${NUMA_LIBRARY_DIR}) +- list(APPEND CMAKE_REQUIRED_LIBRARIES numa) +- list(APPEND CMAKE_REQUIRED_INCLUDES ${NUMA_INCLUDE_DIR}) +- list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-L${NUMA_LIBRARY_DIR}") +- check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2) +- if(NUMA_V2) +- add_definitions(-DHAVE_LIBNUMA) +- message(STATUS "libnuma found, building with support for NUMA nodes") +- list(APPEND PLATFORM_LIBS numa) +- include_directories(${NUMA_INCLUDE_DIR}) +- endif() +- endif() ++ find_package(libnuma REQUIRED) ++ list(APPEND PLATFORM_LIBS ${libnuma_LIBRARIES}) ++ include_directories(${libnuma_INCLUDE_DIR}) ++ add_definitions(-DHAVE_LIBNUMA) + mark_as_advanced(NUMA_FOUND) + endif(ENABLE_LIBNUMA) + option(NO_ATOMICS "Use a slow mutex to replace atomics" OFF) diff --git a/recipes/libx265/all/test_package/CMakeLists.txt b/recipes/libx265/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..b8fa451 --- /dev/null +++ b/recipes/libx265/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libx265 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libx265::libx265) diff --git a/recipes/libx265/all/test_package/conanfile.py b/recipes/libx265/all/test_package/conanfile.py new file mode 100644 index 0000000..539e617 --- /dev/null +++ b/recipes/libx265/all/test_package/conanfile.py @@ -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, run=True) + + 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") diff --git a/recipes/libx265/all/test_package/test_package.c b/recipes/libx265/all/test_package/test_package.c new file mode 100644 index 0000000..8b1893c --- /dev/null +++ b/recipes/libx265/all/test_package/test_package.c @@ -0,0 +1,32 @@ +#include "x265.h" + +#include + +#ifdef WITH_LIB +# ifdef _WIN32 +# define TEST_IMPORT __declspec(dllimport) +# else +# define TEST_IMPORT +# endif + +TEST_IMPORT const char *test_library_version(void); +TEST_IMPORT void test_library_something(void); +#endif + +int main() +{ + x265_param * param = x265_param_alloc(); + x265_param_default(param); + param->sourceWidth = 640; + param->sourceHeight = 480; + param->fpsNum = 25; + param->fpsDenom = 1; + x265_encoder * encoder = x265_encoder_open(param); + x265_encoder_close(encoder); + x265_param_free(param); +#ifdef WITH_LIB + test_library_version(); + test_library_something(); +#endif + return EXIT_SUCCESS; +} diff --git a/recipes/libx265/config.yml b/recipes/libx265/config.yml new file mode 100644 index 0000000..76ea1c6 --- /dev/null +++ b/recipes/libx265/config.yml @@ -0,0 +1,5 @@ +versions: + "3.4": + folder: "all" + "3.2.1": + folder: "all" diff --git a/recipes/mpg123/all/conandata.yml b/recipes/mpg123/all/conandata.yml new file mode 100644 index 0000000..43921f8 --- /dev/null +++ b/recipes/mpg123/all/conandata.yml @@ -0,0 +1,25 @@ +sources: + "1.31.2": + url: + - "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/mpg123/files/mpg123/1.31.2/mpg123-1.31.2.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.31.2.tar.bz2" + sha256: "b17f22905e31f43b6b401dfdf6a71ed11bb7d056f68db449d70b9f9ae839c7de" + "1.29.3": + url: + - "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/mpg123/files/mpg123/1.29.3/mpg123-1.29.3.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.29.3.tar.bz2" + sha256: "963885d8cc77262f28b77187c7d189e32195e64244de2530b798ddf32183e847" + "1.26.4": + url: + - "https://nexus.avroid.tech/repository/all-raw-proxy-sourceforge_net/projects/mpg123/files/mpg123/1.26.4/mpg123-1.26.4.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.26.4.tar.bz2" + sha256: "081991540df7a666b29049ad870f293cfa28863b36488ab4d58ceaa7b5846454" + +patches: + "1.31.2": + - patch_file: "patches/0001-msvc-export-symbols.patch" + "1.26.4": + - patch_file: "patches/0001-msvc-export-symbols.patch" + "1.29.3": + - patch_file: "patches/0001-msvc-export-symbols.patch" + - patch_file: "patches/0002-cmake-read_api_version-fix.patch" diff --git a/recipes/mpg123/all/conanfile.py b/recipes/mpg123/all/conanfile.py new file mode 100644 index 0000000..a71822c --- /dev/null +++ b/recipes/mpg123/all/conanfile.py @@ -0,0 +1,239 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches, rmdir, rm +from conan.tools.microsoft import is_msvc +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.build import cross_building +import os + +required_conan_version = ">=1.53.0" + + +class Mpg123Conan(ConanFile): + name = "mpg123" + description = "Fast console MPEG Audio Player and decoder library" + topics = ("mpeg", "audio", "player", "decoder") + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://mpg123.org/" + license = "LGPL-2.1-or-later", "GPL-2.0-or-later" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "flexible_resampling": [True, False], + "network": [True, False], + "icy": [True, False], + "id3v2": [True, False], + "ieeefloat": [True, False], + "layer1": [True, False], + "layer2": [True, False], + "layer3": [True, False], + "moreinfo": [True, False], + "seektable": [None, "ANY"], + "module": ["dummy", "libalsa", "tinyalsa", "win32"], + } + default_options = { + "shared": False, + "fPIC": True, + "flexible_resampling": True, + "network": True, + "icy": True, + "id3v2": True, + "ieeefloat": True, + "layer1": True, + "layer2": True, + "layer3": True, + "moreinfo": True, + "seektable": "1000", + "module": "dummy", + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _audio_module(self): + return { + "libalsa": "alsa", + }.get(str(self.options.module), str(self.options.module)) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.module == "libalsa": + self.requires("libalsa/1.2.10") + if self.options.module == "tinyalsa": + self.requires("tinyalsa/2.0.0") + + def validate(self): + if not str(self.options.seektable).isdigit(): + raise ConanInvalidConfiguration(f"The option -o {self.ref.name}:seektable must be an integer number.") + if self.settings.os != "Windows" and self.options.module == "win32": + raise ConanInvalidConfiguration(f"The option -o {self.ref.name}:module should not use 'win32' for non-Windows OS") + + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.0.3]") + if self.settings.arch in ["x86", "x86_64"]: + #self.tool_requires("yasm/1.3.0") + self.tool_requires("nasm/[>=2.15.05]") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, 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): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + if is_msvc(self): + tc = CMakeToolchain(self) + tc.variables["NO_MOREINFO"] = not self.options.moreinfo + tc.variables["NETWORK"] = self.options.network + tc.variables["NO_NTOM"] = not self.options.flexible_resampling + tc.variables["NO_ICY"] = not self.options.icy + tc.variables["NO_ID3V2"] = not self.options.id3v2 + tc.variables["IEEE_FLOAT"] = self.options.ieeefloat + tc.variables["NO_LAYER1"] = not self.options.layer1 + tc.variables["NO_LAYER2"] = not self.options.layer2 + tc.variables["NO_LAYER3"] = not self.options.layer3 + tc.variables["USE_MODULES"] = False + tc.variables["CHECK_MODULES"] = self._audio_module + tc.variables["WITH_SEEKTABLE"] = self.options.seektable + tc.generate() + tc = CMakeDeps(self) + tc.generate() + else: + yes_no = lambda v: "yes" if v else "no" + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--enable-moreinfo={yes_no(self.options.moreinfo)}", + f"--enable-network={yes_no(self.options.network)}", + f"--enable-ntom={yes_no(self.options.flexible_resampling)}", + f"--enable-icy={yes_no(self.options.icy)}", + f"--enable-id3v2={yes_no(self.options.id3v2)}", + f"--enable-ieeefloat={yes_no(self.options.ieeefloat)}", + f"--enable-layer1={yes_no(self.options.layer1)}", + f"--enable-layer2={yes_no(self.options.layer2)}", + f"--enable-layer3={yes_no(self.options.layer3)}", + f"--with-audio={self._audio_module}", + f"--with-default-audio={self._audio_module}", + f"--with-seektable={self.options.seektable}", + f"--enable-modules=no", + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + ]) + if is_apple_os(self): + # Needed for fix_apple_shared_install_name invocation in package method + tc.extra_cflags += ["-headerpad_max_install_names"] + # The finite-math-only optimization has no effect and will cause linking errors + # when linked against glibc >= 2.31 + tc.extra_cflags += ["-fno-finite-math-only"] + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "ports", "cmake")) + cmake.build() + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + else: + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "mpg123") + + self.cpp_info.components["libmpg123"].libs = ["mpg123"] + self.cpp_info.components["libmpg123"].set_property("pkg_config_name", "libmpg123") + self.cpp_info.components["libmpg123"].set_property("cmake_target_name", "MPG123::libmpg123") + self.cpp_info.components["libmpg123"].names["cmake_find_package"] = "libmpg123" + self.cpp_info.components["libmpg123"].names["cmake_find_package_multi"] = "libmpg123" + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["libmpg123"].defines.append("LINK_MPG123_DLL") + + self.cpp_info.components["libout123"].libs = ["out123"] + self.cpp_info.components["libout123"].set_property("pkg_config_name", "libout123") + self.cpp_info.components["libout123"].set_property("cmake_target_name", "MPG123::libout123") + self.cpp_info.components["libout123"].names["cmake_find_package"] = "libout123" + self.cpp_info.components["libout123"].names["cmake_find_package_multi"] = "libout123" + self.cpp_info.components["libout123"].requires = ["libmpg123"] + + self.cpp_info.components["libsyn123"].libs = ["syn123"] + self.cpp_info.components["libsyn123"].set_property("pkg_config_name", "libsyn123") + self.cpp_info.components["libsyn123"].set_property("cmake_target_name", "MPG123::libsyn123") + self.cpp_info.components["libsyn123"].names["cmake_find_package"] = "libsyn123" + self.cpp_info.components["libsyn123"].names["cmake_find_package_multi"] = "libsyn123" + self.cpp_info.components["libsyn123"].requires = ["libmpg123"] + + if self.settings.os == "Linux": + self.cpp_info.components["libmpg123"].system_libs = ["m"] + if self.settings.arch in ["x86", "x86_64"]: + self.cpp_info.components["libsyn123"].system_libs = ["mvec"] + elif self.settings.os == "Windows": + self.cpp_info.components["libmpg123"].system_libs = ["shlwapi"] + + if self.options.module == "libalsa": + self.cpp_info.components["libout123"].requires.append("libalsa::libalsa") + if self.options.module == "tinyalsa": + self.cpp_info.components["libout123"].requires.append("tinyalsa::tinyalsa") + if self.options.module == "win32": + self.cpp_info.components["libout123"].system_libs.append("winmm") + + + # TODO: Remove after Conan 2.x becomes the standard + self.cpp_info.filenames["cmake_find_package"] = "mpg123" + self.cpp_info.filenames["cmake_find_package_multi"] = "mpg123" + self.cpp_info.names["cmake_find_package"] = "MPG123" + self.cpp_info.names["cmake_find_package_multi"] = "MPG123" + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) diff --git a/recipes/mpg123/all/patches/0001-msvc-export-symbols.patch b/recipes/mpg123/all/patches/0001-msvc-export-symbols.patch new file mode 100644 index 0000000..75a32b2 --- /dev/null +++ b/recipes/mpg123/all/patches/0001-msvc-export-symbols.patch @@ -0,0 +1,22 @@ +--- a/ports/cmake/src/libout123/CMakeLists.txt ++++ b/ports/cmake/src/libout123/CMakeLists.txt +@@ -18,7 +18,7 @@ add_library(${TARGET} + $ + $<$:$>) + +-set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME out123) ++set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME out123 WINDOWS_EXPORT_ALL_SYMBOLS ON) + + target_link_libraries(${TARGET} PRIVATE + $ +--- a/ports/cmake/src/libsyn123/CMakeLists.txt ++++ b/ports/cmake/src/libsyn123/CMakeLists.txt +@@ -15,7 +15,7 @@ add_library(${TARGET} + "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libsyn123/sampleconv.c" + $) + +-set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME syn123) ++set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME syn123 WINDOWS_EXPORT_ALL_SYMBOLS ON) + + target_include_directories(${TARGET} INTERFACE + "$" diff --git a/recipes/mpg123/all/patches/0002-cmake-read_api_version-fix.patch b/recipes/mpg123/all/patches/0002-cmake-read_api_version-fix.patch new file mode 100644 index 0000000..934fa5a --- /dev/null +++ b/recipes/mpg123/all/patches/0002-cmake-read_api_version-fix.patch @@ -0,0 +1,10 @@ +--- a/ports/cmake/cmake/read_api_version.cmake ++++ b/ports/cmake/cmake/read_api_version.cmake +@@ -1,6 +1,6 @@ + function(read_api_version project_version api_version outapi_version synapi_version ) + +- file( READ "${CMAKE_SOURCE_DIR}/../../configure.ac" configure_ac ) ++ file( READ "${CMAKE_CURRENT_SOURCE_DIR}/../../configure.ac" configure_ac ) + + string( REGEX MATCH "AC_INIT\\(\\[mpg123\\], \\[([0-9\\.]+)" result ${configure_ac} ) + set( ${project_version} ${CMAKE_MATCH_1} PARENT_SCOPE ) diff --git a/recipes/mpg123/all/test_package/CMakeLists.txt b/recipes/mpg123/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..f76bb27 --- /dev/null +++ b/recipes/mpg123/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(mpg123 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE MPG123::libmpg123) diff --git a/recipes/mpg123/all/test_package/conanfile.py b/recipes/mpg123/all/test_package/conanfile.py new file mode 100644 index 0000000..a9fb966 --- /dev/null +++ b/recipes/mpg123/all/test_package/conanfile.py @@ -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 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") diff --git a/recipes/mpg123/all/test_package/test_package.c b/recipes/mpg123/all/test_package/test_package.c new file mode 100644 index 0000000..9db524c --- /dev/null +++ b/recipes/mpg123/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include "mpg123.h" +#include + +int main() { + int error; + mpg123_pars *pars; + + pars = mpg123_new_pars(&error); + mpg123_fmt_all(pars); + mpg123_delete_pars(pars); + return 0; +} diff --git a/recipes/mpg123/config.yml b/recipes/mpg123/config.yml new file mode 100644 index 0000000..72e2327 --- /dev/null +++ b/recipes/mpg123/config.yml @@ -0,0 +1,7 @@ +versions: + "1.31.2": + folder: "all" + "1.29.3": + folder: "all" + "1.26.4": + folder: "all" diff --git a/recipes/ogg/all/conandata.yml b/recipes/ogg/all/conandata.yml new file mode 100644 index 0000000..bd93563 --- /dev/null +++ b/recipes/ogg/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.3.5": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/ogg/archive/refs/tags/v1.3.5.tar.gz" + sha256: "f6f1b04cfa4e98b70ffe775d5e302d9c6b98541f05159af6de2d6617817ed7d6" + "1.3.4": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/ogg/archive/v1.3.4.tar.gz" + sha256: "3da31a4eb31534b6f878914b7379b873c280e610649fe5c07935b3d137a828bc" +patches: + "1.3.4": + - patch_file: "patches/001-fix-unsigned-typedefs-for-macos.patch" diff --git a/recipes/ogg/all/conanfile.py b/recipes/ogg/all/conanfile.py new file mode 100644 index 0000000..9d7da30 --- /dev/null +++ b/recipes/ogg/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class OggConan(ConanFile): + name = "ogg" + description = "The OGG library" + topics = ("codec", "audio", "lossless") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/xiph/ogg" + license = "BSD-2-Clause" + + settings = "os", "arch", "build_type", "compiler" + 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") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + 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_TESTING"] = False + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.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, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Ogg") + self.cpp_info.set_property("cmake_target_name", "Ogg::ogg") + self.cpp_info.set_property("pkg_config_name", "ogg") + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["ogglib"].libs = ["ogg"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "Ogg" + self.cpp_info.names["cmake_find_package_multi"] = "Ogg" + self.cpp_info.components["ogglib"].names["cmake_find_package"] = "ogg" + self.cpp_info.components["ogglib"].names["cmake_find_package_multi"] = "ogg" + self.cpp_info.components["ogglib"].set_property("cmake_target_name", "Ogg::ogg") + self.cpp_info.components["ogglib"].set_property("pkg_config_name", "ogg") diff --git a/recipes/ogg/all/patches/001-fix-unsigned-typedefs-for-macos.patch b/recipes/ogg/all/patches/001-fix-unsigned-typedefs-for-macos.patch new file mode 100644 index 0000000..d2ac27b --- /dev/null +++ b/recipes/ogg/all/patches/001-fix-unsigned-typedefs-for-macos.patch @@ -0,0 +1,19 @@ +diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h +index eb8a322..e655a1d 100644 +--- a/include/ogg/os_types.h ++++ b/include/ogg/os_types.h +@@ -72,11 +72,11 @@ + + # include + typedef int16_t ogg_int16_t; +- typedef uint16_t ogg_uint16_t; ++ typedef u_int16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; +- typedef uint32_t ogg_uint32_t; ++ typedef u_int32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; +- typedef uint64_t ogg_uint64_t; ++ typedef u_int64_t ogg_uint64_t; + + #elif defined(__HAIKU__) + diff --git a/recipes/ogg/all/test_package/CMakeLists.txt b/recipes/ogg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..3bc3fe8 --- /dev/null +++ b/recipes/ogg/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Ogg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Ogg::ogg) diff --git a/recipes/ogg/all/test_package/conanfile.py b/recipes/ogg/all/test_package/conanfile.py new file mode 100644 index 0000000..3a8c6c5 --- /dev/null +++ b/recipes/ogg/all/test_package/conanfile.py @@ -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") diff --git a/recipes/ogg/all/test_package/test_package.c b/recipes/ogg/all/test_package/test_package.c new file mode 100644 index 0000000..ff0196e --- /dev/null +++ b/recipes/ogg/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include "ogg/ogg.h" +#include +#include + +int main () { + ogg_sync_state og; + int result = ogg_sync_init(&og); + printf("OGG sync init result: %d\n\r", result); + return EXIT_SUCCESS; +} diff --git a/recipes/ogg/config.yml b/recipes/ogg/config.yml new file mode 100644 index 0000000..28671be --- /dev/null +++ b/recipes/ogg/config.yml @@ -0,0 +1,5 @@ +versions: + "1.3.5": + folder: all + "1.3.4": + folder: all diff --git a/recipes/openh264/all/conandata.yml b/recipes/openh264/all/conandata.yml new file mode 100644 index 0000000..4d283e3 --- /dev/null +++ b/recipes/openh264/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "2.5.0": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/cisco/openh264/archive/refs/tags/v2.5.0.tar.gz" + sha256: "94c8ca364db990047ec4ec3481b04ce0d791e62561ef5601443011bdc00825e3" + "2.4.1": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/cisco/openh264/archive/refs/tags/v2.4.1.tar.gz" + sha256: "8ffbe944e74043d0d3fb53d4a2a14c94de71f58dbea6a06d0dc92369542958ea" + "2.3.1": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/cisco/openh264/archive/refs/tags/v2.3.1.tar.gz" + sha256: "453afa66dacb560bc5fd0468aabee90c483741571bca820a39a1c07f0362dc32" + "2.1.1": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/cisco/openh264/archive/v2.1.1.tar.gz" + sha256: "af173e90fce65f80722fa894e1af0d6b07572292e76de7b65273df4c0a8be678" diff --git a/recipes/openh264/all/conanfile.py b/recipes/openh264/all/conanfile.py new file mode 100644 index 0000000..01f840f --- /dev/null +++ b/recipes/openh264/all/conanfile.py @@ -0,0 +1,126 @@ +from conan import ConanFile +from conan.tools.build import stdcpp_library, cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, rm, rename, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.scm import Version +from conan.tools.meson import Meson, MesonToolchain +from conan.errors import ConanInvalidConfiguration + +import os + + +required_conan_version = ">=2.0.9" + + +class OpenH264Conan(ConanFile): + name = "openh264" + description = "Open Source H.264 Codec" + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://www.openh264.org/" + topics = ("h264", "codec", "video", "compression", ) + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + @property + def _is_clang_cl(self): + return self.settings.os == 'Windows' and self.settings.compiler == 'clang' + + @property + def _preserve_dll_name(self): + return (is_msvc(self) or self._is_clang_cl) and Version(self.version) <= "2.4.1" and self.options.shared + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + #self.tool_requires("meson/1.4.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/[>=2.2 <3]") + if self.settings.arch in ["x86", "x86_64"]: + self.tool_requires("nasm/2.16.01") + + def validate(self): + if Version(self.version) <= "2.1.1" and self.settings.os in ["Android", "Macos"]: + # INFO: ../src/meson.build:86:2: ERROR: Problem encountered: FIXME: Unhandled system android + # INFO: ../src/meson.build:86:2: ERROR: Problem encountered: FIXME: Unhandled system darwin + raise ConanInvalidConfiguration(f"{self.ref} does not support {self.settings.os}. Try a newer version.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.project_options["tests"] = "disabled" + tc.generate() + + def _patch_sources(self): + if self._preserve_dll_name: + # INFO: When generating with Meson, the library name is openh264-7.dll. This change preserves the old name openh264.dll + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "soversion: major_version,", "soversion: '',") + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + # INFO: Version 2.1.1 installs both static and shared libraries using same target name + if Version(self.version) <= "2.1.1": + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "openh264.lib", os.path.join(self.package_folder, "lib")) + + if is_msvc(self) or self._is_clang_cl: + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if Version(self.version) <= "2.4.1": + if self.options.shared: + # INFO: Preserve same old library name as when building with Make on Windows but using Meson + rename(self, os.path.join(self.package_folder, "lib", "openh264.lib"), + os.path.join(self.package_folder, "lib", "openh264_dll.lib")) + if not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libopenh264.a"), + os.path.join(self.package_folder, "lib", "openh264.lib")) + fix_apple_shared_install_name(self) + + def package_info(self): + suffix = "_dll" if self._preserve_dll_name else "" + self.cpp_info.libs = [f"openh264{suffix}"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs.extend(["m", "pthread"]) + if self.settings.os == "Android": + self.cpp_info.system_libs.append("m") + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + if self.settings.os == "Android" and libcxx == "c++_static": + # INFO: When builing for Android, need to link against c++abi too. Otherwise will get linkage errors: + # ld.lld: error: undefined symbol: operator new(unsigned long) + # >>> referenced by welsEncoderExt.cpp + self.cpp_info.system_libs.append("c++abi") + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/openh264/all/test_package/CMakeLists.txt b/recipes/openh264/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..e48438b --- /dev/null +++ b/recipes/openh264/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(openh264 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} openh264::openh264) diff --git a/recipes/openh264/all/test_package/conanfile.py b/recipes/openh264/all/test_package/conanfile.py new file mode 100644 index 0000000..e845ae7 --- /dev/null +++ b/recipes/openh264/all/test_package/conanfile.py @@ -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") diff --git a/recipes/openh264/all/test_package/test_package.c b/recipes/openh264/all/test_package/test_package.c new file mode 100644 index 0000000..930d86e --- /dev/null +++ b/recipes/openh264/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + OpenH264Version version = WelsGetCodecVersion(); + printf("OpenH264 version: %d.%d.%d\n", version.uMajor, version.uMinor, version.uRevision); + return 0; +} diff --git a/recipes/openh264/config.yml b/recipes/openh264/config.yml new file mode 100644 index 0000000..9d2abec --- /dev/null +++ b/recipes/openh264/config.yml @@ -0,0 +1,9 @@ +versions: + "2.5.0": + folder: all + "2.4.1": + folder: all + "2.3.1": + folder: all + "2.1.1": + folder: all diff --git a/recipes/openjpeg/all/conandata.yml b/recipes/openjpeg/all/conandata.yml new file mode 100644 index 0000000..37db273 --- /dev/null +++ b/recipes/openjpeg/all/conandata.yml @@ -0,0 +1,21 @@ +sources: + "2.5.2": + url: "ssh://git@git.avroid.tech:2222/Mirrors/openjpeg" + branch: "v2.5.2" + "2.5.1": + url: "ssh://git@git.avroid.tech:2222/Mirrors/openjpeg" + branch: "v2.5.1" + "2.5.0": + url: "ssh://git@git.avroid.tech:2222/Mirrors/openjpeg" + branch: "v2.5.0" + "2.4.0": + url: "ssh://git@git.avroid.tech:2222/Mirrors/openjpeg" + branch: "v2.4.0" + "2.3.1": + url: "ssh://git@git.avroid.tech:2222/Mirrors/openjpeg" + branch: "v2.3.1" +patches: + "2.4.0": + - patch_file: "patches/0001-relocatable-shared-macos-2.4.0.patch" + "2.3.1": + - patch_file: "patches/0001-relocatable-shared-macos-2.3.1.patch" diff --git a/recipes/openjpeg/all/conanfile.py b/recipes/openjpeg/all/conanfile.py new file mode 100644 index 0000000..a9b76b4 --- /dev/null +++ b/recipes/openjpeg/all/conanfile.py @@ -0,0 +1,166 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save, replace_in_file +from conan.tools.scm import Version, Git +import os +import textwrap + +required_conan_version = ">=1.54.0" + + +class OpenjpegConan(ConanFile): + name = "openjpeg" + description = "OpenJPEG is an open-source JPEG 2000 codec written in C language." + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/uclouvain/openjpeg" + topics = ("jpeg2000", "jp2", "openjpeg", "image", "multimedia", "format", "graphics") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_codec": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_codec": False, + } + + 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): + cmake_layout(self, src_folder="src") + + def package_id(self): + del self.info.options.build_codec # not used for the moment + + def source(self): + #get(self, **self.conan_data["sources"][self.version], strip_root=True) + git = Git(self) + sources = self.conan_data["sources"][self.version] + clone_args = ['--depth', '1', '--branch', sources["branch"]] + git.clone(url=sources["url"], target=self.source_folder, args=clone_args) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + tc.variables["BUILD_DOC"] = False + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_LUTS_GENERATOR"] = False + tc.variables["BUILD_CODEC"] = False + if Version(self.version) < "2.5.0": + tc.variables["BUILD_MJ2"] = False + tc.variables["BUILD_JPWL"] = False + tc.variables["BUILD_JP3D"] = False + tc.variables["BUILD_JPIP"] = False + tc.variables["BUILD_VIEWER"] = False + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_PKGCONFIG_FILES"] = False + tc.variables["OPJ_DISABLE_TPSOT_FIX"] = False + tc.variables["OPJ_USE_THREAD"] = True + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # The finite-math-only optimization has no effect and can cause linking errors + # when linked against glibc >= 2.31 + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "-ffast-math", "-ffast-math;-fno-finite-math-only") + + 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", self._openjpeg_subdir)) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", self._openjpeg_subdir)) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_vars_rel_path) + ) + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_target_rel_path), + {"openjp2": "OpenJPEG::OpenJPEG"} + ) + + def _create_cmake_module_variables(self, module_file): + content = textwrap.dedent(f"""\ + set(OPENJPEG_FOUND TRUE) + if(DEFINED OpenJPEG_INCLUDE_DIRS) + set(OPENJPEG_INCLUDE_DIRS ${{OpenJPEG_INCLUDE_DIRS}}) + endif() + if(DEFINED OpenJPEG_LIBRARIES) + set(OPENJPEG_LIBRARIES ${{OpenJPEG_LIBRARIES}}) + endif() + set(OPENJPEG_MAJOR_VERSION "{Version(self.version).major}") + set(OPENJPEG_MINOR_VERSION "{Version(self.version).minor}") + set(OPENJPEG_BUILD_VERSION "{Version(self.version).patch}") + set(OPENJPEG_BUILD_SHARED_LIBS {"TRUE" if self.options.shared else "FALSE"}) + """) + save(self, module_file, content) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_vars_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + @property + def _module_target_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _openjpeg_subdir(self): + openjpeg_version = Version(self.version) + return f"openjpeg-{openjpeg_version.major}.{openjpeg_version.minor}" + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "OpenJPEG") + self.cpp_info.set_property("cmake_target_name", "openjp2") + self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) + self.cpp_info.set_property("pkg_config_name", "libopenjp2") + self.cpp_info.includedirs.append(os.path.join("include", self._openjpeg_subdir)) + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.libs = ["openjp2"] + if self.settings.os == "Windows" and not self.options.shared: + self.cpp_info.defines.append("OPJ_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] + elif self.settings.os == "Android": + self.cpp_info.system_libs = ["m"] + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.names["cmake_find_package"] = "OpenJPEG" + self.cpp_info.names["cmake_find_package_multi"] = "OpenJPEG" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_target_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_rel_path] + self.cpp_info.names["pkg_config"] = "libopenjp2" diff --git a/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.3.1.patch b/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.3.1.patch new file mode 100644 index 0000000..4ab5eac --- /dev/null +++ b/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.3.1.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -154,7 +154,7 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR) + set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}") + endif() + +-if (APPLE) ++if (0) + list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") + option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) + endif() diff --git a/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.4.0.patch b/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.4.0.patch new file mode 100644 index 0000000..78732d6 --- /dev/null +++ b/recipes/openjpeg/all/patches/0001-relocatable-shared-macos-2.4.0.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -155,7 +155,7 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR) + set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}") + endif() + +-if (APPLE) ++if (0) + list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") + option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) + endif() diff --git a/recipes/openjpeg/all/test_package/CMakeLists.txt b/recipes/openjpeg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..08c910c --- /dev/null +++ b/recipes/openjpeg/all/test_package/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(OpenJPEG REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE openjp2) + +# Test whether variables from https://github.com/uclouvain/openjpeg/blob/master/cmake/OpenJPEGConfig.cmake.in are properly defined +set(_custom_vars + OPENJPEG_FOUND + OPENJPEG_INCLUDE_DIRS + OPENJPEG_LIBRARIES + OPENJPEG_MAJOR_VERSION + OPENJPEG_MINOR_VERSION + OPENJPEG_BUILD_VERSION + OPENJPEG_BUILD_SHARED_LIBS +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED ${_custom_var}) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/openjpeg/all/test_package/conanfile.py b/recipes/openjpeg/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/openjpeg/all/test_package/conanfile.py @@ -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") diff --git a/recipes/openjpeg/all/test_package/test_package.c b/recipes/openjpeg/all/test_package/test_package.c new file mode 100644 index 0000000..0f7ac98 --- /dev/null +++ b/recipes/openjpeg/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include + +#include +#include + + +int main() { + printf("opj_has_thread_support: %d\n", opj_has_thread_support()); + printf("opj_get_num_cpus: %d\n", opj_get_num_cpus()); + + return EXIT_SUCCESS; +} diff --git a/recipes/openjpeg/config.yml b/recipes/openjpeg/config.yml new file mode 100644 index 0000000..b4e9262 --- /dev/null +++ b/recipes/openjpeg/config.yml @@ -0,0 +1,11 @@ +versions: + "2.5.2": + folder: all + "2.5.1": + folder: all + "2.5.0": + folder: all + "2.4.0": + folder: all + "2.3.1": + folder: all diff --git a/recipes/opus/all/conandata.yml b/recipes/opus/all/conandata.yml new file mode 100644 index 0000000..56fe8f9 --- /dev/null +++ b/recipes/opus/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.5.2": + url: "https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz" + sha256: "5cf92b5b577d8ed203424f1e0f618f30bc6b6e42a26eae88bdb649ea63961cc9" + "1.4": + url: "https://github.com/xiph/opus/releases/download/v1.4/opus-1.4.tar.gz" + sha256: "c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f" + "1.3.1": + url: "https://github.com/xiph/opus/releases/download/v1.3.1/opus-1.3.1.tar.gz" + sha256: "65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d" +patches: + "1.3.1": + - patch_file: "patches/1.3.1-add-opus_buildtype-cmake.patch" + patch_description: "Set a default build type if none was specified" + patch_type: "portability" diff --git a/recipes/opus/all/conanfile.py b/recipes/opus/all/conanfile.py new file mode 100644 index 0000000..70e3490 --- /dev/null +++ b/recipes/opus/all/conanfile.py @@ -0,0 +1,107 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class OpusConan(ConanFile): + name = "opus" + description = "Opus is a totally open, royalty-free, highly versatile audio codec." + topics = ("opus", "audio", "decoder", "decoding", "multimedia", "sound") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://opus-codec.org" + license = "BSD-3-Clause" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "fixed_point": [True, False], + "stack_protector": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "fixed_point": False, + "stack_protector": True, + } + +# def build_requirements(self): +# if Version(self.version) >= "1.5.2": +# self.tool_requires("cmake/[>=3.16 <4]") + + 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): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_vs(self, 190) + if Version(self.version) >= "1.5.2" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": + raise ConanInvalidConfiguration(f"{self.ref} GCC-{self.settings.compiler.version} not supported due to lack of AVX2 support. Use GCC >=8.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if Version(self.version) >= "1.5.2": + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.cache_variables["OPUS_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.cache_variables["OPUS_FIXED_POINT"] = self.options.fixed_point + tc.cache_variables["OPUS_STACK_PROTECTOR"] = self.options.stack_protector + if Version(self.version) >= "1.5.2" and is_msvc(self): + tc.cache_variables["OPUS_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.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", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Opus") + self.cpp_info.set_property("cmake_target_name", "Opus::opus") + self.cpp_info.set_property("pkg_config_name", "opus") + # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["libopus"].libs = ["opus"] + self.cpp_info.components["libopus"].includedirs.append(os.path.join("include", "opus")) + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.components["libopus"].system_libs.append("m") + if self.settings.os == "Windows" and self.settings.compiler == "gcc": + self.cpp_info.components["libopus"].system_libs.append("ssp") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "Opus" + self.cpp_info.names["cmake_find_package_multi"] = "Opus" + self.cpp_info.components["libopus"].names["cmake_find_package"] = "opus" + self.cpp_info.components["libopus"].names["cmake_find_package_multi"] = "opus" + self.cpp_info.components["libopus"].set_property("cmake_target_name", "Opus::opus") + self.cpp_info.components["libopus"].set_property("pkg_config_name", "opus") diff --git a/recipes/opus/all/patches/1.3.1-add-opus_buildtype-cmake.patch b/recipes/opus/all/patches/1.3.1-add-opus_buildtype-cmake.patch new file mode 100644 index 0000000..bb9723f --- /dev/null +++ b/recipes/opus/all/patches/1.3.1-add-opus_buildtype-cmake.patch @@ -0,0 +1,30 @@ +# They forgot to package that file into the tarball for 1.3.1 +# See https://github.com/xiph/opus/issues/129 + +new file mode 100755 +--- /dev/null ++++ opus_buildtype.cmake +@@ -0,0 +1,23 @@ ++# Set a default build type if none was specified ++ ++if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ++ if(CMAKE_C_FLAGS) ++ message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS}) ++ else() ++ set(default_build_type "Release") ++ message( ++ STATUS ++ "Setting build type to '${default_build_type}' as none was specified and no CFLAGS was exported." ++ ) ++ set(CMAKE_BUILD_TYPE "${default_build_type}" ++ CACHE STRING "Choose the type of build." ++ FORCE) ++ # Set the possible values of build type for cmake-gui ++ set_property(CACHE CMAKE_BUILD_TYPE ++ PROPERTY STRINGS ++ "Debug" ++ "Release" ++ "MinSizeRel" ++ "RelWithDebInfo") ++ endif() ++endif() diff --git a/recipes/opus/all/test_package/CMakeLists.txt b/recipes/opus/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..8688c33 --- /dev/null +++ b/recipes/opus/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Opus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Opus::opus) diff --git a/recipes/opus/all/test_package/conanfile.py b/recipes/opus/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/opus/all/test_package/conanfile.py @@ -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") diff --git a/recipes/opus/all/test_package/test_package.c b/recipes/opus/all/test_package/test_package.c new file mode 100644 index 0000000..3da6fd1 --- /dev/null +++ b/recipes/opus/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include +#include + +int main() { + int err; + int rate = 48000; + int channels = 2; + int application = OPUS_APPLICATION_AUDIO; + OpusEncoder *encoder; + + encoder = opus_encoder_create(rate, channels, application, &err); + opus_encoder_destroy(encoder); +} diff --git a/recipes/opus/config.yml b/recipes/opus/config.yml new file mode 100644 index 0000000..e9cd861 --- /dev/null +++ b/recipes/opus/config.yml @@ -0,0 +1,7 @@ +versions: + "1.5.2": + folder: all + "1.4": + folder: all + "1.3.1": + folder: all diff --git a/recipes/pulseaudio/all/conandata.yml b/recipes/pulseaudio/all/conandata.yml new file mode 100644 index 0000000..4cc8829 --- /dev/null +++ b/recipes/pulseaudio/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "14.2": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-freedesktop_org/software/pulseaudio/releases/pulseaudio-14.2.tar.xz" + sha256: "75d3f7742c1ae449049a4c88900e454b8b350ecaa8c544f3488a2562a9ff66f1" + "14.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-freedesktop_org/software/pulseaudio/releases/pulseaudio-14.0.tar.xz" + sha256: "a834775d9382b055504e5ee7625dc50768daac29329531deb6597bf05e06c261" + "13.0": + url: "https://nexus.avroid.tech/repository/all-raw-proxy-freedesktop_org/software/pulseaudio/releases/pulseaudio-13.0.tar.xz" + sha256: "961b23ca1acfd28f2bc87414c27bb40e12436efcf2158d29721b1e89f3f28057" diff --git a/recipes/pulseaudio/all/conanfile.py b/recipes/pulseaudio/all/conanfile.py new file mode 100644 index 0000000..256f743 --- /dev/null +++ b/recipes/pulseaudio/all/conanfile.py @@ -0,0 +1,172 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" + + +class PulseAudioConan(ConanFile): + name = "pulseaudio" + description = "PulseAudio is a sound system for POSIX OSes, meaning that it is a proxy for sound applications." + topics = ("sound",) + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://pulseaudio.org/" + license = "LGPL-2.1" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_alsa": [True, False], + "with_glib": [True, False], + "with_fftw": [True, False], + "with_x11": [True, False], + "with_openssl": [True, False], + "with_dbus": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_alsa": True, + "with_glib": False, + "with_fftw": False, + "with_x11": True, + "with_openssl": True, + "with_dbus": False, + } + + 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 not self.options.with_dbus: + del self.options.with_fftw + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libiconv/1.17") + self.requires("libsndfile/1.2.2") + self.requires("libcap/2.69") +# self.requires("libtool/2.4.7") + if self.options.with_alsa: + self.requires("libalsa/1.2.10") + if self.options.with_glib: + self.requires("glib/2.78.3") + if self.options.get_safe("with_fftw"): + self.requires("fftw/3.3.10") + if self.options.with_x11: + self.requires("xorg/system") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + if self.options.with_dbus: + self.requires("dbus/1.15.8") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("pulseaudio supports only linux currently") + + if self.options.get_safe("with_fftw"): + if not self.dependencies["fftw"].options.precision_single: + raise ConanInvalidConfiguration( + f"Pulse audio uses fftw single precision. " + "Either set option -o fftw/*:precision_single=True or -o pulseaudio/*:with_fftw=False" + ) + + def build_requirements(self): +# self.tool_requires("gettext/0.21") +# self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/[>=2.1.0]") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + f"--enable-glib2={yes_no(self.options.with_glib)}", + f"--with-fftw={yes_no(self.options.get_safe('with_fftw'))}", + "--with-udev-rules-dir=${prefix}/bin/udev/rules.d", + f"--with-systemduserunitdir={os.path.join(self.build_folder, 'ignore')}", + ]) + # Workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268250 + # clang-15 works, but we need to skip the gnu11 flag check + if self.settings.compiler == "clang" and self.settings.compiler.version == 15: + tc.configure_args.append("ax_cv_check_cflags__pedantic__Werror__std_gnu11=yes") + for lib in ["alsa", "x11", "openssl", "dbus"]: + tc.configure_args.append(f"--enable-{lib}={yes_no(getattr(self.options, f'with_{lib}'))}") + # TODO: to remove when automatically handled by AutotoolsToolchain + tc.configure_args.append("--libexecdir=${prefix}/bin") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def build(self): + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "LICENSE", 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, "etc")) + 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + + def package_info(self): + self.cpp_info.components["pulse"].set_property("pkg_config_name", "libpulse") + self.cpp_info.components["pulse"].libs = ["pulse", f"pulsecommon-{self.version}"] + self.cpp_info.components["pulse"].libdirs.append(os.path.join("lib", "pulseaudio")) + #self.cpp_info.components["pulse"].requires = ["libiconv::libiconv", "libsndfile::libsndfile", "libcap::libcap", "libtool::libtool"] + self.cpp_info.components["pulse"].requires = ["libiconv::libiconv", "libsndfile::libsndfile", "libcap::libcap"] + if self.options.with_alsa: + self.cpp_info.components["pulse"].requires.append("libalsa::libalsa") + if self.options.get_safe("with_fftw"): + self.cpp_info.components["pulse"].requires.append("fftw::fftw") + if self.options.with_x11: + self.cpp_info.components["pulse"].requires.extend(["xorg::x11", "xorg::x11-xcb"]) + if self.options.with_openssl: + self.cpp_info.components["pulse"].requires.append("openssl::openssl") + if self.options.with_dbus: + self.cpp_info.components["pulse"].requires.append("dbus::dbus") + + self.cpp_info.components["pulse-simple"].set_property("pkg_config_name", "libpulse-simple") + self.cpp_info.components["pulse-simple"].libs = ["pulse-simple"] + self.cpp_info.components["pulse-simple"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-simple"].requires = ["pulse"] + + if self.options.with_glib: + self.cpp_info.components["pulse-mainloop-glib"].set_property("pkg_config_name", "libpulse-mainloop-glib") + self.cpp_info.components["pulse-mainloop-glib"].libs = ["pulse-mainloop-glib"] + self.cpp_info.components["pulse-mainloop-glib"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-mainloop-glib"].requires = ["pulse", "glib::glib-2.0"] + + # FIXME: add cmake generators when conan can generate PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY vars diff --git a/recipes/pulseaudio/all/test_package/CMakeLists.txt b/recipes/pulseaudio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..a9b88d5 --- /dev/null +++ b/recipes/pulseaudio/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(pulseaudio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pulseaudio::pulseaudio) diff --git a/recipes/pulseaudio/all/test_package/conanfile.py b/recipes/pulseaudio/all/test_package/conanfile.py new file mode 100644 index 0000000..8a5bb47 --- /dev/null +++ b/recipes/pulseaudio/all/test_package/conanfile.py @@ -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 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") diff --git a/recipes/pulseaudio/all/test_package/test_package.c b/recipes/pulseaudio/all/test_package/test_package.c new file mode 100644 index 0000000..bb94413 --- /dev/null +++ b/recipes/pulseaudio/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("pulse audio verions %s\n", pa_get_library_version()); + return 0; +} diff --git a/recipes/pulseaudio/config.yml b/recipes/pulseaudio/config.yml new file mode 100644 index 0000000..6c0f518 --- /dev/null +++ b/recipes/pulseaudio/config.yml @@ -0,0 +1,9 @@ +versions: + "17.0": + folder: meson + "14.2": + folder: all + "14.0": + folder: all + "13.0": + folder: all diff --git a/recipes/pulseaudio/meson/conandata.yml b/recipes/pulseaudio/meson/conandata.yml new file mode 100644 index 0000000..3380326 --- /dev/null +++ b/recipes/pulseaudio/meson/conandata.yml @@ -0,0 +1,4 @@ +sources: + "17.0": + url: "https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-17.0.tar.xz" + sha256: "053794d6671a3e397d849e478a80b82a63cb9d8ca296bd35b73317bb5ceb87b5" diff --git a/recipes/pulseaudio/meson/conanfile.py b/recipes/pulseaudio/meson/conanfile.py new file mode 100644 index 0000000..4700804 --- /dev/null +++ b/recipes/pulseaudio/meson/conanfile.py @@ -0,0 +1,148 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.53.0" + + +class PulseAudioConan(ConanFile): + name = "pulseaudio" + description = "PulseAudio is a sound system for POSIX OSes, meaning that it is a proxy for sound applications." + topics = ("sound", "audio", "sound-server") + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://pulseaudio.org/" + license = "LGPL-2.1" + + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "with_glib": [True, False], + "with_fftw": [True, False], + "with_x11": [True, False], + "with_openssl": [True, False], + "with_dbus": [True, False], + } + default_options = { + "with_glib": False, + "with_fftw": False, + "with_x11": True, + "with_openssl": True, + "with_dbus": False, + } + + def config_options(self): + if self.settings.os not in ['Linux', 'FreeBSD']: + del self.options.with_x11 + + def configure(self): + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if not self.options.with_dbus: + del self.options.with_fftw + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libgettext/0.22") + self.requires("libiconv/1.17") + self.requires("libsndfile/1.2.2") + if self.options.with_glib: + self.requires("glib/2.78.1") + if self.options.get_safe("with_fftw"): + self.requires("fftw/3.3.10") + if self.options.get_safe("with_x11"): + self.requires("xorg/system") + if self.options.with_openssl: + self.requires("openssl/[>=1.1 <4]") + if self.options.with_dbus: + self.requires("dbus/1.15.8") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} recipe is only compatible with Linux right now. Contributions are welcome.") + + if self.options.get_safe("with_fftw"): + if not self.dependencies["fftw"].options.precision_single: + raise ConanInvalidConfiguration( + "Pulse audio uses fftw single precision. " + "Either set option -o fftw/*:precision_single=True or -o pulseaudio/*:with_fftw=False" + ) + + def build_requirements(self): + self.tool_requires("m4/1.4.19") + self.tool_requires("meson/1.3.2") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = MesonToolchain(self) + tc.project_options['udevrulesdir']="${prefix}/bin/udev/rules.d" + tc.project_options['systemduserunitdir'] = os.path.join(self.build_folder, 'ignore') + for lib in ["x11", "openssl", "dbus", "glib", "fftw"]: + tc.project_options[lib] = "enabled" if self.options.get_safe(f"with_{lib}") else "disabled" + tc.project_options['database'] = 'simple' + tc.project_options['tests'] = False + tc.project_options['man'] = False + tc.project_options['doxygen'] = False + tc.project_options["daemon"] = False + tc.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "LICENSE", 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, "etc")) + 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + + def package_info(self): + self.cpp_info.components["pulse"].set_property("pkg_config_name", "libpulse") + self.cpp_info.components["pulse"].libs = ["pulse", f"pulsecommon-{self.version}"] + self.cpp_info.components["pulse"].libdirs.append(os.path.join("lib", "pulseaudio")) + self.cpp_info.components["pulse"].requires = ["libiconv::libiconv", "libsndfile::libsndfile", "libgettext::libgettext"] + if self.options.get_safe("with_fftw"): + self.cpp_info.components["pulse"].requires.append("fftw::fftw") + if self.options.get_safe("with_x11"): + self.cpp_info.components["pulse"].requires.append("xorg::xorg") + if self.options.with_openssl: + self.cpp_info.components["pulse"].requires.append("openssl::openssl") + if self.options.with_dbus: + self.cpp_info.components["pulse"].requires.append("dbus::dbus") + + self.cpp_info.components["pulse-simple"].set_property("pkg_config_name", "libpulse-simple") + self.cpp_info.components["pulse-simple"].libs = ["pulse-simple"] + self.cpp_info.components["pulse-simple"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-simple"].requires = ["pulse"] + + if self.options.with_glib: + self.cpp_info.components["pulse-mainloop-glib"].set_property("pkg_config_name", "libpulse-mainloop-glib") + self.cpp_info.components["pulse-mainloop-glib"].libs = ["pulse-mainloop-glib"] + self.cpp_info.components["pulse-mainloop-glib"].defines.append("_REENTRANT") + self.cpp_info.components["pulse-mainloop-glib"].requires = ["pulse", "glib::glib-2.0"] + + # FIXME: add cmake generators when conan can generate PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY vars diff --git a/recipes/pulseaudio/meson/test_package/CMakeLists.txt b/recipes/pulseaudio/meson/test_package/CMakeLists.txt new file mode 100644 index 0000000..a9b88d5 --- /dev/null +++ b/recipes/pulseaudio/meson/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(pulseaudio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pulseaudio::pulseaudio) diff --git a/recipes/pulseaudio/meson/test_package/conanfile.py b/recipes/pulseaudio/meson/test_package/conanfile.py new file mode 100644 index 0000000..8a5bb47 --- /dev/null +++ b/recipes/pulseaudio/meson/test_package/conanfile.py @@ -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 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") diff --git a/recipes/pulseaudio/meson/test_package/test_package.c b/recipes/pulseaudio/meson/test_package/test_package.c new file mode 100644 index 0000000..bb94413 --- /dev/null +++ b/recipes/pulseaudio/meson/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("pulse audio verions %s\n", pa_get_library_version()); + return 0; +} diff --git a/recipes/vaapi/all/conanfile.py b/recipes/vaapi/all/conanfile.py new file mode 100644 index 0000000..4708e00 --- /dev/null +++ b/recipes/vaapi/all/conanfile.py @@ -0,0 +1,55 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager + +required_conan_version = ">=1.50.0" + + +class SysConfigVAAPIConan(ConanFile): + name = "vaapi" + version = "system" + description = "VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing." + topics = ("hwaccel", "video") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://01.org/linuxmedia/vaapi" + license = "MIT" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def system_requirements(self): + dnf = package_manager.Dnf(self) + dnf.install(["libva-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libva-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libva-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libva"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libva-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libva"], update=True, check=True) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + for name in ['libva', 'libva-x11', 'libva-drm']: + pkg_config = PkgConfig(self, name) + self.cpp_info.components[name].includedirs = [] + self.cpp_info.components[name].libdirs = [] + pkg_config.fill_cpp_info(self.cpp_info.components[name]) diff --git a/recipes/vaapi/all/test_package/CMakeLists.txt b/recipes/vaapi/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..1cc7d1f --- /dev/null +++ b/recipes/vaapi/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(xorg REQUIRED CONFIG) +find_package(vaapi REQUIRED CONFIG) + +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE vaapi::vaapi xorg::xorg) diff --git a/recipes/vaapi/all/test_package/conanfile.py b/recipes/vaapi/all/test_package/conanfile.py new file mode 100644 index 0000000..e81d718 --- /dev/null +++ b/recipes/vaapi/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + requires = ("xorg/system",) + + 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): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/vaapi/all/test_package/test_package.c b/recipes/vaapi/all/test_package/test_package.c new file mode 100644 index 0000000..57db8fa --- /dev/null +++ b/recipes/vaapi/all/test_package/test_package.c @@ -0,0 +1,38 @@ +#include +#include + +#include + +#include + +int main() +{ + VADisplay va_display; + VAStatus status; + int major, minor; + Display * display = XOpenDisplay(NULL); + if (!display) + { + printf("XOpenDisplay failed!\n"); + return 0; + } + va_display = vaGetDisplay(display); + if (!va_display) + { + XCloseDisplay(display); + printf("vaGetDisplay failed\n"); + return 0; + } + status = vaInitialize(va_display, &major, &minor); + if (status == VA_STATUS_SUCCESS) + printf("va version %d.%d\n", major, minor); + else + { + XCloseDisplay(display); + printf("vaInitialize failed\n"); + return 0; + } + vaTerminate(va_display); + XCloseDisplay(display); + return 0; +} diff --git a/recipes/vaapi/config.yml b/recipes/vaapi/config.yml new file mode 100644 index 0000000..0594dfd --- /dev/null +++ b/recipes/vaapi/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: all diff --git a/recipes/vdpau/all/conanfile.py b/recipes/vdpau/all/conanfile.py new file mode 100644 index 0000000..6c41a1e --- /dev/null +++ b/recipes/vdpau/all/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager + +required_conan_version = ">=1.50.0" + + +class SysConfigVDPAUConan(ConanFile): + name = "vdpau" + version = "system" + description = "VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs." + topics = ("hwaccel", "video") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/" + license = "MIT" + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def system_requirements(self): + dnf = package_manager.Dnf(self) + dnf.install(["libvdpau-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libvdpau-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libvdpau-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libvdpau"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libvdpau-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libvdpau"], update=True, check=True) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: + pkg_config = PkgConfig(self, "vdpau") + pkg_config.fill_cpp_info(self.cpp_info) diff --git a/recipes/vdpau/config.yml b/recipes/vdpau/config.yml new file mode 100644 index 0000000..0594dfd --- /dev/null +++ b/recipes/vdpau/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: all diff --git a/recipes/vorbis/all/conandata.yml b/recipes/vorbis/all/conandata.yml new file mode 100644 index 0000000..49d2520 --- /dev/null +++ b/recipes/vorbis/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "1.3.7": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/vorbis/archive/v1.3.7.tar.gz" + sha256: "270c76933d0934e42c5ee0a54a36280e2d87af1de3cc3e584806357e237afd13" + "1.3.6": + url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/vorbis/archive/v1.3.6.tar.gz" + sha256: "43fc4bc34f13da15b8acfa72fd594678e214d1cab35fc51d3a54969a725464eb" +patches: + "1.3.7": + - patch_file: "patches/1.3.7-0001-mingw-shared-def.patch" + patch_description: "MinGW: fix .def file for shared lib" + patch_type: "portability" + patch_source: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/xiph/vorbis/pull/76" + "1.3.6": + - patch_file: "patches/1.3.6-0001-link-libm-find-package-ogg.patch" + patch_description: "CMake: robust discovery and link of libm and Ogg" + patch_type: "conan" diff --git a/recipes/vorbis/all/conanfile.py b/recipes/vorbis/all/conanfile.py new file mode 100644 index 0000000..58d7504 --- /dev/null +++ b/recipes/vorbis/all/conanfile.py @@ -0,0 +1,114 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +import os + +required_conan_version = ">=1.54.0" + + +class VorbisConan(ConanFile): + name = "vorbis" + description = "The VORBIS audio codec library" + topics = ("audio", "codec") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://xiph.org/vorbis/" + license = "BSD-3-Clause" + package_type = "library" + settings = "os", "arch", "build_type", "compiler" + 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") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("ogg/1.3.5", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + cd = CMakeDeps(self) + cd.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, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Vorbis") + # see https://github.com/conan-io/conan-center-index/pull/4173 + self.cpp_info.set_property("pkg_config_name", "vorbis-all-do-not-use") + + # vorbis + self.cpp_info.components["vorbismain"].set_property("cmake_target_name", "Vorbis::vorbis") + self.cpp_info.components["vorbismain"].set_property("pkg_config_name", "vorbis") + self.cpp_info.components["vorbismain"].libs = ["vorbis"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["vorbismain"].system_libs.append("m") + self.cpp_info.components["vorbismain"].requires = ["ogg::ogg"] + + # TODO: Upstream VorbisConfig.cmake defines components 'Enc' and 'File', + # which are related to imported targets Vorbis::vorbisenc and Vorbis::vorbisfile + # Find a way to emulate this in CMakeDeps. See https://github.com/conan-io/conan/issues/10258 + + # vorbisenc + self.cpp_info.components["vorbisenc"].set_property("cmake_target_name", "Vorbis::vorbisenc") + self.cpp_info.components["vorbisenc"].set_property("pkg_config_name", "vorbisenc") + self.cpp_info.components["vorbisenc"].libs = ["vorbisenc"] + self.cpp_info.components["vorbisenc"].requires = ["vorbismain"] + + # vorbisfile + self.cpp_info.components["vorbisfile"].set_property("cmake_target_name", "Vorbis::vorbisfile") + self.cpp_info.components["vorbisfile"].set_property("pkg_config_name", "vorbisfile") + self.cpp_info.components["vorbisfile"].libs = ["vorbisfile"] + self.cpp_info.components["vorbisfile"].requires = ["vorbismain"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "Vorbis" + self.cpp_info.names["cmake_find_package_multi"] = "Vorbis" + self.cpp_info.names["pkg_config"] = "vorbis-all-do-not-use" + self.cpp_info.components["vorbismain"].names["cmake_find_package"] = "vorbis" + self.cpp_info.components["vorbismain"].names["cmake_find_package_multi"] = "vorbis" + self.cpp_info.components["vorbisenc"].names["cmake_find_package"] = "vorbisenc" + self.cpp_info.components["vorbisenc"].names["cmake_find_package_multi"] = "vorbisenc" + self.cpp_info.components["vorbisfile"].names["cmake_find_package"] = "vorbisfile" + self.cpp_info.components["vorbisfile"].names["cmake_find_package_multi"] = "vorbisfile" + self.cpp_info.components["vorbisenc-alias"].names["cmake_find_package"] = "Enc" + self.cpp_info.components["vorbisenc-alias"].names["cmake_find_package_multi"] = "Enc" + self.cpp_info.components["vorbisenc-alias"].requires.append("vorbisenc") + self.cpp_info.components["vorbisfile-alias"].names["cmake_find_package"] = "File" + self.cpp_info.components["vorbisfile-alias"].names["cmake_find_package_multi"] = "File" + self.cpp_info.components["vorbisfile-alias"].requires.append("vorbisfile") diff --git a/recipes/vorbis/all/patches/1.3.6-0001-link-libm-find-package-ogg.patch b/recipes/vorbis/all/patches/1.3.6-0001-link-libm-find-package-ogg.patch new file mode 100644 index 0000000..5ae7f22 --- /dev/null +++ b/recipes/vorbis/all/patches/1.3.6-0001-link-libm-find-package-ogg.patch @@ -0,0 +1,56 @@ +Backport in 1.3.6 some build improvements of 1.3.7: +* link to libm +* usage of find_package to discover Ogg and link with Ogg:ogg target + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,7 @@ project(vorbis) + # Required modules + include(GNUInstallDirs) + include(CheckIncludeFiles) ++include(CheckLibraryExists) + + # Build options + option(BUILD_SHARED_LIBS "Build shared library" OFF) +@@ -52,18 +53,12 @@ endfunction() + + message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}") + ++# Find math library ++ ++check_library_exists(m floor "" HAVE_LIBM) ++ + # Find ogg dependency +-if(NOT OGG_ROOT) +- find_package(PkgConfig QUIET) +- pkg_check_modules(PC_OGG QUIET ogg) +- find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${PC_OGG_INCLUDE_DIRS} PATH_SUFFIXES ogg) +- find_library(OGG_LIBRARIES NAMES ogg HINTS ${PC_OGG_LIBRARY_DIRS}) +-else() +- find_path(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${OGG_ROOT}/include PATH_SUFFIXES ogg) +- find_library(OGG_LIBRARIES NAMES ogg HINTS ${OGG_ROOT}/lib ${OGG_ROOT}/lib64) +-endif() +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(OGG DEFAULT_MSG OGG_INCLUDE_DIRS OGG_LIBRARIES) ++find_package(Ogg REQUIRED) + + add_subdirectory(lib) + +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -83,9 +83,12 @@ if (NOT BUILD_FRAMEWORK) + get_version_info(VORBISFILE_VERSION_INFO "VF_LIB_CURRENT" "VF_LIB_AGE" "VF_LIB_REVISION") + set_target_properties(vorbisfile PROPERTIES SOVERSION ${VORBISFILE_VERSION_INFO}) + +- target_link_libraries(vorbis ${OGG_LIBRARIES}) +- target_link_libraries(vorbisenc ${OGG_LIBRARIES} vorbis) +- target_link_libraries(vorbisfile ${OGG_LIBRARIES} vorbis) ++ target_link_libraries(vorbis ++ PUBLIC Ogg::ogg ++ PRIVATE $<$:m> ++ ) ++ target_link_libraries(vorbisenc PUBLIC vorbis) ++ target_link_libraries(vorbisfile PUBLIC vorbis) + + install(FILES ${VORBIS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/vorbis) + diff --git a/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch b/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch new file mode 100644 index 0000000..e29a62c --- /dev/null +++ b/recipes/vorbis/all/patches/1.3.7-0001-mingw-shared-def.patch @@ -0,0 +1,29 @@ +--- a/win32/vorbis.def ++++ b/win32/vorbis.def +@@ -1,6 +1,6 @@ + ; vorbis.def + ; +-LIBRARY ++ + EXPORTS + _floor_P + _mapping_P +--- a/win32/vorbisenc.def ++++ b/win32/vorbisenc.def +@@ -1,6 +1,5 @@ + ; vorbisenc.def + ; +-LIBRARY + + EXPORTS + vorbis_encode_init +--- a/win32/vorbisfile.def ++++ b/win32/vorbisfile.def +@@ -1,6 +1,6 @@ + ; vorbisfile.def + ; +-LIBRARY ++ + EXPORTS + ov_clear + ov_open diff --git a/recipes/vorbis/all/test_package/CMakeLists.txt b/recipes/vorbis/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..2cb69c9 --- /dev/null +++ b/recipes/vorbis/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Vorbis REQUIRED Enc CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Vorbis::vorbisenc) diff --git a/recipes/vorbis/all/test_package/conanfile.py b/recipes/vorbis/all/test_package/conanfile.py new file mode 100644 index 0000000..3a8c6c5 --- /dev/null +++ b/recipes/vorbis/all/test_package/conanfile.py @@ -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") diff --git a/recipes/vorbis/all/test_package/test_package.c b/recipes/vorbis/all/test_package/test_package.c new file mode 100644 index 0000000..794aa0d --- /dev/null +++ b/recipes/vorbis/all/test_package/test_package.c @@ -0,0 +1,7 @@ +#include +#include + +int main(){ + vorbis_comment vc; + vorbis_comment_init(&vc); +} diff --git a/recipes/vorbis/config.yml b/recipes/vorbis/config.yml new file mode 100644 index 0000000..bb69b16 --- /dev/null +++ b/recipes/vorbis/config.yml @@ -0,0 +1,5 @@ +versions: + "1.3.7": + folder: all + "1.3.6": + folder: all diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py new file mode 100644 index 0000000..18c7f04 --- /dev/null +++ b/recipes/xorg/all/conanfile.py @@ -0,0 +1,116 @@ +from conan import ConanFile, conan_version +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" + + +class XorgConan(ConanFile): + name = "xorg" + package_type = "shared-library" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://www.x.org/wiki/" + description = "The X.Org project provides an open source implementation of the X Window System." + settings = "os", "arch", "compiler", "build_type" + topics = ("x11", "xorg") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def package_id(self): + self.info.clear() + + def system_requirements(self): + apt = package_manager.Apt(self) + apt.install(["libx11-dev", "libx11-xcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", "libxau-dev", "libxaw7-dev", + "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", "libxext-dev", "libxfixes-dev", + "libxi-dev", "libxinerama-dev", "libxkbfile-dev", "libxmu-dev", "libxmuu-dev", + "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", "libxss-dev", "libxt-dev", "libxtst-dev", + "libxv-dev", "libxxf86vm-dev", "libxcb-glx0-dev", "libxcb-render0-dev", + "libxcb-render-util0-dev", "libxcb-xkb-dev", "libxcb-icccm4-dev", "libxcb-image0-dev", + "libxcb-keysyms1-dev", "libxcb-randr0-dev", "libxcb-shape0-dev", "libxcb-sync-dev", "libxcb-xfixes0-dev", + "libxcb-xinerama0-dev", "libxcb-dri3-dev", "uuid-dev", "libxcb-cursor-dev", "libxcb-dri2-0-dev", + "libxcb-dri3-dev", "libxcb-present-dev", "libxcb-composite0-dev", "libxcb-ewmh-dev", + "libxcb-res0-dev"], update=True, check=True) + apt.install_substitutes( + ["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) + + dnf = package_manager.Dnf(self) + dnf.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXss-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", + "xcb-util-devel", "libuuid-devel", "xcb-util-cursor-devel"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", + "libxss", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xcb-util", "util-linux-libs", "xcb-util-cursor"], update=True, check=True) + + package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", + "libXScrnSaver", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "xcb-util-cursor"], update=True, check=True) + + if Version(conan_version) >= "2.0.10": + alpine = package_manager.Apk(self) + alpine.install(["libx11-dev", " libxcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", " libxau-dev", "libxaw-dev", + "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", " libxext-dev", "libxfixes-dev", "libxi-dev", + "libxinerama-dev", "libxkbfile-dev", " libxmu-dev", "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", + "libxscrnsaver-dev", "libxt-dev", "libxtst-dev", "libxv-dev", "libxxf86vm-dev", + "xcb-util-wm-dev", "xcb-util-image-dev", "xcb-util-keysyms-dev", "xcb-util-renderutil-dev", + "libxinerama-dev", "libxcb-dev", "xcb-util-dev", "xcb-util-cursor-dev"], update=True, check=True) + + def package_info(self): + if Version(conan_version) >= 2: + self.cpp_info.bindirs = [] + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + for name in ["x11", "x11-xcb", "fontenc", "ice", "sm", "xau", "xaw7", + "xcomposite", "xcursor", "xdamage", "xdmcp", "xext", "xfixes", "xi", + "xinerama", "xkbfile", "xmu", "xmuu", "xpm", "xrandr", "xrender", "xres", + "xscrnsaver", "xt", "xtst", "xv", "xxf86vm", + "xcb-xkb", "xcb-icccm", "xcb-image", "xcb-keysyms", "xcb-randr", "xcb-render", + "xcb-renderutil", "xcb-shape", "xcb-shm", "xcb-sync", "xcb-xfixes", + "xcb-xinerama", "xcb", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", + "xcb-dri3", "xcb-cursor", "xcb-dri2", "xcb-dri3", "xcb-glx", "xcb-present", + "xcb-composite", "xcb-ewmh", "xcb-res"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]): + pkg_config = PkgConfig(self, name) + pkg_config.fill_cpp_info( + self.cpp_info.components[name], is_system=self.settings.os != "FreeBSD") + self.cpp_info.components[name].version = pkg_config.version + self.cpp_info.components[name].set_property( + "pkg_config_name", name) + self.cpp_info.components[name].set_property( + "component_version", pkg_config.version) + self.cpp_info.components[name].bindirs = [] + self.cpp_info.components[name].includedirs = [] + self.cpp_info.components[name].libdirs = [] + self.cpp_info.components[name].set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"])) + + if self.settings.os == "Linux": + self.cpp_info.components["sm"].requires.append("uuid") diff --git a/recipes/xorg/all/test_package/CMakeLists.txt b/recipes/xorg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..36e3820 --- /dev/null +++ b/recipes/xorg/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(xorg REQUIRED CONFIG) + +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE xorg::xorg) diff --git a/recipes/xorg/all/test_package/conanfile.py b/recipes/xorg/all/test_package/conanfile.py new file mode 100644 index 0000000..f414ecd --- /dev/null +++ b/recipes/xorg/all/test_package/conanfile.py @@ -0,0 +1,34 @@ +import os + +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.gnu import PkgConfigDeps + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + pkg_config = self.conf_info.get("tools.gnu:pkg_config", default="pkg-config") + uuid_pkg_config_file = os.path.join(self.generators_folder, "uuid.pc") + self.run(f"{pkg_config} --validate {uuid_pkg_config_file}") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/xorg/all/test_package/test_package.c b/recipes/xorg/all/test_package/test_package.c new file mode 100644 index 0000000..ad93e6c --- /dev/null +++ b/recipes/xorg/all/test_package/test_package.c @@ -0,0 +1,26 @@ +#include +#include + +#include + +#include + +#include + +int main() { + Display *display = XOpenDisplay(NULL); + + if (!display) { + printf("XOpenDisplay failed\n"); + return 0; + } + + { + char *xau_file_name = XauFileName(); + if (xau_file_name) + printf("XauFileName: %s\n", xau_file_name); + } + + XCloseDisplay(display); + SmcSetErrorHandler(NULL); +} diff --git a/recipes/xorg/config.yml b/recipes/xorg/config.yml new file mode 100644 index 0000000..76a338d --- /dev/null +++ b/recipes/xorg/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: "all" diff --git a/recipes/xz_utils/all/conandata.yml b/recipes/xz_utils/all/conandata.yml new file mode 100644 index 0000000..dc6b75a --- /dev/null +++ b/recipes/xz_utils/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + "5.4.5": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.4.5" + "5.4.4": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.4.4" + "5.4.2": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.4.2" + "5.4.0": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.4.0" + "5.2.10": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.2.10" + "5.2.5": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.2.5" + "5.2.4": + url: "ssh://git@git.avroid.tech:2222/Mirrors/xz" + branch: "v5.2.4" +patches: + "5.2.4": + - patch_file: "patches/0001-relax_windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py new file mode 100644 index 0000000..b88a046 --- /dev/null +++ b/recipes/xz_utils/all/conanfile.py @@ -0,0 +1,230 @@ +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, replace_in_file, rm, rmdir, save, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain +from conan.tools.scm import Version, Git +import os +import textwrap + +required_conan_version = ">=1.54.0" + + +class XZUtilsConan(ConanFile): + name = "xz_utils" + description = ( + "XZ Utils is free general-purpose data compression software with a high " + "compression ratio. XZ Utils were written for POSIX-like systems, but also " + "work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils." + ) + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://tukaani.org/xz" + topics = ("lzma", "xz", "compression") + license = "Unlicense", "LGPL-2.1-or-later", "GPL-2.0-or-later", "GPL-3.0-or-later" + 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 _effective_msbuild_type(self): + # treat "RelWithDebInfo" and "MinSizeRel" as "Release" + # there is no DebugMT configuration in upstream vcxproj, we patch Debug configuration afterwards + return "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "MT" if is_msvc_static_runtime(self) and self.settings.build_type != "Debug" else "", + ) + + @property + def _msbuild_target(self): + return "liblzma_dll" if self.options.shared else "liblzma" + + @property + def _use_msbuild(self): + assume_clang_cl = (self.settings.os == "Windows" + and self.settings.compiler == "clang" + and self.settings.get_safe("compiler.runtime") is not None) + return is_msvc(self) or assume_clang_cl + + 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 self._settings_build.os == "Windows" and not self._use_msbuild: + 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) + git = Git(self) + sources = self.conan_data["sources"][self.version] + clone_args = ['--depth', '1', '--branch', sources["branch"]] + git.clone(url=sources["url"], target=self.source_folder, args=clone_args) + + def generate(self): + if self._use_msbuild: + tc = MSBuildToolchain(self) + tc.configuration = self._effective_msbuild_type + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-doc") + if self.settings.build_type == "Debug": + tc.configure_args.append("--enable-debug") + if cross_building(self) and self.settings.os == "Windows": + tc.configure_args.append("--disable-dependency-tracking") + tc.configure_args.append("--disable-nls") + tc.configure_args.append("--disable-scripts") + tc.configure_args.append("--disable-threads") + tc.configure_args.append("--enable-small") + tc.configure_args.append("CFLAGS=-march=x86-64 -mtune=generic") + tc.generate() + + @property + def _msvc_sln_folder(self): + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + return "vs2017" + return "vs2013" + + def _build_msvc(self): + build_script_folder = os.path.join(self.source_folder, "windows", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client. + vcxproj_files = [ + os.path.join(build_script_folder, "liblzma.vcxproj"), + os.path.join(build_script_folder, "liblzma_dll.vcxproj"), + ] + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + old_toolset = "v141" + else: + old_toolset = "v120" + new_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + f"{old_toolset}", + f"{new_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + + if self.settings.arch == "armv8": + replace_in_file(self, vcxproj_file, "x64", "ARM64") + + solution_file = os.path.join(build_script_folder, "xz_win.sln") + if self.settings.arch == "armv8": + replace_in_file(self, solution_file, "x64", "ARM64") + + #============================== + + msbuild = MSBuild(self) + msbuild.build_type = self._effective_msbuild_type + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(build_script_folder, solution_file), targets=[self._msbuild_target]) + + def build(self): + apply_conandata_patches(self) + if self._use_msbuild: + self._build_msvc() + else: + with chdir(self, self.source_folder): + self.run("./autogen.sh --no-po4a --no-doxygen") + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self._use_msbuild: + inc_dir = os.path.join(self.source_folder, "src", "liblzma", "api") + copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "windows") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + rename(self, os.path.join(self.package_folder, "lib", "liblzma.lib"), + os.path.join(self.package_folder, "lib", "lzma.lib")) + else: + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + 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) + + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_file_rel_path), + ) + + def _create_cmake_module_variables(self, module_file): + # TODO: also add LIBLZMA_HAS_AUTO_DECODER, LIBLZMA_HAS_EASY_ENCODER & LIBLZMA_HAS_LZMA_PRESET + content = textwrap.dedent(f"""\ + set(LIBLZMA_FOUND TRUE) + if(DEFINED LibLZMA_INCLUDE_DIRS) + set(LIBLZMA_INCLUDE_DIRS ${{LibLZMA_INCLUDE_DIRS}}) + endif() + if(DEFINED LibLZMA_LIBRARIES) + set(LIBLZMA_LIBRARIES ${{LibLZMA_LIBRARIES}}) + endif() + set(LIBLZMA_VERSION_MAJOR {Version(self.version).major}) + set(LIBLZMA_VERSION_MINOR {Version(self.version).minor}) + set(LIBLZMA_VERSION_PATCH {Version(self.version).patch}) + set(LIBLZMA_VERSION_STRING "{self.version}") + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "LibLZMA") + self.cpp_info.set_property("cmake_target_name", "LibLZMA::LibLZMA") + self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) + self.cpp_info.set_property("pkg_config_name", "liblzma") + self.cpp_info.libs = ["lzma"] + if not self.options.shared: + self.cpp_info.defines.append("LZMA_API_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.names["cmake_find_package"] = "LibLZMA" + self.cpp_info.names["cmake_find_package_multi"] = "LibLZMA" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch new file mode 100644 index 0000000..d968098 --- /dev/null +++ b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/windows/vs2017/liblzma.vcxproj ++++ b/windows/vs2017/liblzma.vcxproj +@@ -29,7 +29,6 @@ + + {12728250-16EC-4DC6-94D7-E21DD88947F8} + Win32Proj +- 10.0.15063.0 + + + +--- a/windows/vs2017/liblzma_dll.vcxproj ++++ b/windows/vs2017/liblzma_dll.vcxproj +@@ -29,7 +29,6 @@ + + {E0F247DB-EF12-4755-8DF9-F74BCD1348F7} + Win32Proj +- 10.0.15063.0 + + + diff --git a/recipes/xz_utils/all/test_package/CMakeLists.txt b/recipes/xz_utils/all/test_package/CMakeLists.txt new file mode 100644 index 0000000..cd4e960 --- /dev/null +++ b/recipes/xz_utils/all/test_package/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(LibLZMA REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html +# are properly defined in conan generators +set(_custom_vars + LIBLZMA_FOUND + LIBLZMA_INCLUDE_DIRS + LIBLZMA_LIBRARIES + LIBLZMA_VERSION_MAJOR + LIBLZMA_VERSION_MINOR + LIBLZMA_VERSION_PATCH + LIBLZMA_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED ${_custom_var}) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/xz_utils/all/test_package/conanfile.py b/recipes/xz_utils/all/test_package/conanfile.py new file mode 100644 index 0000000..0a6bc68 --- /dev/null +++ b/recipes/xz_utils/all/test_package/conanfile.py @@ -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") diff --git a/recipes/xz_utils/all/test_package/test_package.c b/recipes/xz_utils/all/test_package/test_package.c new file mode 100644 index 0000000..a1f55ac --- /dev/null +++ b/recipes/xz_utils/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include +#include + +int main() { + printf("LZMA version %s\n", lzma_version_string()); + return EXIT_SUCCESS; +} diff --git a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000..0d20897 --- /dev/null +++ b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt @@ -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) diff --git a/recipes/xz_utils/all/test_v1_package/conanfile.py b/recipes/xz_utils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000..19e6a0c --- /dev/null +++ b/recipes/xz_utils/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xz_utils/config.yml b/recipes/xz_utils/config.yml new file mode 100644 index 0000000..d950dab --- /dev/null +++ b/recipes/xz_utils/config.yml @@ -0,0 +1,15 @@ +versions: + "5.4.5": + folder: all + "5.4.4": + folder: all + "5.4.2": + folder: all + "5.4.0": + folder: all + "5.2.10": + folder: all + "5.2.5": + folder: all + "5.2.4": + folder: all