qodem: add patches

As it doesn’t look like there’ll be another upstream release,
add bug fix patches from the upstream bug tracker, plus one I wrote
just now for miniupnpc 2.2.8 support.
This commit is contained in:
Emily 2024-07-11 17:38:09 +01:00
parent 187349ba0b
commit 687502080f
2 changed files with 82 additions and 0 deletions

View File

@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitLab,
fetchpatch2,
autoreconfHook,
ncurses,
SDL,
@ -20,6 +21,32 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-Ocb2inuxeDOfqge+h7pHL9I9Kn72Mgi8Eq179/58alk=";
};
patches = [
# Fix ICH with count>1
# https://gitlab.com/AutumnMeowMeow/qodem/-/issues/77
(fetchpatch2 {
url = "https://gitlab.com/-/project/6684464/uploads/c2ceaef82d483c13ff9ec64424f3c40a/0001-Fix-ICH-with-count-1.patch";
hash = "sha256-lCqj4p8onUS4pehQMXS6lbC7JH5dP6sOjDALpasgd2M=";
})
# Don't clear line rendition on partial ED
# https://gitlab.com/AutumnMeowMeow/qodem/-/issues/78
(fetchpatch2 {
url = "https://gitlab.com/-/project/6684464/uploads/462c0b1cf05c3fc2857ce982e62fefcc/0001-Don-t-clear-line-rendition-on-partial-ED.patch";
hash = "sha256-lSuxP0tUfGa3BjK3ehpdMi16XaGZrdVvAcM2vnjAme8=";
})
# DECCOLM should clear line rendition attributes
# https://gitlab.com/AutumnMeowMeow/qodem/-/issues/78
(fetchpatch2 {
url = "https://gitlab.com/-/project/6684464/uploads/812bdfdfaee44eed346fcff85f53efbe/0002-DECCOLM-should-clear-line-rendition-attributes.patch";
hash = "sha256-XO+h5fpBTLLYC3t4FRCy1uFiMkmSXbre4T2NB/FC3uQ=";
})
# Fix build with miniupnpc 2.2.8
./qodem-fix-miniupnpc-2.2.8.patch
];
nativeBuildInputs = [
autoreconfHook
];

View File

@ -0,0 +1,55 @@
diff --git a/source/netclient.c b/source/netclient.c
index 6b6f99ec9b...88d4b91077 100644
--- a/source/netclient.c
+++ b/source/netclient.c
@@ -496,7 +496,7 @@
*/
device_list = upnpDiscover(2000, NULL, NULL, 0, 0, 2, NULL);
# else
-# if (MINIUPNPC_API_VERSION == 17)
+# if (MINIUPNPC_API_VERSION >= 17)
/*
* Version 17
*
@@ -516,8 +516,13 @@
if (device_list != NULL) {
+#if (MINIUPNPC_API_VERSION <= 17) || !defined(MINIUPNPC_API_VERSION)
rc = UPNP_GetValidIGD(device_list, &upnp_urls, &upnp_igd_datas,
local_host, sizeof(local_host));
+#else
+ rc = UPNP_GetValidIGD(device_list, &upnp_urls, &upnp_igd_datas,
+ local_host, sizeof(local_host), NULL, 0);
+#endif
switch (rc) {
@@ -525,13 +530,27 @@
DLOG(("Found valid IGD : %s\n", upnp_urls.controlURL));
break;
+#if (MINIUPNPC_API_VERSION >= 18)
case 2:
+ DLOG(("Found a (reserved?) IGD : %s\n", upnp_urls.controlURL));
+ DLOG(("Trying to continue anyway\n"));
+ break;
+#endif
+#if (MINIUPNPC_API_VERSION <= 17) || !defined(MINIUPNPC_API_VERSION)
+ case 2:
+#else
+ case 3:
+#endif
DLOG(("Found a (not connected?) IGD : %s\n", upnp_urls.controlURL));
DLOG(("Trying to continue anyway\n"));
break;
+#if (MINIUPNPC_API_VERSION <= 17) || !defined(MINIUPNPC_API_VERSION)
case 3:
+#else
+ case 4:
+#endif
DLOG(("UPnP device found. Is it an IGD ? : %s\n",
upnp_urls.controlURL));
DLOG(("Trying to continue anyway\n"));