[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:
122
recipes/libcap/all/conandata.yml
Normal file
122
recipes/libcap/all/conandata.yml
Normal file
@@ -0,0 +1,122 @@
|
||||
sources:
|
||||
"2.70":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.70.tar.xz"
|
||||
sha256: "23a6ef8aadaf1e3e875f633bb2d116cfef8952dba7bc7c569b13458e1952b30f"
|
||||
"2.69":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.69.tar.xz"
|
||||
sha256: "f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb"
|
||||
"2.68":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.68.tar.xz"
|
||||
sha256: "90be3b6d41be5f81ae4b03ec76012b0d27c829293684f6c05b65d5f9cce724b2"
|
||||
"2.66":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz"
|
||||
sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2"
|
||||
"2.65":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz"
|
||||
sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd"
|
||||
"2.62":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz"
|
||||
sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2"
|
||||
"2.58":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz"
|
||||
sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b"
|
||||
"2.57":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz"
|
||||
sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab"
|
||||
"2.50":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz"
|
||||
sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261"
|
||||
"2.48":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz"
|
||||
sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2"
|
||||
"2.46":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz"
|
||||
sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4"
|
||||
"2.45":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-kernel_org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz"
|
||||
sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286"
|
||||
patches:
|
||||
"2.70":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.69":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.68":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.66":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.65":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.62":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.58":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.57":
|
||||
- patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.50":
|
||||
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.48":
|
||||
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.46":
|
||||
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
"2.45":
|
||||
- patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch"
|
||||
patch_description: "allow to configure fPIC option from conan recipe"
|
||||
patch_type: "conan"
|
||||
- patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch"
|
||||
patch_description: "allow to override compiler via environment variables"
|
||||
patch_type: "conan"
|
||||
104
recipes/libcap/all/conanfile.py
Normal file
104
recipes/libcap/all/conanfile.py
Normal file
@@ -0,0 +1,104 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.build import cross_building
|
||||
from conan.tools.files import apply_conandata_patches, copy, chdir, export_conandata_patches, get, rmdir
|
||||
from conan.tools.gnu import Autotools, AutotoolsToolchain
|
||||
from conan.tools.layout import basic_layout
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class LibcapConan(ConanFile):
|
||||
name = "libcap"
|
||||
license = ("GPL-2.0-only", "BSD-3-Clause")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git"
|
||||
description = "This is a library for getting and setting POSIX.1e" \
|
||||
" (formerly POSIX 6) draft 15 capabilities"
|
||||
topics = ("capabilities")
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"psx_syscals": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"psx_syscals": False,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
|
||||
def layout(self):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os != "Linux":
|
||||
raise ConanInvalidConfiguration(f"{self.name} only supports Linux")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = AutotoolsToolchain(self)
|
||||
tc.fpic = self.options.get_safe("fPIC", True)
|
||||
env = tc.environment()
|
||||
env.define("SHARED", "yes" if self.options.shared else "no")
|
||||
env.define("PTHREADS", "yes" if self.options.psx_syscals else "no")
|
||||
env.define("DESTDIR", self.package_folder)
|
||||
env.define("prefix", "/")
|
||||
env.define("lib", "lib")
|
||||
|
||||
if cross_building(self):
|
||||
# libcap needs to run an executable that is compiled from sources
|
||||
# during the build - so it needs a native compiler (it doesn't matter which)
|
||||
# Assume the `cc` command points to a working C compiler
|
||||
env.define("BUILD_CC", "cc")
|
||||
|
||||
tc.generate(env)
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
|
||||
autotools = Autotools(self)
|
||||
with chdir(self, os.path.join(self.source_folder, "libcap")):
|
||||
autotools.make()
|
||||
|
||||
def package(self):
|
||||
copy(self, "License", self.source_folder, os.path.join(self.package_folder, "licenses"))
|
||||
|
||||
autotools = Autotools(self)
|
||||
with chdir(self, os.path.join(self.source_folder, "libcap")):
|
||||
autotools.make(target="install-common-cap")
|
||||
install_cap = ("install-shared-cap" if self.options.shared
|
||||
else "install-static-cap")
|
||||
autotools.make(target=install_cap)
|
||||
|
||||
if self.options.psx_syscals:
|
||||
autotools.make(target="install-common-psx")
|
||||
install_psx = ("install-shared-psx" if self.options.shared
|
||||
else "install-static-psx")
|
||||
autotools.make(target=install_psx)
|
||||
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.components["cap"].set_property("pkg_config_name", "libcap")
|
||||
self.cpp_info.components["cap"].libs = ["cap"]
|
||||
if self.options.psx_syscals:
|
||||
self.cpp_info.components["psx"].set_property("pkg_config_name", "libpsx")
|
||||
self.cpp_info.components["psx"].libs = ["psx"]
|
||||
self.cpp_info.components["psx"].system_libs = ["pthread"]
|
||||
self.cpp_info.components["psx"].exelinkflags = ["-Wl,-wrap,pthread_create"]
|
||||
# trick to avoid conflicts with cap component
|
||||
self.cpp_info.set_property("pkg_config_name", "libcap-do-not-use")
|
||||
@@ -0,0 +1,26 @@
|
||||
From bb2c4e80928e8221a31c3631f5a802c7b022aebd Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
Date: Sun, 29 Aug 2021 12:02:23 +0300
|
||||
Subject: [PATCH 1/2] Make.Rules: Remove hardcoded -fPIC
|
||||
|
||||
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
---
|
||||
Make.Rules | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Make.Rules b/Make.Rules
|
||||
index cc6f95b..91099c6 100644
|
||||
--- a/Make.Rules
|
||||
+++ b/Make.Rules
|
||||
@@ -52,7 +52,7 @@ GOMAJOR=0
|
||||
# Compilation specifics
|
||||
|
||||
KERNEL_HEADERS := $(topdir)/libcap/include/uapi
|
||||
-IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
|
||||
+IPATH += -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
|
||||
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 76e637ad20faa811f4091a8a08af4b29c528697b Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
Date: Sun, 29 Aug 2021 12:06:18 +0300
|
||||
Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable
|
||||
|
||||
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
---
|
||||
Make.Rules | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Make.Rules b/Make.Rules
|
||||
index 91099c6..cd25495 100644
|
||||
--- a/Make.Rules
|
||||
+++ b/Make.Rules
|
||||
@@ -54,15 +54,15 @@ GOMAJOR=0
|
||||
KERNEL_HEADERS := $(topdir)/libcap/include/uapi
|
||||
IPATH += -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
|
||||
|
||||
-CC := $(CROSS_COMPILE)gcc
|
||||
+CC ?= $(CROSS_COMPILE)gcc
|
||||
DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
COPTS ?= -O2
|
||||
CFLAGS ?= $(COPTS) $(DEFINES)
|
||||
BUILD_CC ?= $(CC)
|
||||
BUILD_COPTS ?= -O2
|
||||
BUILD_CFLAGS ?= $(BUILD_COPTS) $(DEFINES) $(IPATH)
|
||||
-AR := $(CROSS_COMPILE)ar
|
||||
-RANLIB := $(CROSS_COMPILE)ranlib
|
||||
+AR ?= $(CROSS_COMPILE)ar
|
||||
+RANLIB ?= $(CROSS_COMPILE)ranlib
|
||||
DEBUG = -g #-DDEBUG
|
||||
WARNINGS=-Wall -Wwrite-strings \
|
||||
-Wpointer-arith -Wcast-qual -Wcast-align \
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From b70454fccba1816b14d50813b1715e9a50d7cca0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
Date: Sat, 11 Sep 2021 20:39:49 +0300
|
||||
Subject: [PATCH 1/2] libcap: Remove hardcoded -fPIC
|
||||
|
||||
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
---
|
||||
libcap/Makefile | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/libcap/Makefile b/libcap/Makefile
|
||||
index 7706063..1b52eb9 100644
|
||||
--- a/libcap/Makefile
|
||||
+++ b/libcap/Makefile
|
||||
@@ -18,9 +18,6 @@ CAPMAGICOBJ=cap_magic.o
|
||||
PSXFILES=../psx/psx
|
||||
PSXMAGICOBJ=psx_magic.o
|
||||
|
||||
-# Always build libcap sources this way:
|
||||
-CFLAGS += -fPIC
|
||||
-
|
||||
# The linker magic needed to build a dynamic library as independently
|
||||
# executable
|
||||
MAGIC=-Wl,-e,__so_start
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From a38f5a330d65cc877fcc1da02836526d11ead4f0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
Date: Sat, 11 Sep 2021 20:44:07 +0300
|
||||
Subject: [PATCH 2/2] Make.Rules: Make compile tools configurable
|
||||
|
||||
Signed-off-by: Sergey Bobrenok <bobrofon@gmail.com>
|
||||
---
|
||||
Make.Rules | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Make.Rules b/Make.Rules
|
||||
index 00f2a03..34831ae 100644
|
||||
--- a/Make.Rules
|
||||
+++ b/Make.Rules
|
||||
@@ -66,11 +66,11 @@ DEFINES := -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
SYSTEM_HEADERS = /usr/include
|
||||
|
||||
SUDO := sudo
|
||||
-CC := $(CROSS_COMPILE)gcc
|
||||
+CC ?= $(CROSS_COMPILE)gcc
|
||||
LD := $(CC) -Wl,-x -shared
|
||||
-AR := $(CROSS_COMPILE)ar
|
||||
-RANLIB := $(CROSS_COMPILE)ranlib
|
||||
-OBJCOPY := $(CROSS_COMPILE)objcopy
|
||||
+AR ?= $(CROSS_COMPILE)ar
|
||||
+RANLIB ?= $(CROSS_COMPILE)ranlib
|
||||
+OBJCOPY ?= $(CROSS_COMPILE)objcopy
|
||||
|
||||
# Reference:
|
||||
# CPPFLAGS used for building .o files from .c & .h files
|
||||
--
|
||||
2.31.1
|
||||
|
||||
8
recipes/libcap/all/test_package/CMakeLists.txt
Normal file
8
recipes/libcap/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::CAP)
|
||||
30
recipes/libcap/all/test_package/conanfile.py
Normal file
30
recipes/libcap/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires("pkgconf/[>=2.0.3]")
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
15
recipes/libcap/all/test_package/test_package.c
Normal file
15
recipes/libcap/all/test_package/test_package.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/capability.h>
|
||||
|
||||
int main(void) {
|
||||
puts("Allocate cap state");
|
||||
cap_t cap = cap_get_proc();
|
||||
if (!cap) {
|
||||
puts("Failed");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
puts("Success");
|
||||
cap_free(cap);
|
||||
}
|
||||
Reference in New Issue
Block a user