games-strategy/s25rttr: Fix compatibility with miniupnpc 2.2.8 with patch

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
This commit is contained in:
James Le Cuirot
2024-06-16 21:27:40 +01:00
parent c02a77f4d0
commit 92aeba092b
2 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
From c7b6e56337cbb03d9ed3aa601cb6e79e7858249a Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sun, 16 Jun 2024 21:22:08 +0100
Subject: [PATCH] Support miniupnpc API version 18 (release 2.2.8) and adjust
status check
getValidIGD was treating non-zero return codes as successful, but only 1
should really be considered successful in this context.
This maintains compatibility with earlier versions.
---
libs/network/src/UPnP_Other.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/external/libutil/libs/network/src/UPnP_Other.cpp b/libs/network/src/UPnP_Other.cpp
index d684b9c..8fc9418 100644
--- a/external/libutil/libs/network/src/UPnP_Other.cpp
+++ b/external/libutil/libs/network/src/UPnP_Other.cpp
@@ -91,7 +91,11 @@ inline DeviceList discover(int delay, const char* multicastIf = nullptr, const c
inline bool getValidIGD(const DeviceList& deviceList, Urls& urls, IGDdatas& data, std::string& lanAddr)
{
lanAddr.resize(15); // Format: aaa.bbb.ccc.ddd
- return UPNP_GetValidIGD(deviceList, &urls, &data, &lanAddr[0], lanAddr.size()) != 0;
+#if (MINIUPNPC_API_VERSION >= 18)
+ return UPNP_GetValidIGD(deviceList, &urls, &data, &lanAddr[0], lanAddr.size(), NULL, 0) == 1;
+#else
+ return UPNP_GetValidIGD(deviceList, &urls, &data, &lanAddr[0], lanAddr.size()) == 1;
+#endif
}
inline void addPortMapping(const char* controlURL, const char* servicetype, const std::string& extPort,
--
2.45.1

View File

@@ -19,14 +19,15 @@ IUSE="test"
RESTRICT="!test? ( test )"
REQUIRED_USE="${LUA_REQUIRED_USE}"
RDEPEND="${LUA_DEPS}
RDEPEND="
${LUA_DEPS}
app-arch/bzip2
dev-libs/boost:=[nls]
>=media-libs/libsamplerate-0.1.9
>=media-libs/libsdl2-2.0.10-r2[opengl,sound,video]
media-libs/libsndfile
media-libs/sdl2-mixer[vorbis,wav]
net-libs/miniupnpc
net-libs/miniupnpc:=
virtual/opengl
"
@@ -44,6 +45,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-0.9.0_pre20200723-cmake_lua_version.patch
"${FILESDIR}"/${PN}-0.9.5-gcc-13.patch
"${FILESDIR}"/${PN}-0.9.5-boost.patch
"${FILESDIR}"/${PN}-0.9.5-miniupnpc.patch
)
# Build type is checked but blank is valid.