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.
This commit is contained in:
Paweł Wegner 2023-02-21 17:23:41 +01:00 committed by GitHub
parent f31841cc46
commit f138027a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 113 additions and 30 deletions

View File

@ -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
}
/*

View File

@ -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@)

View File

@ -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)

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a38a19b569f3763e2e63957687d4af9dcf19bd3e",
"version-semver": "1.19.0",
"port-version": 0
},
{
"git-tree": "15542c1c419b7874a8d3229cdf6366361e376a57",
"version-semver": "1.18.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "670f02828b60f7a11c6b7a7feff0396d6cec4483",
"version": "1.8.2",
"port-version": 1
},
{
"git-tree": "387f253ff4ad8c0126733b10d8ffd3dc26a308e4",
"version": "1.8.2",