diff --git a/recipes/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml index 96d617e32dbb60..1539a34e13becf 100644 --- a/recipes/libcap/all/conandata.yml +++ b/recipes/libcap/all/conandata.yml @@ -1,59 +1,58 @@ sources: - "2.45": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz" - sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286" - "2.46": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz" - sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4" - "2.48": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz" - sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2" - "2.50": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz" - sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261" - "2.57": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz" - sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab" - "2.58": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz" - sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b" - "2.62": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz" - sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2" - "2.65": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz" - sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd" "2.66": url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz" sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2" - -patches: + "2.65": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz" + sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd" + "2.62": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz" + sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2" + "2.58": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz" + sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b" + "2.57": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz" + sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab" + "2.50": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz" + sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261" + "2.48": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz" + sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2" + "2.46": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz" + sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4" "2.45": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz" + sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286" +patches: + "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.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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.46": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + "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.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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.48": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + "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.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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" + "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.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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": @@ -63,31 +62,31 @@ patches: - 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" + "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.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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.62": - - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + "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.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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.65": - - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + "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.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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.66": - - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + "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.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + - 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 index 84f7ed56fc46a5..082e994b020bb8 100644 --- a/recipes/libcap/all/conanfile.py +++ b/recipes/libcap/all/conanfile.py @@ -19,7 +19,7 @@ class LibcapConan(ConanFile): description = "This is a library for getting and setting POSIX.1e" \ " (formerly POSIX 6) draft 15 capabilities" topics = ("capabilities") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -31,21 +31,21 @@ class LibcapConan(ConanFile): "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 validate(self): - if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") - def layout(self): basic_layout(self, src_folder="src") - def export_sources(self): - export_conandata_patches(self) + 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) @@ -60,8 +60,8 @@ def generate(self): env.define("prefix", "/") env.define("lib", "lib") - if cross_building(self) and not env.vars(self).get("BUILD_CC"): - native_cc = VirtualBuildEnv(self).vars().get("CC") + if cross_building(self): + native_cc = env.vars(self).get("CC", VirtualBuildEnv(self).vars().get("CC")) if not native_cc: native_cc = "cc" self.output.info(f"Using native compiler '{native_cc}'") @@ -73,15 +73,14 @@ def build(self): apply_conandata_patches(self) autotools = Autotools(self) - with chdir(self, os.path.join(self.source_folder, self.name)): + 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"), keep_path=False) + 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, self.name)): + 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") @@ -96,15 +95,12 @@ def package(self): 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"].names["pkg_config"] = "libcap" + 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"].names["pkg_config"] = "libpsx" + 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"] + 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/test_package/CMakeLists.txt b/recipes/libcap/all/test_package/CMakeLists.txt index 1e5f193ffe6697..9cf6b900664104 100644 --- a/recipes/libcap/all/test_package/CMakeLists.txt +++ b/recipes/libcap/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(PackageTest LANGUAGES C) +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(example example.c) -target_link_libraries(example PRIVATE PkgConfig::CAP) +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 index 833f2d61cd5bb9..000b95ab28ae51 100644 --- a/recipes/libcap/all/test_package/conanfile.py +++ b/recipes/libcap/all/test_package/conanfile.py @@ -3,29 +3,22 @@ from conan import ConanFile from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout -from conan.tools.env import Environment -class LibcapTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" +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/1.9.3") - def layout(self): - cmake_layout(self) - - def generate(self): - env = Environment() - env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - envvars = env.vars(self) - envvars.save_script("pkg_config") - def build(self): cmake = CMake(self) cmake.configure() @@ -33,5 +26,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "example") + 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/example.c b/recipes/libcap/all/test_package/test_package.c similarity index 100% rename from recipes/libcap/all/test_package/example.c rename to recipes/libcap/all/test_package/test_package.c diff --git a/recipes/libcap/all/test_v1_package/conanfile.py b/recipes/libcap/all/test_v1_package/conanfile.py index 8ee3af7509e31b..f480305272e38f 100644 --- a/recipes/libcap/all/test_v1_package/conanfile.py +++ b/recipes/libcap/all/test_v1_package/conanfile.py @@ -1,16 +1,15 @@ import os -from conan import ConanFile -from conan.tools.build import cross_building +from conans import ConanFile, tools from conans import CMake -class LibcapTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" generators = "cmake", "pkg_config" def build_requirements(self): - self.tool_requires("pkgconf/1.9.3") + self.build_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) @@ -18,6 +17,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "example") + 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/libcap/config.yml b/recipes/libcap/config.yml index 58715d0f047445..6cf43a9b4e1c52 100644 --- a/recipes/libcap/config.yml +++ b/recipes/libcap/config.yml @@ -1,19 +1,19 @@ versions: - "2.45": + "2.66": folder: all - "2.46": + "2.65": folder: all - "2.48": + "2.62": folder: all - "2.50": + "2.58": folder: all "2.57": folder: all - "2.58": + "2.50": folder: all - "2.62": + "2.48": folder: all - "2.65": + "2.46": folder: all - "2.66": + "2.45": folder: all