Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miniupnpc: 2.2.7 -> 2.2.8, again #326402

Merged
merged 39 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4b9186a
Reapply "miniupnpc: 2.2.7 -> 2.2.8 , support static build"
emilazy Jul 11, 2024
b0ee42d
transmission_4: fix build error with our miniupnp
doronbehar Jul 11, 2024
579e16b
transmission_3: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
314f169
bitcoin: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
37087ef
bitcoin-abc: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
2257420
i2pd: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
2bf72c4
sunshine: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
72446c1
flycast: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
58b9ac8
bitcoind-knots: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
416aae7
retroshare: 0.6.6 -> 0.6.7.2
emilazy Jul 11, 2024
edc7668
retroshare: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
0abdd64
namecoind: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
c9ba793
groestlcoind: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
2e46cc8
eiskaltdcpp: add upstream patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
77fbc57
litecoin: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
0539f86
monero-cli: build with Ninja
emilazy Jul 11, 2024
497259f
monero-cli: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
f96b9b9
haven-cli: build with Ninja
emilazy Jul 11, 2024
5a149da
haven-cli: use patches from monero-cli
emilazy Jul 11, 2024
de9db75
alephone: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
b9f0aa8
zeroad: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
7e44344
yaup: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
c5ff204
dante: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
ca39d29
chiaki4deck: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
9511ce9
elements: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
fcf6c25
particl-core: add patch for miniupnpc 2.2.8
emilazy Jul 11, 2024
defe4ae
gridcoin-research: 5.4.8.0 -> 5.4.8.0-hotfix-1
emilazy Jul 11, 2024
38d971a
pshs: move to `pkgs/by-name`
emilazy Jul 11, 2024
f5b70e5
pshs: format with `nixfmt-rfc-style`
emilazy Jul 11, 2024
5bc8c69
pshs: modernize
emilazy Jul 11, 2024
4d9b599
pshs: support all Unix platforms
emilazy Jul 11, 2024
f67cebe
pshs: 0.3.4 -> 0.4.3
emilazy Jul 11, 2024
953b05c
qodem: move to `pkgs/by-name`
emilazy Jul 11, 2024
956487c
qodem: format with `nixfmt-rfc-style`
emilazy Jul 11, 2024
b78f96a
qodem: modernize
emilazy Jul 11, 2024
8dd4be4
qodem: fix build on Darwin
emilazy Jul 11, 2024
187349b
qodem: 1.0.1 -> 1.0.1-unstable-2022-02-12
emilazy Jul 11, 2024
6875020
qodem: add patches
emilazy Jul 11, 2024
4a46bb9
masari: drop
emilazy Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkgs/applications/blockchains/bitcoin-abc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, stdenv
, mkDerivation
, fetchFromGitHub
, fetchpatch2
, pkg-config
, cmake
, openssl
Expand Down Expand Up @@ -34,6 +35,14 @@ mkDerivation rec {
hash = "sha256-+9uBmmdQ/shWYnJ7tM+Y8OgqYcQHHI2qeMw2tl1lE+w=";
};

patches = [
# upnp: add compatibility for miniupnpc 2.2.8
(fetchpatch2 {
url = "https://github.com/Bitcoin-ABC/bitcoin-abc/commit/5678070f182124a1a8c7c60873d1877094be76ab.patch?full_index=1";
hash = "sha256-QC7TlWepVxQuIZVTbGtQy+HmmXP8PWNhJWdVYudJvmI=";
})
];

nativeBuildInputs = [ pkg-config cmake ];
buildInputs = [
openssl
Expand Down
9 changes: 9 additions & 0 deletions pkgs/applications/blockchains/bitcoin-knots/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, fetchpatch2
, autoreconfHook
, pkg-config
, util-linux
Expand Down Expand Up @@ -32,6 +33,14 @@ stdenv.mkDerivation rec {
hash = "sha256-PqpePDna2gpCzF2K43N4h6cV5Y9w/e5ZcUvaNEaFaIk=";
};

patches = [
# upnp: add compatibility for miniupnpc 2.2.8
(fetchpatch2 {
url = "https://github.com/bitcoinknots/bitcoin/commit/643014424359a4783cf9c73bee3346ac2f04e713.patch?full_index=1";
hash = "sha256-FdLoNH3+ZZTbqrwRvhbAeJuGz4SgnIvoWUBzRxjfzs8=";
})
];

nativeBuildInputs =
[ autoreconfHook pkg-config ]
++ lib.optionals stdenv.isLinux [ util-linux ]
Expand Down
9 changes: 9 additions & 0 deletions pkgs/applications/blockchains/bitcoin/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, fetchpatch2
, autoreconfHook
, pkg-config
, installShellFiles
Expand Down Expand Up @@ -43,6 +44,14 @@ stdenv.mkDerivation rec {
sha256 = "0c1051fd921b8fae912f5c2dfd86b085ab45baa05cd7be4585b10b4d1818f3da";
};

patches = [
# upnp: fix build with miniupnpc 2.2.8
(fetchpatch2 {
url = "https://github.com/bitcoin/bitcoin/commit/8acdf66540834b9f9cf28f16d389e8b6a48516d5.patch?full_index=1";
hash = "sha256-oDvHUvwAEp0LJCf6QBESn38Bu359TcPpLhvuLX3sm6M=";
})
];

nativeBuildInputs =
[ autoreconfHook pkg-config installShellFiles ]
++ lib.optionals stdenv.isLinux [ util-linux ]
Expand Down
9 changes: 9 additions & 0 deletions pkgs/applications/emulators/flycast/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch2
, cmake
, pkg-config
, makeWrapper
Expand All @@ -27,6 +28,14 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};

patches = [
# miniupnp: add support for api version 18
(fetchpatch2 {
url = "https://github.com/flyinghead/flycast/commit/71982eda7a038e24942921e558845103b6c12326.patch?full_index=1";
hash = "sha256-5fFCgX7MfCqW7zxXJuHt9js+VTZZKEQHRYuWh7MTKzI=";
})
];

nativeBuildInputs = [
cmake
pkg-config
Expand Down
12 changes: 0 additions & 12 deletions pkgs/applications/networking/p2p/retroshare/cpp-filesystem.patch

This file was deleted.

28 changes: 18 additions & 10 deletions pkgs/applications/networking/p2p/retroshare/default.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
{ lib, mkDerivation, fetchFromGitHub
, fetchpatch
{ lib, stdenv, mkDerivation, fetchFromGitHub, fetchpatch2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is fetchpatch2 used here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchpatch is “deprecated”; fetchpatch2 is meant to be better but is backwards‐incompatible, so you have to opt in.

Ironically we probably need a fetchpatch3: #266556

, qmake, cmake, pkg-config, miniupnpc, bzip2
, speex, libmicrohttpd, libxml2, libxslt, sqlcipher, rapidjson, libXScrnSaver
, qtbase, qtx11extras, qtmultimedia, libgnome-keyring
}:

mkDerivation rec {
pname = "retroshare";
version = "0.6.6";
version = "0.6.7.2";

src = fetchFromGitHub {
owner = "RetroShare";
repo = "RetroShare";
rev = "v${version}";
sha256 = "1hsymbhsfgycj39mdkrdp2hgq8irmvxa4a6jx2gg339m1fgf2xmh";
hash = "sha256-1A1YvOWIiWlP1JPUTg5Z/lxVGCBv4tCPf5sZdPogitU=";
fetchSubmodules = true;
};

patches = [
# The build normally tries to get git sub-modules during build
# but we already have them checked out
./no-submodules.patch
./cpp-filesystem.patch

# Fix gcc-13 build failure
(fetchpatch {
name = "gcc-13.patch";
url = "https://github.com/RetroShare/RetroShare/commit/e1934fd9b03cd52c556eb06d94fb5d68b649592e.patch";
hash = "sha256-oqxQAsD4fmkWAH2kSVmmed/q0LzTW/iqUU1SgYNdFyk=";
# Support the miniupnpc-2.2.8 API change
(fetchpatch2 {
url = "https://github.com/RetroShare/libretroshare/commit/f1b89c4f87d77714571b4135c301bf0429096a20.patch?full_index=1";
hash = "sha256-UiZMsUFaOZTLj/dx1rLr5bTR1CQ6nt2+IygQdvwJqwc=";
stripLen = 1;
extraPrefix = "libretroshare/";
})
];

Expand All @@ -48,6 +47,15 @@ mkDerivation rec {
"RS_EXTRA_VERSION="
];

postPatch = ''
# Build libsam3 as C, not C++. No, I have no idea why it tries to
# do that, either.
substituteInPlace libretroshare/src/libretroshare.pro \
--replace-fail \
"LIBSAM3_MAKE_PARAMS =" \
"LIBSAM3_MAKE_PARAMS = CC=$CC AR=$AR"
'';

postInstall = ''
# BT DHT bootstrap
cp libbitdht/src/bitdht/bdboot.txt $out/share/retroshare
Expand Down
27 changes: 23 additions & 4 deletions pkgs/applications/networking/p2p/retroshare/no-submodules.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Submodule libretroshare contains modified content
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 84d18944e..71aeb67d2 100644
index 923f878c..ef00f3d7 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -870,20 +870,14 @@ rs_jsonapi {
@@ -930,20 +930,14 @@ rs_jsonapi {
genrestbedlib.variable_out = PRE_TARGETDEPS
win32-g++:isEmpty(QMAKE_SH) {
genrestbedlib.commands = \
Expand All @@ -28,7 +29,7 @@ index 84d18944e..71aeb67d2 100644
mkdir -p $${RESTBED_BUILD_PATH} &&
}
genrestbedlib.commands += \
@@ -991,14 +985,9 @@ rs_broadcast_discovery {
@@ -1063,14 +1057,9 @@ rs_broadcast_discovery {
udpdiscoverycpplib.variable_out = PRE_TARGETDEPS
win32-g++:isEmpty(QMAKE_SH) {
udpdiscoverycpplib.commands = \
Expand All @@ -44,8 +45,26 @@ index 84d18944e..71aeb67d2 100644
}
udpdiscoverycpplib.commands += \
cd $$shell_path($${UDP_DISCOVERY_BUILD_PATH}) && \
@@ -1106,15 +1095,13 @@ rs_sam3_libsam3 {
win32-g++:isEmpty(QMAKE_SH) {
LIBSAM3_MAKE_PARAMS = CC=gcc
libsam3.commands = \
- cd /D $$shell_path($${RS_SRC_PATH}) && git submodule update --init supportlibs/libsam3 || cd . $$escape_expand(\\n\\t) \
+ cd /D $$shell_path($${RS_SRC_PATH}) && cd . $$escape_expand(\\n\\t) \
$(CHK_DIR_EXISTS) $$shell_path($$LIBSAM3_BUILD_PATH) $(MKDIR) $$shell_path($${LIBSAM3_BUILD_PATH}) $$escape_expand(\\n\\t) \
$(COPY_DIR) $$shell_path($${LIBSAM3_SRC_PATH}) $$shell_path($${LIBSAM3_BUILD_PATH}) || cd . $$escape_expand(\\n\\t)
} else {
LIBSAM3_MAKE_PARAMS =
libsam3.commands = \
- cd $${RS_SRC_PATH} && ( \
- git submodule update --init supportlibs/libsam3 || \
- true ) && \
+ cd $${RS_SRC_PATH} && \
mkdir -p $${LIBSAM3_BUILD_PATH} && \
(cp -r $${LIBSAM3_SRC_PATH}/* $${LIBSAM3_BUILD_PATH} || true) &&
}
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 654efd170..06cba9ba3 100644
index d73117b84..b2fc6799a 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -66,10 +66,7 @@ rs_gui_cmark {
Expand Down
15 changes: 15 additions & 0 deletions pkgs/applications/networking/p2p/transmission/4.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv
, lib
, fetchFromGitHub
, fetchpatch2
, cmake
, pkg-config
, python3
Expand Down Expand Up @@ -69,6 +70,20 @@ stdenv.mkDerivation (finalAttrs: {
fetchSubmodules = true;
};

patches = [
(fetchpatch2 {
url = "https://github.com/transmission/transmission/commit/febfe49ca3ecab1a7142ecb34012c1f0b2bcdee8.patch?full_index=1";
hash = "sha256-Ge0+AXf/ilfMieGBAdvvImY7JOb0gGIdeKprC37AROs=";
excludes = [
# The submodule that we don't use (we use our miniupnp)
"third-party/miniupnp"
# Hunk fails for this one, but we don't care because we don't rely upon
# xcode definitions even for the Darwin build.
"Transmission.xcodeproj/project.pbxproj"
];
})
];

outputs = [ "out" "apparmor" ];

cmakeFlags = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/tr/transmission_3/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
# fix build with openssl 3.0
./transmission-3.00-openssl-3.patch
# fix build with miniupnpc 2.2.8
./transmission-3.00-miniupnpc-2.2.8.patch
];

outputs = [ "out" "apparmor" ];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/libtransmission/upnp.c b/libtransmission/upnp.c
index c9e248a379...c7b2580bcb 100644
--- a/libtransmission/upnp.c
+++ b/libtransmission/upnp.c
@@ -194,8 +194,13 @@

errno = 0;

+#if (MINIUPNPC_API_VERSION >= 18)
if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, handle->lanaddr,
+ sizeof(handle->lanaddr), NULL, 0) == UPNP_IGD_VALID_CONNECTED)
+#else
+ if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, handle->lanaddr,
sizeof(handle->lanaddr)) == UPNP_IGD_VALID_CONNECTED)
+#endif
{
tr_logAddNamedInfo(getKey(), _("Found Internet Gateway Device \"%s\""), handle->urls.controlURL);
tr_logAddNamedInfo(getKey(), _("Local Address is \"%s\""), handle->lanaddr);
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
From f4f1800f5e67ab59312ccf710695acf06fb4ae26 Mon Sep 17 00:00:00 2001
From: ReenigneArcher <[email protected]>
Date: Mon, 1 Jul 2024 10:07:06 -0400
Subject: [PATCH] fix(upnp): support newer miniupnpc library (#2782)

Co-authored-by: Vithorio Polten <[email protected]>
---
src/upnp.cpp | 30 +++++++++++++++---------------
src/upnp.h | 31 ++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 16 deletions(-)

diff --git a/src/upnp.cpp b/src/upnp.cpp
index f65bcb87..fcbaaeb5 100644
--- a/src/upnp.cpp
+++ b/src/upnp.cpp
@@ -19,19 +19,6 @@
using namespace std::literals;

namespace upnp {
- constexpr auto INET6_ADDRESS_STRLEN = 46;
-
- constexpr auto PORT_MAPPING_LIFETIME = 3600s;
- constexpr auto REFRESH_INTERVAL = 120s;
-
- constexpr auto IPv4 = 0;
- constexpr auto IPv6 = 1;
-
- using device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist>;
-
- KITTY_USING_MOVE_T(urls_t, UPNPUrls, , {
- FreeUPNPUrls(&el);
- });

struct mapping_t {
struct {
@@ -59,6 +46,19 @@ namespace upnp {
return "Unknown status"sv;
}

+ /**
+ * This function is a wrapper around UPNP_GetValidIGD() that returns the status code. There is a pre-processor
+ * check to determine which version of the function to call based on the version of the MiniUPnPc library.
+ */
+ int
+ UPNP_GetValidIGDStatus(device_t &device, urls_t *urls, IGDdatas *data, std::array<char, INET6_ADDRESS_STRLEN> &lan_addr) {
+#if (MINIUPNPC_API_VERSION >= 18)
+ return UPNP_GetValidIGD(device.get(), &urls->el, data, lan_addr.data(), lan_addr.size(), nullptr, 0);
+#else
+ return UPNP_GetValidIGD(device.get(), &urls->el, data, lan_addr.data(), lan_addr.size());
+#endif
+ }
+
class deinit_t: public platf::deinit_t {
public:
deinit_t() {
@@ -109,7 +109,7 @@ namespace upnp {
IGDdatas data;
urls_t urls;
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;
- auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+ auto status = upnp::UPNP_GetValidIGDStatus(device, &urls, &data, lan_addr);
if (status != 1 && status != 2) {
BOOST_LOG(debug) << "No valid IPv6 IGD: "sv << status_string(status);
return false;
@@ -331,7 +331,7 @@ namespace upnp {
std::array<char, INET6_ADDRESS_STRLEN> lan_addr;

urls_t urls;
- auto status = UPNP_GetValidIGD(device.get(), &urls.el, &data, lan_addr.data(), lan_addr.size());
+ auto status = upnp::UPNP_GetValidIGDStatus(device, &urls, &data, lan_addr);
if (status != 1 && status != 2) {
BOOST_LOG(error) << status_string(status);
mapped = false;
diff --git a/src/upnp.h b/src/upnp.h
index 73fc4f79..4b2e3296 100644
--- a/src/upnp.h
+++ b/src/upnp.h
@@ -4,9 +4,38 @@
*/
#pragma once

+#include <miniupnpc/miniupnpc.h>
+
#include "platform/common.h"

namespace upnp {
+ constexpr auto INET6_ADDRESS_STRLEN = 46;
+ constexpr auto IPv4 = 0;
+ constexpr auto IPv6 = 1;
+ constexpr auto PORT_MAPPING_LIFETIME = 3600s;
+ constexpr auto REFRESH_INTERVAL = 120s;
+
+ using device_t = util::safe_ptr<UPNPDev, freeUPNPDevlist>;
+
+ KITTY_USING_MOVE_T(urls_t, UPNPUrls, , {
+ FreeUPNPUrls(&el);
+ });
+
+ /**
+ * @brief Get the valid IGD status.
+ * @param device The device.
+ * @param urls The URLs.
+ * @param data The IGD data.
+ * @param lan_addr The LAN address.
+ * @return The UPnP Status.
+ * @retval 0 No IGD found.
+ * @retval 1 A valid connected IGD has been found.
+ * @retval 2 A valid IGD has been found but it reported as not connected.
+ * @retval 3 An UPnP device has been found but was not recognized as an IGD.
+ */
+ int
+ UPNP_GetValidIGDStatus(device_t &device, urls_t *urls, IGDdatas *data, std::array<char, INET6_ADDRESS_STRLEN> &lan_addr);
+
[[nodiscard]] std::unique_ptr<platf::deinit_t>
start();
-}
+} // namespace upnp
--
2.45.2

Loading