games-strategy/0ad: Fix compatibility with miniupnpc 2.2.8 with patch

Thanks to Torsten Kaiser for the patch.

Closes: https://bugs.gentoo.org/934315
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
This commit is contained in:
James Le Cuirot
2024-06-16 23:33:50 +01:00
parent de017a0800
commit 57d4ce1472
2 changed files with 39 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ PATCHES=(
"${FILESDIR}"/${P}-libxml2-2.12.patch
# https://code.wildfiregames.com/D5267
"${FILESDIR}"/${P}-boost-1.85.patch
"${FILESDIR}"/${P}-miniupnpc.patch
)
pkg_setup() {

View File

@@ -0,0 +1,38 @@
Adapt to changes from API 18
https://github.com/miniupnp/miniupnp/commit/c0a50ce33e3b99ce8a96fd43049bb5b53ffac62f
https://bugs.gentoo.org/934315
--- a/source/network/NetServer.cpp 2022-09-23 21:17:14.000000000 +0200
+++ a/source/network/NetServer.cpp 2024-06-14 21:43:26.572418719 +0200
@@ -302,7 +302,11 @@
else if ((devlist = upnpDiscover(10000, 0, 0, 0, 0, 0)) != NULL)
#endif
{
+#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
+ ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress), NULL, 0);
+#else
ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress));
+#endif
allocatedUrls = ret != 0; // urls is allocated on non-zero return values
}
else
@@ -321,9 +325,18 @@
LOGMESSAGE("Net server: found valid IGD = %s", urls.controlURL);
break;
case 2:
+#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
+ LOGMESSAGE("Net server: found a valid IGD with a reserved address = %s, will try to continue anyway", urls.controlURL);
+ break;
+ case 3:
+ LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
+ break;
+ case 4:
+#else
LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
break;
case 3:
+#endif
LOGMESSAGE("Net server: found a UPnP device unrecognized as IGD = %s, will try to continue anyway", urls.controlURL);
break;
default: