tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
monero: force use of system libraries
rnhmjoj
5 years ago
cc904745
e40ede18
+89
-4
2 changed files
expand all
collapse all
unified
split
pkgs
applications
blockchains
monero
default.nix
use-system-libraries.patch
+20
-4
pkgs/applications/blockchains/monero/default.nix
···
2
, cmake, pkgconfig
3
, boost, miniupnpc, openssl, unbound
4
, zeromq, pcsclite, readline, libsodium, hidapi
5
-
, protobuf, randomx, rapidjson, libusb-compat-0_1
6
, CoreData, IOKit, PCSC
0
0
0
0
7
}:
8
0
0
9
assert stdenv.isDarwin -> IOKit != null;
0
10
11
stdenv.mkDerivation rec {
12
pname = "monero";
···
20
fetchSubmodules = true;
21
};
22
0
0
0
0
0
0
0
23
nativeBuildInputs = [ cmake pkgconfig ];
24
25
buildInputs = [
26
boost miniupnpc openssl unbound
27
zeromq pcsclite readline
28
libsodium hidapi randomx rapidjson
29
-
protobuf libusb-compat-0_1
30
-
] ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ];
0
31
32
cmakeFlags = [
33
"-DCMAKE_BUILD_TYPE=Release"
34
"-DUSE_DEVICE_TREZOR=ON"
35
"-DBUILD_GUI_DEPS=ON"
36
"-DReadline_ROOT_DIR=${readline.dev}"
37
-
] ++ stdenv.lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
0
38
39
meta = with stdenv.lib; {
40
description = "Private, secure, untraceable currency";
···
2
, cmake, pkgconfig
3
, boost, miniupnpc, openssl, unbound
4
, zeromq, pcsclite, readline, libsodium, hidapi
5
+
, randomx, rapidjson
6
, CoreData, IOKit, PCSC
7
+
, trezorSupport ? true
8
+
, libusb1 ? null
9
+
, protobuf ? null
10
+
, python3 ? null
11
}:
12
13
+
with stdenv.lib;
14
+
15
assert stdenv.isDarwin -> IOKit != null;
16
+
assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
17
18
stdenv.mkDerivation rec {
19
pname = "monero";
···
27
fetchSubmodules = true;
28
};
29
30
+
patches = [ ./use-system-libraries.patch ];
31
+
32
+
postPatch = ''
33
+
# remove vendored libraries
34
+
rm -r external/{miniupnp,randomx,rapidjson,unbound}
35
+
'';
36
+
37
nativeBuildInputs = [ cmake pkgconfig ];
38
39
buildInputs = [
40
boost miniupnpc openssl unbound
41
zeromq pcsclite readline
42
libsodium hidapi randomx rapidjson
43
+
protobuf
44
+
] ++ optionals stdenv.isDarwin [ IOKit CoreData PCSC ]
45
+
++ optionals trezorSupport [ libusb1 protobuf python3 ];
46
47
cmakeFlags = [
48
"-DCMAKE_BUILD_TYPE=Release"
49
"-DUSE_DEVICE_TREZOR=ON"
50
"-DBUILD_GUI_DEPS=ON"
51
"-DReadline_ROOT_DIR=${readline.dev}"
52
+
"-DRandomX_ROOT_DIR=${randomx}"
53
+
] ++ optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
54
55
meta = with stdenv.lib; {
56
description = "Private, secure, untraceable currency";
+69
pkgs/applications/blockchains/monero/use-system-libraries.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
2
+
index a8916a7d0..39ec7747b 100644
3
+
--- a/external/CMakeLists.txt
4
+
+++ b/external/CMakeLists.txt
5
+
@@ -37,34 +37,16 @@
6
+
7
+
find_package(Miniupnpc REQUIRED)
8
+
9
+
-message(STATUS "Using in-tree miniupnpc")
10
+
-add_subdirectory(miniupnp/miniupnpc)
11
+
-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
12
+
-if(MSVC)
13
+
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
14
+
-elseif(NOT MSVC)
15
+
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
16
+
-endif()
17
+
-if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
18
+
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
19
+
-endif()
20
+
-
21
+
-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
22
+
+set(UPNP_STATIC false PARENT_SCOPE)
23
+
+set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
24
+
+set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
25
+
26
+
find_package(Unbound)
27
+
28
+
if(NOT UNBOUND_INCLUDE_DIR OR STATIC)
29
+
- # NOTE: If STATIC is true, CMAKE_FIND_LIBRARY_SUFFIXES has been reordered.
30
+
- # unbound has config tests which used OpenSSL libraries, so -ldl may need to
31
+
- # be set in this case.
32
+
- # The unbound CMakeLists.txt can set it, since it's also needed for the
33
+
- # static OpenSSL libraries set up there after with target_link_libraries.
34
+
- add_subdirectory(unbound)
35
+
-
36
+
- set(UNBOUND_STATIC true PARENT_SCOPE)
37
+
- set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE)
38
+
- set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE)
39
+
- set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBDIR}" PARENT_SCOPE)
40
+
+ set(UNBOUND_STATIC false PARENT_SCOPE)
41
+
+ set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
42
+
+ set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
43
+
else()
44
+
message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}")
45
+
if(UNBOUND_LIBRARIES)
46
+
@@ -81,4 +63,5 @@ endif()
47
+
add_subdirectory(db_drivers)
48
+
add_subdirectory(easylogging++)
49
+
add_subdirectory(qrcodegen)
50
+
-add_subdirectory(randomx EXCLUDE_FROM_ALL)
51
+
+
52
+
+find_library(RANDOMX_LIBRARIES NAMES RandomX)
53
+
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
54
+
index 175741146..088b582f7 100644
55
+
--- a/src/p2p/net_node.inl
56
+
+++ b/src/p2p/net_node.inl
57
+
@@ -60,9 +60,9 @@
58
+
#include "cryptonote_core/cryptonote_core.h"
59
+
#include "net/parse.h"
60
+
61
+
-#include <miniupnp/miniupnpc/miniupnpc.h>
62
+
-#include <miniupnp/miniupnpc/upnpcommands.h>
63
+
-#include <miniupnp/miniupnpc/upnperrors.h>
64
+
+#include <miniupnpc/miniupnpc.h>
65
+
+#include <miniupnpc/upnpcommands.h>
66
+
+#include <miniupnpc/upnperrors.h>
67
+
68
+
#undef MONERO_DEFAULT_LOG_CATEGORY
69
+
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"