monero-cli: add patch for miniupnpc 2.2.8

(cherry picked from commit 497259f95b)
This commit is contained in:
Emily 2024-07-11 18:14:44 +01:00 committed by Pavol Rusnak
parent 1852b4755f
commit c7916870d9
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 37 additions and 29 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake, ninja, pkg-config
{ lib, stdenv, fetchFromGitHub, fetchpatch2, cmake, ninja, pkg-config
, boost, miniupnpc, openssl, unbound
, zeromq, pcsclite, readline, libsodium, hidapi
, randomx, rapidjson
@ -35,6 +35,28 @@ stdenv.mkDerivation rec {
};
patches = [
# cmake: remove unused/extera cmake/FindMiniupnpc.cmake and only rely on external/miniupnpc
# https://github.com/monero-project/monero/pull/9366
(fetchpatch2 {
url = "https://github.com/monero-project/monero/commit/5074a543a49f7e23fb39b6462fd4c4c9741c3693.patch?full_index=1";
hash = "sha256-dS2hhEU6m2of0ULlsf+/tZMHUmq3vGGXJPGHvtnpQnY=";
})
# cmake: add different parameters to add_monero_library.
# https://github.com/monero-project/monero/pull/9367
(fetchpatch2 {
url = "https://github.com/monero-project/monero/commit/b91ead90254ac6d6daf908f689c38e372a44c615.patch?full_index=1";
hash = "sha256-DL2YqkvEONbeEDqLOAo2eSF5JF5gOzKcLKeNlUXBY1w=";
})
# external: update miniupnpc to 2.2.8
# https://github.com/monero-project/monero/pull/9367
(fetchpatch2 {
url = "https://github.com/monero-project/monero/commit/d81da086ec5088a04b3f7b34831e72910300e2f7.patch?full_index=1";
hash = "sha256-ZJGiDMk5DMmEXwzoUYPC+DIoebluFh54kMQtQU78ckI=";
excludes = [ "external/miniupnp" ];
})
./use-system-libraries.patch
];

View File

@ -1,14 +1,14 @@
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 5b7f69a56..5536debe8 100644
index f8b834ac17...520e148428 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -36,22 +36,9 @@
# others.
@@ -39,23 +39,12 @@
add_compile_options(-D_GNU_SOURCE)
endif()
find_package(Miniupnpc REQUIRED)
-
-message(STATUS "Using in-tree miniupnpc")
-set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
-set(UPNPC_BUILD_TESTS FALSE CACHE BOOL "Disable miniupnp internal tests." FORCE)
-add_subdirectory(miniupnp/miniupnpc)
-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
-set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
@ -20,33 +20,19 @@ index 5b7f69a56..5536debe8 100644
-if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
-endif()
-
-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+set(UPNP_STATIC false PARENT_SCOPE)
+set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
+set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
+include(FindPkgConfig)
+pkg_check_modules(MINIUPNPC REQUIRED IMPORTED_TARGET GLOBAL miniupnpc)
+get_target_property(MINIUPNPC_INCLUDE_DIR PkgConfig::MINIUPNPC INTERFACE_INCLUDE_DIRECTORIES)
+set_target_properties(PkgConfig::MINIUPNPC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MINIUPNPC_INCLUDE_DIR}/miniupnpc")
+set(UPNP_LIBRARIES PkgConfig::MINIUPNPC PARENT_SCOPE)
-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
-
find_package(Unbound)
@@ -69,4 +56,3 @@ endif()
if(NOT UNBOUND_INCLUDE_DIR)
@@ -72,4 +61,3 @@
add_subdirectory(db_drivers)
add_subdirectory(easylogging++)
add_subdirectory(qrcodegen)
-add_subdirectory(randomx EXCLUDE_FROM_ALL)
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index d4b39869c..13071d898 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -61,9 +61,9 @@
#include "cryptonote_core/cryptonote_core.h"
#include "net/parse.h"
-#include <miniupnp/miniupnpc/miniupnpc.h>
-#include <miniupnp/miniupnpc/upnpcommands.h>
-#include <miniupnp/miniupnpc/upnperrors.h>
+#include <miniupnpc/miniupnpc.h>
+#include <miniupnpc/upnpcommands.h>
+#include <miniupnpc/upnperrors.h>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"