From f138027a708c8d9d01dab2dbca4d3b4a807b29e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Wegner?= Date: Tue, 21 Feb 2023 17:23:41 +0100 Subject: [PATCH] c-ares: bump to 1.19 and make it build on uwp. (#29342) * c-ares: bump to 1.19 and make it build on uwp. guard-imported-lib.patch got upstreamed, no longer necessary. * drogon: disable uwp support. It depends on c-ares which now supports uwp which means that this port needs to be explicitly disabled. --- ports/c-ares/fix-uwp.patch | 94 +++++++++++++++++++++++++++ ports/c-ares/guard-imported-lib.patch | 21 ------ ports/c-ares/portfile.cmake | 6 +- ports/c-ares/vcpkg.json | 4 +- ports/drogon/vcpkg.json | 2 + versions/baseline.json | 6 +- versions/c-/c-ares.json | 5 ++ versions/d-/drogon.json | 5 ++ 8 files changed, 113 insertions(+), 30 deletions(-) create mode 100644 ports/c-ares/fix-uwp.patch delete mode 100644 ports/c-ares/guard-imported-lib.patch diff --git a/ports/c-ares/fix-uwp.patch b/ports/c-ares/fix-uwp.patch new file mode 100644 index 0000000000..9c457639a1 --- /dev/null +++ b/ports/c-ares/fix-uwp.patch @@ -0,0 +1,94 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7a29fef..08ed974 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -225,6 +225,9 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it + ELSEIF (WIN32) + LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0600) ++ IF (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ++ LIST (APPEND SYSFLAGS -DWINRT) ++ ENDIF () + ENDIF () + ADD_DEFINITIONS(${SYSFLAGS}) + +diff --git a/src/lib/ares__addrinfo_localhost.c b/src/lib/ares__addrinfo_localhost.c +index 7940ecd..aacfa52 100644 +--- a/src/lib/ares__addrinfo_localhost.c ++++ b/src/lib/ares__addrinfo_localhost.c +@@ -131,7 +131,7 @@ static int ares__system_loopback_addrs(int aftype, + unsigned short port, + struct ares_addrinfo_node **nodes) + { +-#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 ++#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && !defined(WINRT) + PMIB_UNICASTIPADDRESS_TABLE table; + unsigned int i; + int status; +diff --git a/src/lib/ares_getaddrinfo.c b/src/lib/ares_getaddrinfo.c +index bc9f19b..1bb0e15 100644 +--- a/src/lib/ares_getaddrinfo.c ++++ b/src/lib/ares_getaddrinfo.c +@@ -467,8 +467,10 @@ static int file_lookup(struct host_query *hquery) + RegCloseKey(hkeyHosts); + } + } ++#ifndef WINRT + else if (platform == WIN_9X) + GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); ++#endif + else + return ARES_ENOTFOUND; + +diff --git a/src/lib/ares_gethostbyaddr.c b/src/lib/ares_gethostbyaddr.c +index c62d230..6d47328 100644 +--- a/src/lib/ares_gethostbyaddr.c ++++ b/src/lib/ares_gethostbyaddr.c +@@ -194,8 +194,10 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host) + RegCloseKey(hkeyHosts); + } + } ++#ifndef WINRT + else if (platform == WIN_9X) + GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); ++#endif + else + return ARES_ENOTFOUND; + +diff --git a/src/lib/ares_gethostbyname.c b/src/lib/ares_gethostbyname.c +index 8c71cc6..3954244 100644 +--- a/src/lib/ares_gethostbyname.c ++++ b/src/lib/ares_gethostbyname.c +@@ -278,8 +278,10 @@ static int file_lookup(const char *name, int family, struct hostent **host) + RegCloseKey(hkeyHosts); + } + } ++#ifndef WINRT + else if (platform == WIN_9X) + GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); ++#endif + else + return ARES_ENOTFOUND; + +diff --git a/src/lib/ares_init.c b/src/lib/ares_init.c +index 3f9cec6..63143e0 100644 +--- a/src/lib/ares_init.c ++++ b/src/lib/ares_init.c +@@ -745,6 +745,9 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ + const SOCKADDR_INET * const dest, + const ULONG interfaceMetric) + { ++#ifdef WINRT ++ return (ULONG)-1; ++#else + /* On this interface, get the best route to that destination. */ + MIB_IPFORWARD_ROW2 row; + SOCKADDR_INET ignored; +@@ -778,6 +781,7 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ + * which describes the combination as a "sum". + */ + return row.Metric + interfaceMetric; ++#endif + } + + /* diff --git a/ports/c-ares/guard-imported-lib.patch b/ports/c-ares/guard-imported-lib.patch deleted file mode 100644 index 8cb0de4dd6..0000000000 --- a/ports/c-ares/guard-imported-lib.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/c-ares-config.cmake.in b/c-ares-config.cmake.in -index 464837b..b3c2bc4 100644 ---- a/c-ares-config.cmake.in -+++ b/c-ares-config.cmake.in -@@ -8,12 +8,16 @@ include("${CMAKE_CURRENT_LIST_DIR}/c-ares-targets.cmake") - set(c-ares_LIBRARY c-ares::cares) - - if(@CARES_SHARED@) -+ if(NOT TARGET c-ares::cares_shared) - add_library(c-ares::cares_shared INTERFACE IMPORTED) - set_target_properties(c-ares::cares_shared PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares") -+ endif() - set(c-ares_SHARED_LIBRARY c-ares::cares_shared) - elseif(@CARES_STATIC@) -+ if(NOT TARGET c-ares::cares_static) - add_library(c-ares::cares_static INTERFACE IMPORTED) - set_target_properties(c-ares::cares_static PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares") -+ endif() - endif() - - if(@CARES_STATIC@) diff --git a/ports/c-ares/portfile.cmake b/ports/c-ares/portfile.cmake index 9e8f9d8525..de452e883e 100644 --- a/ports/c-ares/portfile.cmake +++ b/ports/c-ares/portfile.cmake @@ -1,12 +1,12 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO c-ares/c-ares - REF cares-1_18_1 - SHA512 9f5f9d5a22a4643aef8701c4abfd4b28e0bded2479bab462d2dfc63a8f84348f02d3cfbd7c85cc1e06a154a3e4206721cb6669c7c61538ecdcd44268e4ce073e + REF cares-1_19_0 + SHA512 d6bd7183b9ddf418222357ca61e3ffe0a3e49cbd5d83046bb76146e23bb578b5c7e4a5d89e1c427e7163880323de8ee0962ba75c571102efdf8c0b5742e28f82 HEAD_REF main PATCHES avoid-docs.patch - guard-imported-lib.patch + fix-uwp.patch ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) diff --git a/ports/c-ares/vcpkg.json b/ports/c-ares/vcpkg.json index 488c5645ae..2b9fde05d5 100644 --- a/ports/c-ares/vcpkg.json +++ b/ports/c-ares/vcpkg.json @@ -1,11 +1,9 @@ { "name": "c-ares", - "version-semver": "1.18.1", - "port-version": 1, + "version-semver": "1.19.0", "description": "A C library for asynchronous DNS requests", "homepage": "https://github.com/c-ares/c-ares", "license": "MIT-CMU", - "supports": "!uwp", "dependencies": [ { "name": "vcpkg-cmake", diff --git a/ports/drogon/vcpkg.json b/ports/drogon/vcpkg.json index e099d3be52..1958ecfcc8 100644 --- a/ports/drogon/vcpkg.json +++ b/ports/drogon/vcpkg.json @@ -1,10 +1,12 @@ { "name": "drogon", "version": "1.8.2", + "port-version": 1, "description": "A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows", "homepage": "https://github.com/an-tao/drogon", "documentation": "https://drogon.docsforge.com/master/overview/", "license": "MIT", + "supports": "!uwp", "dependencies": [ "brotli", "jsoncpp", diff --git a/versions/baseline.json b/versions/baseline.json index 886326b751..3cc17990b6 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1281,8 +1281,8 @@ "port-version": 3 }, "c-ares": { - "baseline": "1.18.1", - "port-version": 1 + "baseline": "1.19.0", + "port-version": 0 }, "c-dbg-macro": { "baseline": "2020-02-29", @@ -2110,7 +2110,7 @@ }, "drogon": { "baseline": "1.8.2", - "port-version": 0 + "port-version": 1 }, "dstorage": { "baseline": "1.1.0", diff --git a/versions/c-/c-ares.json b/versions/c-/c-ares.json index e6098a33b1..b147cbda3d 100644 --- a/versions/c-/c-ares.json +++ b/versions/c-/c-ares.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a38a19b569f3763e2e63957687d4af9dcf19bd3e", + "version-semver": "1.19.0", + "port-version": 0 + }, { "git-tree": "15542c1c419b7874a8d3229cdf6366361e376a57", "version-semver": "1.18.1", diff --git a/versions/d-/drogon.json b/versions/d-/drogon.json index d6f61da68a..664109c6c0 100644 --- a/versions/d-/drogon.json +++ b/versions/d-/drogon.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "670f02828b60f7a11c6b7a7feff0396d6cec4483", + "version": "1.8.2", + "port-version": 1 + }, { "git-tree": "387f253ff4ad8c0126733b10d8ffd3dc26a308e4", "version": "1.8.2",