From 3ec7e707ae7c6b85f3778df446f2793f039d9b9a Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 7 Jan 2022 20:34:57 +0100 Subject: [PATCH] (#8593) pistache: fix gcc11 + modernize * fix gcc11 * modernize * bump openssl * fix patch --- recipes/pistache/all/conandata.yml | 2 + recipes/pistache/all/conanfile.py | 50 ++++++++++++------- .../all/patches/0002-include-stddef.patch | 12 +++++ .../pistache/all/test_package/CMakeLists.txt | 2 +- .../pistache/all/test_package/conanfile.py | 4 +- 5 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 recipes/pistache/all/patches/0002-include-stddef.patch diff --git a/recipes/pistache/all/conandata.yml b/recipes/pistache/all/conandata.yml index 447980783e147..d454d35200e30 100644 --- a/recipes/pistache/all/conandata.yml +++ b/recipes/pistache/all/conandata.yml @@ -6,3 +6,5 @@ patches: "cci.20201127": - patch_file: "patches/0001-remove-fpic.patch" base_path: "source_subfolder" + - patch_file: "patches/0002-include-stddef.patch" + base_path: "source_subfolder" diff --git a/recipes/pistache/all/conanfile.py b/recipes/pistache/all/conanfile.py index 23e9d670346c4..5e29aceaaf8ac 100644 --- a/recipes/pistache/all/conanfile.py +++ b/recipes/pistache/all/conanfile.py @@ -1,10 +1,8 @@ -import os -import glob from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration +import os - -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.33.0" class PistacheConan(ConanFile): @@ -14,10 +12,19 @@ class PistacheConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("http", "rest", "framework", "networking") description = "Pistache is a modern and elegant HTTP and REST framework for C++" - settings = "os", "compiler", "arch", "build_type" - options = {"shared": [True, False], "fPIC": [True, False], "with_ssl": [True, False]} - default_options = {"shared": False, "fPIC": True, "with_ssl": False} - exports_sources = ["CMakeLists.txt", "patches/*"] + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": False, + } + generators = "cmake", "cmake_find_package" _cmake = None @@ -29,7 +36,21 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" + def export_sources(self): + self.copy("CMakeLists.txt") + for patch in self.conan_data.get("patches", {}).get(self.version, []): + self.copy(patch["patch_file"]) + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("rapidjson/1.1.0") + if self.options.with_ssl: + self.requires("openssl/1.1.1m") + + def validate(self): compilers = { "gcc": "7", "clang": "6", @@ -40,9 +61,6 @@ def configure(self): if self.settings.compiler == "clang": raise ConanInvalidConfiguration("Clang support is broken. See pistacheio/pistache#835.") - if self.options.shared: - del self.options.fPIC - if self.settings.compiler.cppstd: tools.check_min_cppstd(self, 17) minimum_compiler = compilers.get(str(self.settings.compiler)) @@ -52,15 +70,9 @@ def configure(self): else: self.output.warn("Pistache requires c++17, but this compiler is unknown to this recipe. Assuming your compiler supports c++17.") - def requirements(self): - self.requires("rapidjson/1.1.0") - if self.options.with_ssl: - self.requires("openssl/1.1.1i") - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("pistache-*")[0] - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): if self._cmake: diff --git a/recipes/pistache/all/patches/0002-include-stddef.patch b/recipes/pistache/all/patches/0002-include-stddef.patch new file mode 100644 index 0000000000000..1f4d2425cd4c8 --- /dev/null +++ b/recipes/pistache/all/patches/0002-include-stddef.patch @@ -0,0 +1,12 @@ +fixed upstream https://github.com/pistacheio/pistache/pull/965 + +--- a/include/pistache/typeid.h ++++ b/include/pistache/typeid.h +@@ -11,6 +11,7 @@ + + #pragma once + ++#include + #include + + namespace Pistache { diff --git a/recipes/pistache/all/test_package/CMakeLists.txt b/recipes/pistache/all/test_package/CMakeLists.txt index fbc1a02cc763a..bf65e85023c4f 100644 --- a/recipes/pistache/all/test_package/CMakeLists.txt +++ b/recipes/pistache/all/test_package/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) find_package(Pistache REQUIRED CONFIG) diff --git a/recipes/pistache/all/test_package/conanfile.py b/recipes/pistache/all/test_package/conanfile.py index 7e2dfe859bb27..38f4483872d47 100644 --- a/recipes/pistache/all/test_package/conanfile.py +++ b/recipes/pistache/all/test_package/conanfile.py @@ -3,7 +3,7 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" def build(self): @@ -12,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True)