[DO-971] ffmpeg recipe with requirements (!9)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/9
This commit is contained in:
Aleksandr Vodyanov
2024-12-25 17:47:28 +03:00
parent e58f90de0e
commit 39afe6a1dd
212 changed files with 9263 additions and 0 deletions

View File

@@ -0,0 +1,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"

View File

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

View File

@@ -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 <sys/types.h>
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__)

View File

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

View File

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

View File

@@ -0,0 +1,10 @@
#include "ogg/ogg.h"
#include <stdio.h>
#include <stdlib.h>
int main () {
ogg_sync_state og;
int result = ogg_sync_init(&og);
printf("OGG sync init result: %d\n\r", result);
return EXIT_SUCCESS;
}

5
recipes/ogg/config.yml Normal file
View File

@@ -0,0 +1,5 @@
versions:
"1.3.5":
folder: all
"1.3.4":
folder: all