diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/coroutine | |
Diffstat (limited to 'vcpkg/ports/coroutine')
| -rw-r--r-- | vcpkg/ports/coroutine/add-noexcept-to-frame.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/coroutine/fix-errorC7651.patch | 68 | ||||
| -rw-r--r-- | vcpkg/ports/coroutine/gsl-4_0_0.patch | 80 | ||||
| -rw-r--r-- | vcpkg/ports/coroutine/portfile.cmake | 32 | ||||
| -rw-r--r-- | vcpkg/ports/coroutine/vcpkg.json | 19 |
5 files changed, 212 insertions, 0 deletions
diff --git a/vcpkg/ports/coroutine/add-noexcept-to-frame.patch b/vcpkg/ports/coroutine/add-noexcept-to-frame.patch new file mode 100644 index 0000000..fe5c6c6 --- /dev/null +++ b/vcpkg/ports/coroutine/add-noexcept-to-frame.patch @@ -0,0 +1,13 @@ +--- a/interface/coroutine/frame.h
++++ a/interface/coroutine/frame.h
+@@ -119,8 +119,8 @@
+ return *this;
+ }
+ // 17.12.3.2, export/import
+- static /*constexpr*/ coroutine_handle from_address(void* _Addr) {
++ static /*constexpr*/ coroutine_handle from_address(void* _Addr) noexcept {
+ coroutine_handle _Result{};
+ _Result._Ptr = reinterpret_cast<portable_coro_prefix*>(_Addr);
+ return _Result;
+ }
+
diff --git a/vcpkg/ports/coroutine/fix-errorC7651.patch b/vcpkg/ports/coroutine/fix-errorC7651.patch new file mode 100644 index 0000000..42c4291 --- /dev/null +++ b/vcpkg/ports/coroutine/fix-errorC7651.patch @@ -0,0 +1,68 @@ +diff --git a/modules/portable/frame.cpp b/modules/portable/frame.cpp +index 2cedf81..f413f28 100644 +--- a/modules/portable/frame.cpp ++++ b/modules/portable/frame.cpp +@@ -77,13 +77,31 @@ size_t _coro_done(void*); + // + // intrinsic: Clang/GCC + // +-extern "C" { +-bool __builtin_coro_done(void*); +-void __builtin_coro_resume(void*); +-void __builtin_coro_destroy(void*); +-// void* __builtin_coro_promise(void* ptr, int align, bool p); ++//extern "C" { ++template <bool B> ++void resume_wrapper(void *p) ++{ ++ if constexpr (B) ++ __builtin_coro_resume(p); ++} ++ ++template <bool B> ++void destroy_wrapper(void *p) ++{ ++ if constexpr(B) ++ __builtin_coro_destroy(p); + } + ++template <bool B> ++bool done_wrapper(void *p) ++{ ++ if constexpr(B) ++ return __builtin_coro_done(p); ++ return false; ++} ++// void* __builtin_coro_promise(void* ptr, int align, bool p); ++//} ++ + bool _coro_finished(portable_coro_prefix* _Handle); + + #if defined(__clang__) +@@ -124,7 +142,7 @@ bool portable_coro_done(portable_coro_prefix* _Handle) { + if constexpr (is_msvc) { + return _coro_finished(_Handle); + } else if constexpr (is_clang) { +- return __builtin_coro_done(_Handle); ++ return done_wrapper<true>(_Handle); + } + return false; // follow `noop_coroutine` + } +@@ -133,7 +151,7 @@ void portable_coro_resume(portable_coro_prefix* _Handle) { + if constexpr (is_msvc) { + _coro_resume(_Handle); + } else if constexpr (is_clang) { +- __builtin_coro_resume(_Handle); ++ resume_wrapper<true>(_Handle); + } + } + +@@ -141,7 +159,7 @@ void portable_coro_destroy(portable_coro_prefix* _Handle) { + if constexpr (is_msvc) { + _coro_destroy(_Handle); + } else if constexpr (is_clang) { +- __builtin_coro_destroy(_Handle); ++ destroy_wrapper<true>(_Handle); + } + } + diff --git a/vcpkg/ports/coroutine/gsl-4_0_0.patch b/vcpkg/ports/coroutine/gsl-4_0_0.patch new file mode 100644 index 0000000..466d3ff --- /dev/null +++ b/vcpkg/ports/coroutine/gsl-4_0_0.patch @@ -0,0 +1,80 @@ +diff --git a/interface/coroutine/net.h b/interface/coroutine/net.h +index 17b70a8..3c44827 100644 +--- a/interface/coroutine/net.h ++++ b/interface/coroutine/net.h +@@ -344,7 +344,7 @@ void poll_net_tasks(uint64_t nano) noexcept(false); + * @ingroup Network
+ */
+ uint32_t get_address(const addrinfo& hint, //
+- gsl::czstring<> host, gsl::czstring<> serv,
++ gsl::czstring host, gsl::czstring serv,
+ gsl::span<sockaddr_in> output) noexcept;
+
+ /**
+@@ -361,7 +361,7 @@ uint32_t get_address(const addrinfo& hint, // + * @ingroup Network
+ */
+ uint32_t get_address(const addrinfo& hint, //
+- gsl::czstring<> host, gsl::czstring<> serv,
++ gsl::czstring host, gsl::czstring serv,
+ gsl::span<sockaddr_in6> output) noexcept;
+
+ /**
+@@ -377,7 +377,7 @@ uint32_t get_address(const addrinfo& hint, // + * @ingroup Network
+ */
+ uint32_t get_name(const sockaddr_in& addr, //
+- gsl::zstring<NI_MAXHOST> name, gsl::zstring<NI_MAXSERV> serv,
++ gsl::basic_zstring<char, NI_MAXHOST> name, gsl::basic_zstring<char, NI_MAXSERV> serv,
+ int32_t flags = NI_NUMERICHOST | NI_NUMERICSERV) noexcept;
+
+ /**
+@@ -392,7 +392,7 @@ uint32_t get_name(const sockaddr_in& addr, // + * @ingroup Network
+ */
+ uint32_t get_name(const sockaddr_in6& addr, //
+- gsl::zstring<NI_MAXHOST> name, gsl::zstring<NI_MAXSERV> serv,
++ gsl::basic_zstring<char, NI_MAXHOST> name, gsl::basic_zstring<char, NI_MAXSERV> serv,
+ int32_t flags = NI_NUMERICHOST | NI_NUMERICSERV) noexcept;
+
+ } // namespace coro
+diff --git a/modules/net/resolver.cpp b/modules/net/resolver.cpp +index 21a9800..5328939 100644 +--- a/modules/net/resolver.cpp ++++ b/modules/net/resolver.cpp +@@ -9,7 +9,7 @@ namespace coro { +
+ GSL_SUPPRESS(type .1)
+ uint32_t get_name(const sockaddr_in& addr, //
+- gsl::zstring<NI_MAXHOST> name, gsl::zstring<NI_MAXSERV> serv,
++ gsl::basic_zstring<char, NI_MAXHOST> name, gsl::basic_zstring<char, NI_MAXSERV> serv,
+ int32_t flags) noexcept {
+ const auto* ptr = reinterpret_cast<const sockaddr*>(addressof(addr));
+ return ::getnameinfo(ptr, sizeof(sockaddr_in), //
+@@ -20,7 +20,7 @@ uint32_t get_name(const sockaddr_in& addr, // +
+ GSL_SUPPRESS(type .1)
+ uint32_t get_name(const sockaddr_in6& addr, //
+- gsl::zstring<NI_MAXHOST> name, gsl::zstring<NI_MAXSERV> serv,
++ gsl::basic_zstring<char, NI_MAXHOST> name, gsl::basic_zstring<char, NI_MAXSERV> serv,
+ int32_t flags) noexcept {
+ const auto* ptr = reinterpret_cast<const sockaddr*>(addressof(addr));
+ return ::getnameinfo(ptr, sizeof(sockaddr_in6), //
+@@ -58,7 +58,7 @@ auto get_address(addrinfo* list, sockaddr_in6 addr) noexcept + }
+
+ uint32_t get_address(const addrinfo& hint, //
+- gsl::czstring<> host, gsl::czstring<> serv,
++ gsl::czstring host, gsl::czstring serv,
+ gsl::span<sockaddr_in> output) noexcept {
+ addrinfo* list = nullptr;
+ if (const auto ec = ::getaddrinfo(host, serv, //
+@@ -74,7 +74,7 @@ uint32_t get_address(const addrinfo& hint, // + }
+
+ uint32_t get_address(const addrinfo& hint, //
+- gsl::czstring<> host, gsl::czstring<> serv,
++ gsl::czstring host, gsl::czstring serv,
+ gsl::span<sockaddr_in6> output) noexcept {
+ addrinfo* list = nullptr;
+ if (const auto ec = ::getaddrinfo(host, serv, //
diff --git a/vcpkg/ports/coroutine/portfile.cmake b/vcpkg/ports/coroutine/portfile.cmake new file mode 100644 index 0000000..fb349a2 --- /dev/null +++ b/vcpkg/ports/coroutine/portfile.cmake @@ -0,0 +1,32 @@ +if(VCPKG_TARGET_IS_LINUX) + message("Warning: `coroutine` requires libc++ and Clang or GCC 10+ on Linux") +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO luncliff/coroutine + REF 1.5.0 + SHA512 61b91fdc641b6905b884e99c5bf193ec2cf6962144ab3baafdb9432115757d96f3797f116b30356f0d21417b23082bc908f75042721caeab3329c4910b654594 + HEAD_REF master + PATCHES + fix-errorC7651.patch + add-noexcept-to-frame.patch + gsl-4_0_0.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DGSL_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include" + -DBUILD_TESTING=False +) +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() + +file(INSTALL "${SOURCE_PATH}/LICENSE" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" + RENAME copyright +) +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/vcpkg/ports/coroutine/vcpkg.json b/vcpkg/ports/coroutine/vcpkg.json new file mode 100644 index 0000000..cdae32b --- /dev/null +++ b/vcpkg/ports/coroutine/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "coroutine", + "version": "1.5.0", + "port-version": 5, + "description": "C++ 20 Coroutines helper/example library", + "homepage": "https://github.com/luncliff/coroutine", + "supports": "!uwp", + "dependencies": [ + "ms-gsl", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} |