Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcoro: add version 0.11.1 #22764

Merged
merged 16 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions recipes/libcoro/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"0.11.1":
url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.11.1.tar.gz"
sha256: "c7eb1bf133519ec0e0bc2e3e018ac4d1447a143e5e7385dab19204277d7c7671"
"0.10":
url: "https://github.com/jbaldwin/libcoro/archive/refs/tags/v0.10.tar.gz"
sha256: "0e952e72012925b75910f80772f3642dac631644578dbbc0db4fee047badc745"
Expand All @@ -13,35 +16,23 @@
sha256: "ce1f3f1c4fa21b53d1cd195a29bd5a2313e53aa35637b402db04207d02316e51"
patches:
"0.10":
- patch_file: "patches/0.10-0001-allow-shared-lib.patch"
patch_type: "conan"
patch_description: "Allow to build the library as a shared library"
- patch_file: "patches/0.10-0002-disable-git-config.patch"
patch_type: "official"
patch_description: "Comment out invocation of git config command"
patch_source: "https://github.com/jbaldwin/libcoro/pull/234"
"0.9":
- patch_file: "patches/0.9-0001-allow-shared-lib.patch"
patch_type: "conan"
patch_description: "Allow to build the library as a shared library"
- patch_file: "patches/0.9-0002-disable-git-config.patch"
patch_type: "conan"
patch_description: "Comment out invocation of git config command"
- patch_file: "patches/0.9-0003-include-exception.patch"
patch_type: "backport"

Check warning on line 28 in recipes/libcoro/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 28)
patch_source: "https://github.com/jbaldwin/libcoro/pull/169"
patch_description: "include std headers"
"0.8":
- patch_file: "patches/0.8-0001-allow-shared-lib.patch"
patch_type: "conan"
patch_description: "Allow to build the library as a shared library"
- patch_file: "patches/0.8-0002-disable-git-config.patch"
patch_type: "conan"
patch_description: "Comment out invocation of git config command"
"0.7":
- patch_file: "patches/0.7-0001-allow-shared-lib.patch"
patch_type: "conan"
patch_description: "Allow to build the library as a shared library"
- patch_file: "patches/0.7-0002-disable-git-config.patch"
patch_type: "conan"
patch_description: "Comment out invocation of git config command"
Expand Down
42 changes: 30 additions & 12 deletions recipes/libcoro/all/conanfile.py
uilianries marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.microsoft import is_msvc
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.scm import Version
Expand Down Expand Up @@ -40,8 +41,12 @@ def _min_cppstd(self):
@property
def _minimum_compilers_version(self):
return {
"gcc": "10.2.1",
}
"gcc": "10.2.1",
"clang": "16.0.0",
"apple-clang": "16",
"Visual Studio": "16",
"msvc": "192",
}

def export_sources(self):
export_conandata_patches(self)
Expand All @@ -54,10 +59,15 @@ def config_options(self):
if Version(self.version) < "0.9":
del self.options.with_ssl
del self.options.with_threading
if is_msvc(self) or self.settings.os == "Emscripten":
self.options.rm_safe("with_networking")
self.options.rm_safe("with_ssl")

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if Version(self.version) < "0.11":
self.package_type = "static-library"

def layout(self):
cmake_layout(self, src_folder="src")
Expand All @@ -71,17 +81,21 @@ def requirements(self):
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
if self.settings.os not in ["Linux", "FreeBSD", "Macos"]:
raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.")
if self.settings.compiler != "gcc":
raise ConanInvalidConfiguration(f"The Conan recipe {self.ref} only supports GCC for now. Contributions are welcome!")
if Version(self.version) < "0.10":
if self.settings.os not in ["Linux", "FreeBSD", "Macos"]:
raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.")
if self.settings.compiler != "gcc":
raise ConanInvalidConfiguration(f"The Conan recipe {self.ref} only supports GCC for now. Contributions are welcome!")

minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

if Version(self.version) < "0.11" and self.options.shared:
raise ConanInvalidConfiguration(f"{self.ref} Only supports shared linking for versions >=0.11")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

Expand All @@ -91,10 +105,14 @@ def generate(self):
tc.variables["LIBCORO_BUILD_EXAMPLES"] = False
if Version(self.version) >= "0.8":
tc.variables["LIBCORO_EXTERNAL_DEPENDENCIES"] = True
tc.variables["LIBCORO_FEATURE_NETWORKING"] = self.options.with_networking
tc.variables["LIBCORO_FEATURE_NETWORKING"] = self.options.get_safe("with_networking")
if Version(self.version) >= "0.9":
tc.variables["LIBCORO_FEATURE_THREADING"] = self.options.with_threading
tc.variables["LIBCORO_FEATURE_SSL"] = self.options.with_ssl
tc.variables["LIBCORO_FEATURE_SSL"] = self.options.get_safe("with_ssl", False)
if Version(self.version) >= "0.11":
tc.variables["LIBCORO_RUN_GITCONFIG"] = False
tc.variables["LIBCORO_BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["LIBCORO_FEATURE_TLS"] = self.options.get_safe("with_ssl", False)
tc.generate()
deps = CMakeDeps(self)
deps.generate()
Expand All @@ -115,16 +133,16 @@ def package_info(self):
self.cpp_info.set_property("cmake_file_name", "libcoro")
self.cpp_info.set_property("cmake_target_name", "libcoro::libcoro")
if Version(self.version) >= "0.8":
self.cpp_info.libs = ["coro"]
self.cpp_info.libs = ["libcoro"] if is_msvc(self) else ["coro"]
else:
self.cpp_info.libs = ["libcoro"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["pthread", "m"]

if Version(self.version) >= "0.9":
if self.options.with_networking:
if self.options.get_safe("with_networking"):
self.cpp_info.defines.append("LIBCORO_FEATURE_NETWORKING")
if self.options.with_ssl:
self.cpp_info.defines.append("LIBCORO_FEATURE_SSL")
if self.options.get_safe("with_ssl"):
self.cpp_info.defines.extend(["LIBCORO_FEATURE_SSL", "LIBCORO_FEATURE_TLS"])
if self.options.with_threading:
self.cpp_info.defines.append("LIBCORO_FEATURE_THREADING")
13 changes: 0 additions & 13 deletions recipes/libcoro/all/patches/0.10-0001-allow-shared-lib.patch

This file was deleted.

9 changes: 0 additions & 9 deletions recipes/libcoro/all/patches/0.7-0001-allow-shared-lib.patch

This file was deleted.

13 changes: 0 additions & 13 deletions recipes/libcoro/all/patches/0.8-0001-allow-shared-lib.patch

This file was deleted.

13 changes: 0 additions & 13 deletions recipes/libcoro/all/patches/0.9-0001-allow-shared-lib.patch

This file was deleted.

2 changes: 2 additions & 0 deletions recipes/libcoro/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"0.11.1":
folder: all
"0.10":
folder: all
"0.9":
Expand Down
Loading