git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #99662 from prusnak/monero

monero{,-gui}: 0.16.0.3 -> 0.17.0.1

commit2c9ffeeda141636e96c33aadbefa30c7c3ac681a authorMichele Guerini Rocco <rnhmjoj@users.noreply.github.com> dateThu 8 Oct 2020, 17:34 (6 years ago) parent066397c843c5da
3 files changed+163−40
pkgs/applications/blockchains/monero-gui/default.nix+58−33 pkgs/applications/blockchains/monero/default.nix+36−7 pkgs/applications/blockchains/monero/use-system-libraries.patch+69
pkgs/applications/blockchains/monero-gui/default.nix+58−33
@@ -1,63 +1,88 @@
11{ stdenv, wrapQtAppsHook, makeDesktopItem
2−, fetchFromGitHub, qmake, qttools, pkgconfig
2+, fetchFromGitHub
3+, cmake, qttools, pkgconfig
34, qtbase, qtdeclarative, qtgraphicaleffects
45, qtmultimedia, qtxmlpatterns
56, qtquickcontrols, qtquickcontrols2
6−, monero, unbound, readline, boost, libunwind
7−, libsodium, pcsclite, zeromq, libgcrypt, libgpgerror
8−, hidapi, libusb-compat-0_1, protobuf, randomx
7+, monero, miniupnpc, unbound, readline
8+, boost, libunwind, libsodium, pcsclite
9+, randomx, zeromq, libgcrypt, libgpgerror
10+, hidapi, rapidjson
11+, trezorSupport ? true
12+, libusb1 ? null
13+, protobuf ? null
14+, python3 ? null
915}:
1016
1117with stdenv.lib;
1218
19+assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
20+
21+let
22+ arch = if stdenv.isx86_64 then "x86-64"
23+ else if stdenv.isi686 then "i686"
24+ else if stdenv.isAarch64 then "armv8-a"
25+ else throw "unsupported architecture";
26+in
27+
1328stdenv.mkDerivation rec {
1429 pname = "monero-gui";
15− version = "0.16.0.3";
30+ version = "0.17.0.1";
1631
1732 src = fetchFromGitHub {
1833 owner = "monero-project";
1934 repo = "monero-gui";
2035 rev = "v${version}";
21− sha256 = "0iwjp8x5swy8i8pzrlm5v55awhm54cf48pm1vz98lcq361lhfzk6";
36+ sha256 = "1i9a3ampppyzsl4sllbqlr3w43sjpb3fdfxhb1j4n49p8g0jzmf3";
2237 };
2338
24− nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
39+ nativeBuildInputs = [
40+ cmake pkgconfig wrapQtAppsHook
41+ (getDev qttools)
42+ ];
2543
2644 buildInputs = [
2745 qtbase qtdeclarative qtgraphicaleffects
2846 qtmultimedia qtquickcontrols qtquickcontrols2
2947 qtxmlpatterns
30− monero unbound readline libgcrypt libgpgerror
31− boost libunwind libsodium pcsclite zeromq
32− hidapi libusb-compat-0_1 protobuf randomx
33− ];
48+ monero miniupnpc unbound readline
49+ randomx libgcrypt libgpgerror
50+ boost libunwind libsodium pcsclite
51+ zeromq hidapi rapidjson
52+ ] ++ optionals trezorSupport [ libusb1 protobuf python3 ];
3453
35− NIX_CFLAGS_COMPILE = [ "-Wno-error=format-security" ];
54+ postUnpack = ''
55+ # copy monero sources here
56+ # (needs to be writable)
57+ cp -r ${monero.source}/* source/monero
58+ chmod -R +w source/monero
59+ '';
3660
3761 patches = [ ./move-log-file.patch ];
3862
3963 postPatch = ''
40− echo '
41− var GUI_VERSION = "${version}";
42− var GUI_MONERO_VERSION = "${getVersion monero}";
43− ' > version.js
44− substituteInPlace monero-wallet-gui.pro \
45− --replace '$$[QT_INSTALL_BINS]/lrelease' '${getDev qttools}/bin/lrelease'
46− substituteInPlace src/daemon/DaemonManager.cpp \
47− --replace 'QApplication::applicationDirPath() + "' '"${monero}/bin'
48− '';
64+ # set monero-gui version
65+ substituteInPlace src/version.js.in \
66+ --replace '@VERSION_TAG_GUI@' '${version}'
4967
50− makeFlags = [ "INSTALL_ROOT=$(out)" ];
68+ # remove this line on the next release
69+ rm cmake/Version.cmake
5170
52− preBuild = ''
53− sed -i s#/opt/monero-wallet-gui##g Makefile
54− make -C src/zxcvbn-c
71+ # use monerod from the monero package
72+ substituteInPlace src/daemon/DaemonManager.cpp \
73+ --replace 'QApplication::applicationDirPath() + "' '"${monero}/bin'
5574
56− # use nixpkgs monero sources
57− rmdir monero
58− ln -s "${monero.src}" monero
75+ # only build external deps, *not* the full monero
76+ substituteInPlace CMakeLists.txt \
77+ --replace 'add_subdirectory(monero)' \
78+ 'add_subdirectory(monero EXCLUDE_FROM_ALL)'
5979 '';
6080
81+ cmakeFlags = [
82+ "-DCMAKE_INSTALL_PREFIX=$out/bin"
83+ "-DARCH=${arch}"
84+ ];
85+
6186 desktopItem = makeDesktopItem {
6287 name = "monero-wallet-gui";
6388 exec = "monero-wallet-gui";
@@ -69,15 +94,15 @@ stdenv.mkDerivation rec {
6994
7095 postInstall = ''
7196 # install desktop entry
72− mkdir -p $out/share/applications
73− cp ${desktopItem}/share/applications/* $out/share/applications
97+ install -Dm644 -t $out/share/applications \
98+ ${desktopItem}/share/applications/*
7499
75100 # install icons
76101 for n in 16 24 32 48 64 96 128 256; do
77102 size=$n"x"$n
78− mkdir -p $out/share/icons/hicolor/$size/apps
79− cp $src/images/appicons/$size.png \
80− $out/share/icons/hicolor/$size/apps/monero.png
103+ install -Dm644 \
104+ -t $out/share/icons/hicolor/$size/apps/monero.png \
105+ $src/images/appicons/$size.png
81106 done;
82107 '';
83108
pkgs/applications/blockchains/monero/default.nix+36−7
@@ -1,40 +1,69 @@
1−{ stdenv, fetchFromGitHub
1+{ stdenv, fetchFromGitHub, fetchpatch
22, cmake, pkgconfig
33, boost, miniupnpc, openssl, unbound
44, zeromq, pcsclite, readline, libsodium, hidapi
5−, protobuf, randomx, rapidjson, libusb-compat-0_1
5+, randomx, rapidjson
66, CoreData, IOKit, PCSC
7+, trezorSupport ? true
8+, libusb1 ? null
9+, protobuf ? null
10+, python3 ? null
711}:
812
13+with stdenv.lib;
14+
915assert stdenv.isDarwin -> IOKit != null;
16+assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
1017
1118stdenv.mkDerivation rec {
1219 pname = "monero";
13− version = "0.16.0.3";
20+ version = "0.17.0.1";
1421
1522 src = fetchFromGitHub {
1623 owner = "monero-project";
1724 repo = "monero";
1825 rev = "v${version}";
19− sha256 = "1r9x3712vhb24dxxirfiwj5f9x0h4m7x0ngiiavf5983dfdlgz33";
26+ sha256 = "1v0phvg5ralli4dr09a60nq032xqlci5d6v4zfq8304vgrn1ffgp";
2027 fetchSubmodules = true;
2128 };
2229
30+ patches = [
31+ ./use-system-libraries.patch
32+
33+ # This fixes a bug in the monero-gui build system,
34+ # remove it once the PR has been merged
35+ (fetchpatch {
36+ url = "https://github.com/monero-project/monero/pull/6867.patch";
37+ sha256 = "0nxa6861df1fadrm9bmhqf2g6mljgr4jndsbxqp7g501hv9z51j3";
38+ })
39+ ];
40+
41+ postPatch = ''
42+ # remove vendored libraries
43+ rm -r external/{miniupnp,randomx,rapidjson,unbound}
44+ # export patched source for monero-gui
45+ cp -r . $source
46+ '';
47+
2348 nativeBuildInputs = [ cmake pkgconfig ];
2449
2550 buildInputs = [
2651 boost miniupnpc openssl unbound
2752 zeromq pcsclite readline
2853 libsodium hidapi randomx rapidjson
29− protobuf libusb-compat-0_1
30− ] ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ];
54+ protobuf
55+ ] ++ optionals stdenv.isDarwin [ IOKit CoreData PCSC ]
56+ ++ optionals trezorSupport [ libusb1 protobuf python3 ];
3157
3258 cmakeFlags = [
3359 "-DCMAKE_BUILD_TYPE=Release"
3460 "-DUSE_DEVICE_TREZOR=ON"
3561 "-DBUILD_GUI_DEPS=ON"
3662 "-DReadline_ROOT_DIR=${readline.dev}"
37− ] ++ stdenv.lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
63+ "-DRandomX_ROOT_DIR=${randomx}"
64+ ] ++ optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
65+
66+ outputs = [ "out" "source" ];
3867
3968 meta = with stdenv.lib; {
4069 description = "Private, secure, untraceable currency";
pkgs/applications/blockchains/monero/use-system-libraries.patchnew file+69
@@ -0,0 +1,69 @@
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"