From 5ba8f87b6cc79cd58e159960050f5e51879d3f5a Mon Sep 17 00:00:00 2001 From: James Date: Mon, 17 Jun 2024 12:21:45 +0200 Subject: [PATCH] (#24320) upgrading crashpad to Conan 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * upgrading to Conan 2 * clean yaml * removed from config.yml * Cleanup * use tool_requires * wip * (#24282) bump boost dependency * (#23502) (#23474) simdjson/3.9.1: remove unnecessary constraints * (#18680) kealib: migrate to Conan v2 * kealib: migrate to Conan v2 * kealib: transitive_libs=True * kealib: simplify patch * kealib: add v1.5.1 * kealib: bump hdf5 * kealib: add min cppstd check * kealib: require GCC 6+ * kealib: drop v1.4.13 * kealib: bump to 1.5.2 * kealib: bump to 1.4.15 * kealib: fix MSVC lib name * kealib: bump hdf5 * kealib: fix MSVC library names * kealib: set HDF5_THREADSAFE based on hdf5 option * kealib: restore GCC 5 support Co-authored-by: Uilian Ries * kealib: fix a recipe bug * kealib: add CMAKE_POLICY_DEFAULT_CMP0077 * kealib: use valid_min_cppstd() * kealib: add cxx_std_11 to test_package * Add missing system lib in windows * Improve invalid config message. --------- Co-authored-by: Uilian Ries Co-authored-by: Rubén Rincón Blanco * (#19228) msix: migrate to Conan v2 * msix: migrate to Conan v2 * msix: use OpenSSL v1 * msix: bump deps * msix: fix Clang build issue * msix: fix OpenSSL 3 support * msix: add missing system libs * msix: simplify xml_parser option * msix: Clang 12 is not supported * msix: yaml * msix: test_package cxx_std_14 * (#24296) cpp-httplib: add version 0.16.0 * (#24297) glaze: add version 2.8.1 * (#24106) arrow: fix target names * Use the same CMake target names as upstream * Bugfix * Bugfix * Remove redundant calls to set_property("cmake_target_name") * Revert "Remove redundant calls to set_property("cmake_target_name")" This reverts commit fc113f04428727212116b6b849b7068d4856681e. * Bugfix * Bugfix * (#24307) libftp: add version 0.5.1 * (#24298) [sentry-native] Add versions 0.7.5/0.7.6 and remove 0.7.1/0.7.2 * (#24309) glaze: add version 2.8.2 * Update PULL_REQUEST_TEMPLATE.md (#24311) Update PR template: - Mention list of PRs by recipe - Simplify wording around testing locally - request that PRs are motivated and detailed (what/why/how) * (#24308) octo-logger-cpp: fix checksum for 1.12.0 * (#22456) proposal: update dependencies * proposal: update dependencies * Update recipes/proposal/all/conanfile.py * Update recipes/proposal/all/conanfile.py * Update recipes/proposal/all/conanfile.py * proposal: build fewer versions --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> * (#18949) userspace-rcu: migrate to Conan v2 * userspace-rcu: migrate to Conan v2 * userspace-rcu: add v0.14.0 * userspace-rcu: no need for a custom bootstrap script * userspace-rcu: fix test_v1_package * userspace-rcu: disable apple-clang for v0.11.4 * (#18986) librhash: migrate to Conan v2 * librhash: migrate to Conan v2 * librhash: use OpenSSL v1 * librhash: bump deps * librhash: fix installation * librhash: downgrade OpenSSL * librhash: switch to custom CMakeLists.txt The build scripts in the project are quite non-standard and not too portable. Based on https://github.com/rhash/RHash/pull/103 * librhash: bump openssl * librhash: add v1.4.4 * librhash: fix the list of sources used in CMakeLists.txt * librhash: fix missing lib prefix for libs * librhash: don't use PROJECT_NAME * (#18950) pbc: migrate to Conan v2 * pbc: migrate to Conan v2 * pbc: bump gmp * pbc: use winflexbison on Windows * pbc: add transitive_headers=True to gmp * pbc: fix build * pbc: fix apple cross building bug * pbc: transitive_libs=True * pbc: bump deps * pbc: fix configure issue * pbc: fix to_apple_arch() * pbc: add MSVC support * pbc: add AutotoolsDeps workaround for MSVC * pbc: add MSVC ./configure workarounds * pbc: not compatible with MSVC due to use of GNU extensions * pbc: fix_apple_shared_install_name() * (#18948) hiredis/0.x.x: remove 0.x recipe * hiredis/0.x.x: migrate to Conan v2 * hiredis/0.x.x: fix_apple_shared_install_name(self) * Dropped support for very old 0.x.x versions --------- Co-authored-by: PerseoGI * (#23997) mini: add recipe * mini: add recipe * Update recipes/mini/all/test_package/test_package.cpp --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> * (#24300) octo-logger-cpp: bumped fmt dependency * (#20586) pcre2: fix invalid pcre2-config output for static libs * pcre2: fix invalid pcre2-config output for static libs * pcre2: ignore noise from self.run() * pcre2: make pcre2-config test a bit more robust * pcre2: handle debug postfix correctly * pcre2: no need for win_bash = True * pcre2: drop self.tool_requires(self.tested_reference_str) * Update recipes/pcre2/all/test_package/conanfile.py * Update recipes/pcre2/all/test_package/conanfile.py * Update recipes/pcre2/all/test_package/conanfile.py * Update recipes/pcre2/all/test_package/conanfile.py * Update recipes/pcre2/all/test_package/conanfile.py * Update recipes/pcre2/all/test_package/conanfile.py * fix replace for 10.43 * fix fix replace --------- Co-authored-by: Daniel * (#19239) pro-mdnsd: migrate to Conan v2 Co-authored-by: Carlos Zoido * (#24262) reflect-cpp: add option for using with msgpack * reflect-cpp: add option for using with msgpack * reflect-cpp: fix with_msgpack option --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> * (#24011) arrow: add version 16.1.0 * arrow: add version 16.1.0 * Format build method --------- Co-authored-by: PerseoGI * (#24312) [bot] Update authorized users list (2024-06-13) Co-authored-by: conan-center-bot * (#24273) [boost] Add -fcoroutines for GCC10 only * Add -fcoroutines for GCC10 only Signed-off-by: Uilian Ries * Use b2 ranged version Signed-off-by: Uilian Ries --------- Signed-off-by: Uilian Ries * (#24318) glaze: add version 2.8.4 * (#24316) jsoncons: add version 0.176.0 * (#24306) libmaxminddb: add version 1.10.0 * libmaxmind: add version 1.10.0 * add with_binaries option * Cleanups * append PATH on with_binaries=True --------- Co-authored-by: Rubén Rincón Blanco * (#24323) pcre2: add version 10.44 * test pr do not merge * Revert "test pr do not merge" This reverts commit f146b96c6e62e8ddba7064d90032ca8d71072176. * (#24328) change gn validate to validate_build * package license * update to set_property for cmake_build_modules * add library type --------- Signed-off-by: Uilian Ries Co-authored-by: Rubén Rincón Blanco Co-authored-by: Jean-Marco Alameddine Co-authored-by: Jie Cheng Co-authored-by: Martin Valgur Co-authored-by: Uilian Ries Co-authored-by: toge Co-authored-by: Roberto Rossini <71787608+robomics@users.noreply.github.com> Co-authored-by: Martin Delille Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> Co-authored-by: PerseoGI Co-authored-by: Daniel Co-authored-by: Carlos Zoido Co-authored-by: Beartama <8091245+uyha@users.noreply.github.com> Co-authored-by: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Co-authored-by: conan-center-bot --- recipes/crashpad/all/conandata.yml | 32 +-- recipes/crashpad/all/conanfile.py | 208 ++++++++---------- ...20210507-0001-fix-openssl-link-order.patch | 23 -- ...20210507-0002-remove-fPIC-Werror-LTO.patch | 70 ------ ...cci.20210507-0003-compilers-from-env.patch | 14 -- ...-conan-linux-syscall-support-package.patch | 14 -- .../cci.20210507-0005-allow-all-archs.patch | 40 ---- ...07-0006-mini_chromium-win_helper-py3.patch | 96 -------- .../crashpad/all/test_package/CMakeLists.txt | 9 +- .../crashpad/all/test_package/conanfile.py | 38 +++- recipes/crashpad/config.yml | 2 - 11 files changed, 125 insertions(+), 421 deletions(-) delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch delete mode 100644 recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch diff --git a/recipes/crashpad/all/conandata.yml b/recipes/crashpad/all/conandata.yml index 78196c9e613a3..309c5ff4f2de1 100644 --- a/recipes/crashpad/all/conandata.yml +++ b/recipes/crashpad/all/conandata.yml @@ -1,11 +1,4 @@ sources: - "cci.20210507": - crashpad: - url: "https://github.com/chromium/crashpad/archive/d9bc7cf06aef74e928f9afc3dee33b60121b9c73.tar.gz" - sha256: "49f4b10f1de9b6d33743eccecace6b0fc9d7fe92e5e550ba5e099e6db9a11f0f" - mini_chromium: - url: "https://github.com/chromium/mini_chromium/archive/ccb198907cecf072d8f5b2543d4d348e834a298a.tar.gz" - sha256: "f40a77a4580cd1cb9af71602917a0e85b62bf0f74641b6ed81dd9fb2f2012ea9" "cci.20220219": crashpad: url: "https://github.com/chromium/crashpad/archive/e9937cb36cd12f24d73a07c4b91168cf1885b5db.tar.gz" @@ -14,36 +7,13 @@ sources: url: "https://github.com/chromium/mini_chromium/archive/822fada4a9972e3e2f36a981da770539025beb0a.tar.gz" sha256: "2c3bf30d324fcb60eeef84dd6aaf7fb75b70e37bdb3716ab3ea10cda51c4b05c" patches: - "cci.20210507": - - patch_file: "patches/cci.20210507-0001-fix-openssl-link-order.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0003-compilers-from-env.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0005-allow-all-archs.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch" - base_path: "source_subfolder" - - patch_file: "patches/cci.20210507-0007-use-system-zlib.patch" - base_path: "source_subfolder" "cci.20220219": - patch_file: "patches/cci.20220219-0001-fix-openssl-link-order.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0002-remove-fPIC-Werror-LTO.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0003-compilers-from-env.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0004-use-conan-linux-syscall-support-package.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0005-allow-all-archs.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0006-mini_chromium-win_helper-py3.patch" - base_path: "source_subfolder" - # reused patch from cci.20210507 + # reused patch from cci.20210507 - patch_file: "patches/cci.20210507-0007-use-system-zlib.patch" - base_path: "source_subfolder" - patch_file: "patches/cci.20220219-0007-static-lib-tool_support.patch" - base_path: "source_subfolder" diff --git a/recipes/crashpad/all/conanfile.py b/recipes/crashpad/all/conanfile.py index 42d603abefb4c..7b7d6c74f963c 100644 --- a/recipes/crashpad/all/conanfile.py +++ b/recipes/crashpad/all/conanfile.py @@ -1,21 +1,30 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, save, chdir +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.apple import XCRun, is_apple_os +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.microsoft import VCVars, is_msvc +from conan.tools.gnu import AutotoolsDeps, AutotoolsToolchain + + import os import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.64.0" class CrashpadConan(ConanFile): name = "crashpad" description = "Crashpad is a crash-reporting system." url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "crashpad", "crash", "error", "stacktrace", "collecting", "reporting") + topics = ("crashpad", "crash", "error", "stacktrace", "collecting", "reporting") license = "Apache-2.0" homepage = "https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md" - provides = "crashpad", "mini_chromium" + provides = "mini_chromium" settings = "os", "arch", "compiler", "build_type" + package_type = "static-library" options = { "fPIC": [True, False], "http_transport": ["libcurl", "socket", None], @@ -26,17 +35,16 @@ class CrashpadConan(ConanFile): "http_transport": None, "with_tls": "openssl", } - exports_sources = "patches/*" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def _minimum_compiler_cxx14(self): return { "apple-clang": 10, "gcc": 5, "clang": "3.9", + "msvc": "190", "Visual Studio": 14, }.get(str(self.settings.compiler)) @@ -49,46 +57,46 @@ def config_options(self): self.options.http_transport = "socket" def build_requirements(self): - self.build_requires("ninja/1.10.2") - self.build_requires("gn/cci.20210429") + self.tool_requires("ninja/1.10.2") + self.tool_requires("gn/cci.20210429") def requirements(self): # FIXME: use mini_chromium conan package instead of embedded package (if possible) - self.requires("zlib/1.2.12") + self.requires("zlib/[>=1.2.12 <2]") if self.settings.os in ("Linux", "FreeBSD"): self.requires("linux-syscall-support/cci.20200813") if self.options.http_transport != "socket": del self.options.with_tls if self.options.http_transport == "libcurl": - self.requires("libcurl/7.82.0") + self.requires("libcurl/[>=7.78 <9]") if self.options.get_safe("with_tls") == "openssl": - self.requires("openssl/1.1.1o") + self.requires("openssl/[>=1.1 <4]") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): if self.options.http_transport in ("libcurl", "socket"): raise ConanInvalidConfiguration("http_transport={} is not valid when building with Visual Studio".format(self.options.http_transport)) if self.options.http_transport == "libcurl": - if not self.options["libcurl"].shared: + if not self.dependencies["libcurl"].options.shared: # FIXME: is this true? - self.output.warn("crashpad needs a shared libcurl library") + self.output.warning("crashpad needs a shared libcurl library") min_compiler_version = self._minimum_compiler_cxx14() if min_compiler_version: - if tools.Version(self.settings.compiler.version) < min_compiler_version: + if Version(self.settings.compiler.version) < min_compiler_version: raise ConanInvalidConfiguration("crashpad needs a c++14 capable compiler, version >= {}".format(min_compiler_version)) else: - self.output.warn("This recipe does not know about the current compiler and assumes it has sufficient c++14 supports.") + self.output.warning("This recipe does not know about the current compiler and assumes it has sufficient c++14 supports.") if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version]["crashpad"], destination=self._source_subfolder, strip_root=True) - tools.get(**self.conan_data["sources"][self.version]["mini_chromium"], - destination=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium"), strip_root=True) + get(self, **self.conan_data["sources"][self.version]["crashpad"], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["mini_chromium"], + destination=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium"), strip_root=True) @property def _gn_os(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): if self.settings.os == "Macos": return "mac" else: @@ -105,31 +113,18 @@ def _gn_arch(self): "x86": "x86", }.get(str(self.settings.arch), str(self.settings.arch)) - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - yield - else: - env_defaults = {} - if self.settings.compiler == "gcc": - env_defaults.update({ - "CC": "gcc", - "CXX": "g++", - "LD": "g++", - }) - elif self.settings.compiler in ("clang", "apple-clang"): - env_defaults.update({ - "CC": "clang", - "CXX": "clang++", - "LD": "clang++", - }) - env = {} - for key, value in env_defaults.items(): - if not tools.get_env(key): - env[key] = value - with tools.environment_append(env): - yield + def generate(self): + VCVars(self).generate() + env = Environment() + if self.settings.compiler == "gcc": + env.define("CC", "gcc") + env.define("CXX", "g++") + env.define("LD", "g++") + elif str(self.settings.compiler) in ("clang", "apple-clang"): + env.define("CC", "clang") + env.define("CXX", "clang++") + env.define("LD", "clang++") + env.vars(self).save_script("conanbuild_gn") @property def _http_transport_impl(self): @@ -138,40 +133,31 @@ def _http_transport_impl(self): else: return str(self.options.http_transport) - def _version_greater_equal_to_cci_20220219(self): - return self.version >= "cci.20220219" - - def _has_separate_util_net_lib(self): - return self._version_greater_equal_to_cci_20220219() - - def _needs_to_link_tool_support(self): - return self._version_greater_equal_to_cci_20220219() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "third_party", "zlib", "BUILD.gn"), + if is_msvc(self): + replace_in_file(self, os.path.join(self.source_folder, "third_party", "zlib", "BUILD.gn"), "libs = [ \"z\" ]", - "libs = [ {} ]".format(", ".join("\"{}.lib\"".format(l) for l in self.deps_cpp_info["zlib"].libs))) + "libs = [ \"zlib.lib\" ]") if self.settings.compiler == "gcc": - toolchain_path = os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "build", "config", "BUILD.gn") + toolchain_path = os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "build", "config", "BUILD.gn") # Remove gcc-incompatible compiler arguments for comp_arg in ("-Wheader-hygiene", "-Wnewline-eof", "-Wstring-conversion", "-Wexit-time-destructors", "-fobjc-call-cxx-cdtors", "-Wextra-semi", "-Wimplicit-fallthrough"): - tools.replace_in_file(toolchain_path, - "\"{}\"".format(comp_arg), "\"\"") + replace_in_file(self, toolchain_path, "\"{}\"".format(comp_arg), "\"\"") + + deps = AutotoolsDeps(self).vars() + tc = AutotoolsToolchain(self).vars() + def _get_flags(name): + return [f for f in filter(None, [tc.get(name), deps.get(name)])] - autotools = AutoToolsBuildEnvironment(self) - extra_cflags = autotools.flags + ["-D{}".format(d) for d in autotools.defines] + extra_cflags = _get_flags("CPPFLAGS") extra_cflags_c = [] - extra_cflags_cc = autotools.cxx_flags - extra_ldflags = autotools.link_flags + extra_cflags_cc = _get_flags("CXXFLAGS") + extra_ldflags = _get_flags("LDFLAGS") + _get_flags("LIBS") if self.options.get_safe("fPIC"): extra_cflags.append("-fPIC") - extra_cflags.extend("-I {}".format(inc) for inc in autotools.include_paths) - extra_ldflags.extend("-{}{}".format("LIBPATH:" if self.settings.compiler == "Visual Studio" else "L ", libdir) for libdir in autotools.library_paths) if self.settings.compiler == "clang": if self.settings.compiler.get_safe("libcxx"): stdlib = { @@ -190,47 +176,46 @@ def build(self): "extra_cflags_cc=\\\"{}\\\"".format(" ".join(extra_cflags_cc)), "extra_ldflags=\\\"{}\\\"".format(" ".join(extra_ldflags)), ] - with tools.chdir(self._source_subfolder): - with self._build_context(): - self.run("gn gen out/Default --args=\"{}\"".format(" ".join(gn_args)), run_environment=True) - targets = ["client", "minidump", "crashpad_handler", "snapshot"] - if self.settings.os == "Windows": - targets.append("crashpad_handler_com") - self.run("ninja -C out/Default {targets} -j{parallel}".format( - targets=" ".join(targets), - parallel=tools.cpu_count()), run_environment=True) + with chdir(self, self.source_folder): + self.run("gn gen out/Default --args=\"{}\"".format(" ".join(gn_args))) + targets = ["client", "minidump", "crashpad_handler", "snapshot"] + if self.settings.os == "Windows": + targets.append("crashpad_handler_com") + self.run("ninja -C out/Default {targets} -j{parallel}".format( + targets=" ".join(targets), + parallel=os.cpu_count())) def lib_filename(name): - prefix, suffix = ("", ".lib") if self.settings.compiler == "Visual Studio" else ("lib", ".a") + prefix, suffix = ("", ".lib") if is_msvc(self) else ("lib", ".a") return "{}{}{}".format(prefix, name, suffix) - tools.rename(os.path.join(self._source_subfolder, "out", "Default", "obj", "client", lib_filename("common")), - os.path.join(self._source_subfolder, "out", "Default", "obj", "client", lib_filename("client_common"))) - tools.rename(os.path.join(self._source_subfolder, "out", "Default", "obj", "handler", lib_filename("common")), - os.path.join(self._source_subfolder, "out", "Default", "obj", "handler", lib_filename("handler_common"))) + rename(self, os.path.join(self.source_folder, "out", "Default", "obj", "client", lib_filename("common")), + os.path.join(self.source_folder, "out", "Default", "obj", "client", lib_filename("client_common"))) + rename(self, os.path.join(self.source_folder, "out", "Default", "obj", "handler", lib_filename("common")), + os.path.join(self.source_folder, "out", "Default", "obj", "handler", lib_filename("handler_common"))) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "client"), dst=os.path.join("include", "client")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "util"), dst=os.path.join("include", "util")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "base"), dst=os.path.join("include", "base")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "third_party", "mini_chromium", "mini_chromium", "build"), dst=os.path.join("include", "build")) - self.copy("*.h", src=os.path.join(self._source_subfolder, "out", "Default", "gen", "build"), dst=os.path.join("include", "build")) + copy(self, "*.h", src=os.path.join(self.source_folder, "client"), dst=os.path.join(self.package_folder, "include", "client")) + copy(self, "*.h", src=os.path.join(self.source_folder, "util"), dst=os.path.join(self.package_folder, "include", "util")) + copy(self, "*.h", src=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "base"), dst=os.path.join(self.package_folder, "include", "base")) + copy(self, "*.h", src=os.path.join(self.source_folder, "third_party", "mini_chromium", "mini_chromium", "build"), dst=os.path.join(self.package_folder, "include", "build")) + copy(self, "*.h", src=os.path.join(self.source_folder, "out", "Default", "gen", "build"), dst=os.path.join(self.package_folder, "include", "build")) - self.copy("*.a", src=os.path.join(self._source_subfolder, "out", "Default"), dst="lib", keep_path=False) + copy(self, "*.a", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) - self.copy("*.lib", src=os.path.join(self._source_subfolder, "out", "Default"), dst="lib", keep_path=False) - self.copy("crashpad_handler", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) - self.copy("crashpad_handler.exe", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) - self.copy("crashpad_handler_com.com", src=os.path.join(self._source_subfolder, "out", "Default"), dst="bin", keep_path=False) + copy(self, "*.lib", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "crashpad_handler", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "crashpad_handler.exe", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "crashpad_handler_com.com", src=os.path.join(self.source_folder, "out", "Default"), dst=os.path.join(self.package_folder, "bin"), keep_path=False) if self.settings.os == "Windows": - tools.rename(os.path.join(self.package_folder, "bin", "crashpad_handler_com.com"), + rename(self, os.path.join(self.package_folder, "bin", "crashpad_handler_com.com"), os.path.join(self.package_folder, "bin", "crashpad_handler.com")) # Remove accidentally copied libraries. These are used by the executables, not by the libraries. - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*getopt*") + rm(self, "*getopt*", os.path.join(self.package_folder, "lib"), recursive=True) - tools.save(os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake"), + save(self, os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake"), textwrap.dedent("""\ if(TARGET crashpad::mini_chromium_base) target_compile_features(crashpad::mini_chromium_base INTERFACE cxx_std_14) @@ -239,9 +224,9 @@ def package(self): def package_info(self): self.cpp_info.components["mini_chromium_base"].libs = ["base"] - self.cpp_info.components["mini_chromium_base"].build_modules = [os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake")] + self.cpp_info.set_property("cmake_build_modules", [os.path.join(self.package_folder, "lib", "cmake", "crashpad-cxx.cmake")]) self.cpp_info.components["mini_chromium_base"].builddirs = [os.path.join("lib", "cmake")] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): if self.settings.os == "Macos": self.cpp_info.components["mini_chromium_base"].frameworks = ["ApplicationServices", "CoreFoundation", "Foundation", "IOKit", "Security"] else: # iOS @@ -249,7 +234,7 @@ def package_info(self): self.cpp_info.components["util"].libs = ["util"] self.cpp_info.components["util"].requires = ["mini_chromium_base", "zlib::zlib"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["util"].libs.append("mig_output") if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["util"].libs.append("compat") @@ -277,7 +262,7 @@ def package_info(self): self.cpp_info.components["snapshot"].libs = ["snapshot"] self.cpp_info.components["snapshot"].requires = ["context", "client_common", "mini_chromium_base", "util"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["snapshot"].frameworks.extend(["OpenCL"]) self.cpp_info.components["format"].libs = ["format"] @@ -286,15 +271,11 @@ def package_info(self): self.cpp_info.components["minidump"].libs = ["minidump"] self.cpp_info.components["minidump"].requires = ["snapshot", "mini_chromium_base", "util"] - extra_handler_common_req = [] - if self._has_separate_util_net_lib(): - self.cpp_info.components["net"].libs = ["net"] - extra_handler_common_req = ["net"] + self.cpp_info.components["net"].libs = ["net"] + extra_handler_common_req = ["net"] - extra_handler_req = [] - if self._needs_to_link_tool_support(): - self.cpp_info.components["tool_support"].libs = ["tool_support"] - extra_handler_req = ["tool_support"] + self.cpp_info.components["tool_support"].libs = ["tool_support"] + extra_handler_req = ["tool_support"] self.cpp_info.components["handler_common"].libs = ["handler_common"] self.cpp_info.components["handler_common"].requires = ["client_common", "snapshot", "util"] + extra_handler_common_req @@ -303,5 +284,4 @@ def package_info(self): self.cpp_info.components["handler"].requires = ["client", "util", "handler_common", "minidump", "snapshot"] + extra_handler_req 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/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch b/recipes/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch deleted file mode 100644 index fa25c29585519..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0001-fix-openssl-link-order.patch +++ /dev/null @@ -1,23 +0,0 @@ -Order of ssl and crypto is wrong (first ssl, then crypto) ---- util/BUILD.gn -+++ util/BUILD.gn -@@ -402,8 +402,8 @@ - deps += [ "//third_party/boringssl" ] - } else { - libs = [ -- "crypto", - "ssl", -+ "crypto", - ] - } - } -@@ -670,8 +670,8 @@ - deps += [ "//third_party/boringssl" ] - } else { - libs = [ -- "crypto", - "ssl", -+ "crypto", - ] - } - } diff --git a/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch b/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch deleted file mode 100644 index dbe02c56b50c4..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0002-remove-fPIC-Werror-LTO.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -103,7 +103,7 @@ - } - } else if (mini_chromium_is_win) { - cflags = [ -- "/GL", # LTCG. -+ # LTCG. - "/O2", - "/Ob2", # Both explicit and auto inlining. - "/Oy-", # Disable omitting frame pointers, must be after /O2. -@@ -113,9 +113,9 @@ - ldflags = [ - "/OPT:ICF", - "/OPT:REF", -- "/LTCG", -+ - ] -- arflags = [ "/LTCG" ] -+ arflags = [ ] - } - } - -@@ -128,7 +128,7 @@ - cflags = [ - "-Wall", - "-Wendif-labels", -- "-Werror", -+ - "-Wextra", - "-Wextra-semi", - "-Wheader-hygiene", -@@ -239,7 +239,7 @@ - "/D_UNICODE", - "/FS", - "/W4", -- "/WX", -+ - "/Zi", - "/bigobj", # Support larger number of sections in obj file. - "/wd4100", # Unreferenced formal parameter. -@@ -319,7 +319,7 @@ - - if ((mini_chromium_is_posix && !mini_chromium_is_mac && - !mini_chromium_is_ios) || mini_chromium_is_fuchsia) { -- cflags += [ "-fPIC" ] -+ - ldflags += [ - # This must follow Fuchsia’s fdio library above. - "-Wl,--as-needed", ---- third_party/mini_chromium/mini_chromium/build/common.gypi -+++ third_party/mini_chromium/mini_chromium/build/common.gypi -@@ -124,7 +124,7 @@ - - ['OS=="linux" or OS=="android"', { - 'cflags': [ -- '-fPIC', -+ - '-fno-exceptions', - '-fno-strict-aliasing', # See http://crbug.com/32204 - '-fstack-protector-all', # Implies -fstack-protector -@@ -148,7 +148,7 @@ - '_FILE_OFFSET_BITS=64', - ], - 'ldflags': [ -- '-fPIC', -+ - '-pthread', - '-Wl,--as-needed', - '-Wl,-z,noexecstack', diff --git a/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch b/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch deleted file mode 100644 index 3d2fca3db7ec9..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0003-compilers-from-env.patch +++ /dev/null @@ -1,14 +0,0 @@ -Allow compiling crashpad with gcc (fetch compiler from environment variables) ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -393,8 +393,8 @@ - ar = rebase_path(clang_path, root_build_dir) + "/bin/llvm-ar" - ld = cxx - } else { -- cc = "clang" -- cxx = "clang++" -+ cc = getenv("CC") -+ cxx = getenv("CXX") - asm = cxx - ld = cxx - diff --git a/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch b/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch deleted file mode 100644 index 849ed17734c92..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0004-use-conan-linux-syscall-support-package.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- third_party/lss/lss.h -+++ third_party/lss/lss.h -@@ -16,9 +16,9 @@ - #define CRASHPAD_THIRD_PARTY_LSS_LSS_H_ - - #if defined(CRASHPAD_LSS_SOURCE_EXTERNAL) --#include "third_party/lss/linux_syscall_support.h" -+#include - #elif defined(CRASHPAD_LSS_SOURCE_EMBEDDED) --#include "third_party/lss/lss/linux_syscall_support.h" -+#include - #else - #error Unknown lss source - #endif diff --git a/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch b/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch deleted file mode 100644 index ae7425fb742f1..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0005-allow-all-archs.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -+++ third_party/mini_chromium/mini_chromium/build/config/BUILD.gn -@@ -193,7 +193,7 @@ - "arm64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - } - -@@ -268,7 +268,7 @@ - "-m64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - - # This is currently required by the clang toolchain build that DEPS uses -@@ -302,7 +302,7 @@ - } else if (target_cpu == "x64") { - common_flags += [ "--target=x86_64-fuchsia" ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - - # fdio is listed in ldflags instead of libs because it’s important for it to ---- util/BUILD.gn -+++ util/BUILD.gn -@@ -145,7 +145,7 @@ if (crashpad_is_mac || crashpad_is_ios) { - "arm64", - ] - } else { -- assert(false, "Unsupported architecture") -+ print("Unknown architecture -> assume conan knows how to handle it") - } - } - diff --git a/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch b/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch deleted file mode 100644 index be8423bbda8e1..0000000000000 --- a/recipes/crashpad/all/patches/cci.20210507-0006-mini_chromium-win_helper-py3.patch +++ /dev/null @@ -1,96 +0,0 @@ ---- third_party/mini_chromium/mini_chromium/build/win_helper.py -+++ third_party/mini_chromium/mini_chromium/build/win_helper.py -@@ -4,7 +4,10 @@ - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. - --import _winreg -+try: -+ import _winreg -+except ImportError: -+ import winreg as _winreg - import os - import re - import subprocess -@@ -62,7 +65,7 @@ - CreateProcess() documentation for more details.""" - block = '' - nul = '\0' -- for key, value in envvar_dict.iteritems(): -+ for key, value in envvar_dict.items(): - block += key + '=' + value + nul - block += nul - return block -@@ -81,7 +84,7 @@ - archs = ('x86', 'amd64', 'arm64') - result = [] - for arch in archs: -- # Extract environment variables for subprocesses. -+ sys.stderr.write("install_dir {} script_path {}".format(install_dir, script_path)) - args = [os.path.join(install_dir, script_path)] - script_arch_name = arch - if script_path.endswith('SetEnv.cmd') and arch == 'amd64': -@@ -94,12 +97,12 @@ - variables, _ = popen.communicate() - if popen.returncode != 0: - raise Exception('"%s" failed with error %d' % (args, popen.returncode)) -- env = _ExtractImportantEnvironment(variables) -+ env = _ExtractImportantEnvironment(variables.decode()) - - env_block = _FormatAsEnvironmentBlock(env) - basename = 'environment.' + arch - with open(os.path.join(out_dir, basename), 'wb') as f: -- f.write(env_block) -+ f.write(env_block.encode()) - result.append(basename) - return result - -@@ -139,10 +142,10 @@ - link = subprocess.Popen(args, env=env, shell=True, stdout=subprocess.PIPE) - out, _ = link.communicate() - for line in out.splitlines(): -- if (not line.startswith(' Creating library ') and -- not line.startswith('Generating code') and -- not line.startswith('Finished generating code')): -- print line -+ if (not line.startswith(b' Creating library ') and -+ not line.startswith(b'Generating code') and -+ not line.startswith(b'Finished generating code')): -+ print(line) - return link.returncode - - def ExecAsmWrapper(self, arch, *args): -@@ -152,11 +155,11 @@ - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - out, _ = popen.communicate() - for line in out.splitlines(): -- if (not line.startswith('Copyright (C) Microsoft Corporation') and -- not line.startswith('Microsoft (R) Macro Assembler') and -- not line.startswith(' Assembling: ') and -+ if (not line.startswith(b'Copyright (C) Microsoft Corporation') and -+ not line.startswith(b'Microsoft (R) Macro Assembler') and -+ not line.startswith(b' Assembling: ') and - line): -- print line -+ print(line) - return popen.returncode - - def ExecGetVisualStudioData(self, outdir, toolchain_path): -@@ -178,7 +181,7 @@ - 'Microsoft Visual Studio', 'Installer', 'vswhere.exe') - if os.path.exists(vswhere_path): - installation_path = subprocess.check_output( -- [vswhere_path, '-latest', '-property', 'installationPath']).strip() -+ [vswhere_path, '-latest', '-property', 'installationPath']).strip().decode() - if installation_path: - return (installation_path, - os.path.join('VC', 'Auxiliary', 'Build', 'vcvarsall.bat')) -@@ -207,7 +210,7 @@ - x86_environment_file = "%s" - x64_environment_file = "%s" - arm64_environment_file = "%s"''' % (install_dir, x86_file, x64_file, arm64_file) -- print result -+ print(result) - return 0 - - def ExecStamp(self, path): diff --git a/recipes/crashpad/all/test_package/CMakeLists.txt b/recipes/crashpad/all/test_package/CMakeLists.txt index 6c1d84c7e3d82..371eb858142f4 100644 --- a/recipes/crashpad/all/test_package/CMakeLists.txt +++ b/recipes/crashpad/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(crashpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE crashpad::crashpad) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/crashpad/all/test_package/conanfile.py b/recipes/crashpad/all/test_package/conanfile.py index a0d87c14b0333..46a8950cd70ed 100644 --- a/recipes/crashpad/all/test_package/conanfile.py +++ b/recipes/crashpad/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.files import mkdir, save, load import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + 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 generate(self): + save(self, os.path.join(self.generators_folder, "bindir"), + os.path.join(self.dependencies["crashpad"].package_folder, "bin")) def build(self): cmake = CMake(self) @@ -12,14 +26,14 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): test_env_dir = "test_env" - tools.mkdir(test_env_dir) - bin_path = os.path.join("bin", "test_package") - handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" - handler_bin_path = os.path.join(self.deps_cpp_info["crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + bindir = load(self, os.path.join(self.generators_folder, "bindir")) + handler_exe = "crashpad_handler" + (".exe" if self.settings.os == "Windows" else "") + handler_bin_path = os.path.join(bindir, handler_exe) + self.run(f"{bin_path} {test_env_dir}/db {handler_bin_path}", env="conanrun") if self.settings.os == "Windows": - handler_exe = "crashpad_handler.com" - handler_bin_path = os.path.join(self.deps_cpp_info["crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + handler_bin_path = os.path.join(bindir, "crashpad_handler.com") + self.run(f"{bin_path} {test_env_dir}/db {handler_bin_path}", env="conanrun") diff --git a/recipes/crashpad/config.yml b/recipes/crashpad/config.yml index 104465b6c7315..63942e1b1104b 100644 --- a/recipes/crashpad/config.yml +++ b/recipes/crashpad/config.yml @@ -1,5 +1,3 @@ versions: - "cci.20210507": - folder: all "cci.20220219": folder: all