Merge pull request #99662 from prusnak/monero

monero{,-gui}: 0.16.0.3 -> 0.17.0.1
This commit is contained in:
Michele Guerini Rocco 2020-10-08 17:34:41 +02:00 committed by GitHub
commit 2c9ffeeda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 163 additions and 40 deletions

View File

@ -1,62 +1,87 @@
{ stdenv, wrapQtAppsHook, makeDesktopItem { stdenv, wrapQtAppsHook, makeDesktopItem
, fetchFromGitHub, qmake, qttools, pkgconfig , fetchFromGitHub
, cmake, qttools, pkgconfig
, qtbase, qtdeclarative, qtgraphicaleffects , qtbase, qtdeclarative, qtgraphicaleffects
, qtmultimedia, qtxmlpatterns , qtmultimedia, qtxmlpatterns
, qtquickcontrols, qtquickcontrols2 , qtquickcontrols, qtquickcontrols2
, monero, unbound, readline, boost, libunwind , monero, miniupnpc, unbound, readline
, libsodium, pcsclite, zeromq, libgcrypt, libgpgerror , boost, libunwind, libsodium, pcsclite
, hidapi, libusb-compat-0_1, protobuf, randomx , randomx, zeromq, libgcrypt, libgpgerror
, hidapi, rapidjson
, trezorSupport ? true
, libusb1 ? null
, protobuf ? null
, python3 ? null
}: }:
with stdenv.lib; with stdenv.lib;
assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
let
arch = if stdenv.isx86_64 then "x86-64"
else if stdenv.isi686 then "i686"
else if stdenv.isAarch64 then "armv8-a"
else throw "unsupported architecture";
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "monero-gui"; pname = "monero-gui";
version = "0.16.0.3"; version = "0.17.0.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "monero-project"; owner = "monero-project";
repo = "monero-gui"; repo = "monero-gui";
rev = "v${version}"; rev = "v${version}";
sha256 = "0iwjp8x5swy8i8pzrlm5v55awhm54cf48pm1vz98lcq361lhfzk6"; sha256 = "1i9a3ampppyzsl4sllbqlr3w43sjpb3fdfxhb1j4n49p8g0jzmf3";
}; };
nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ]; nativeBuildInputs = [
cmake pkgconfig wrapQtAppsHook
(getDev qttools)
];
buildInputs = [ buildInputs = [
qtbase qtdeclarative qtgraphicaleffects qtbase qtdeclarative qtgraphicaleffects
qtmultimedia qtquickcontrols qtquickcontrols2 qtmultimedia qtquickcontrols qtquickcontrols2
qtxmlpatterns qtxmlpatterns
monero unbound readline libgcrypt libgpgerror monero miniupnpc unbound readline
boost libunwind libsodium pcsclite zeromq randomx libgcrypt libgpgerror
hidapi libusb-compat-0_1 protobuf randomx boost libunwind libsodium pcsclite
]; zeromq hidapi rapidjson
] ++ optionals trezorSupport [ libusb1 protobuf python3 ];
NIX_CFLAGS_COMPILE = [ "-Wno-error=format-security" ]; postUnpack = ''
# copy monero sources here
# (needs to be writable)
cp -r ${monero.source}/* source/monero
chmod -R +w source/monero
'';
patches = [ ./move-log-file.patch ]; patches = [ ./move-log-file.patch ];
postPatch = '' postPatch = ''
echo ' # set monero-gui version
var GUI_VERSION = "${version}"; substituteInPlace src/version.js.in \
var GUI_MONERO_VERSION = "${getVersion monero}"; --replace '@VERSION_TAG_GUI@' '${version}'
' > version.js
substituteInPlace monero-wallet-gui.pro \ # remove this line on the next release
--replace '$$[QT_INSTALL_BINS]/lrelease' '${getDev qttools}/bin/lrelease' rm cmake/Version.cmake
# use monerod from the monero package
substituteInPlace src/daemon/DaemonManager.cpp \ substituteInPlace src/daemon/DaemonManager.cpp \
--replace 'QApplication::applicationDirPath() + "' '"${monero}/bin' --replace 'QApplication::applicationDirPath() + "' '"${monero}/bin'
# only build external deps, *not* the full monero
substituteInPlace CMakeLists.txt \
--replace 'add_subdirectory(monero)' \
'add_subdirectory(monero EXCLUDE_FROM_ALL)'
''; '';
makeFlags = [ "INSTALL_ROOT=$(out)" ]; cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=$out/bin"
preBuild = '' "-DARCH=${arch}"
sed -i s#/opt/monero-wallet-gui##g Makefile ];
make -C src/zxcvbn-c
# use nixpkgs monero sources
rmdir monero
ln -s "${monero.src}" monero
'';
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
name = "monero-wallet-gui"; name = "monero-wallet-gui";
@ -69,15 +94,15 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
# install desktop entry # install desktop entry
mkdir -p $out/share/applications install -Dm644 -t $out/share/applications \
cp ${desktopItem}/share/applications/* $out/share/applications ${desktopItem}/share/applications/*
# install icons # install icons
for n in 16 24 32 48 64 96 128 256; do for n in 16 24 32 48 64 96 128 256; do
size=$n"x"$n size=$n"x"$n
mkdir -p $out/share/icons/hicolor/$size/apps install -Dm644 \
cp $src/images/appicons/$size.png \ -t $out/share/icons/hicolor/$size/apps/monero.png \
$out/share/icons/hicolor/$size/apps/monero.png $src/images/appicons/$size.png
done; done;
''; '';

View File

@ -1,40 +1,69 @@
{ stdenv, fetchFromGitHub { stdenv, fetchFromGitHub, fetchpatch
, cmake, pkgconfig , cmake, pkgconfig
, boost, miniupnpc, openssl, unbound , boost, miniupnpc, openssl, unbound
, zeromq, pcsclite, readline, libsodium, hidapi , zeromq, pcsclite, readline, libsodium, hidapi
, protobuf, randomx, rapidjson, libusb-compat-0_1 , randomx, rapidjson
, CoreData, IOKit, PCSC , CoreData, IOKit, PCSC
, trezorSupport ? true
, libusb1 ? null
, protobuf ? null
, python3 ? null
}: }:
with stdenv.lib;
assert stdenv.isDarwin -> IOKit != null; assert stdenv.isDarwin -> IOKit != null;
assert trezorSupport -> all (x: x!=null) [ libusb1 protobuf python3 ];
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "monero"; pname = "monero";
version = "0.16.0.3"; version = "0.17.0.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "monero-project"; owner = "monero-project";
repo = "monero"; repo = "monero";
rev = "v${version}"; rev = "v${version}";
sha256 = "1r9x3712vhb24dxxirfiwj5f9x0h4m7x0ngiiavf5983dfdlgz33"; sha256 = "1v0phvg5ralli4dr09a60nq032xqlci5d6v4zfq8304vgrn1ffgp";
fetchSubmodules = true; fetchSubmodules = true;
}; };
patches = [
./use-system-libraries.patch
# This fixes a bug in the monero-gui build system,
# remove it once the PR has been merged
(fetchpatch {
url = "https://github.com/monero-project/monero/pull/6867.patch";
sha256 = "0nxa6861df1fadrm9bmhqf2g6mljgr4jndsbxqp7g501hv9z51j3";
})
];
postPatch = ''
# remove vendored libraries
rm -r external/{miniupnp,randomx,rapidjson,unbound}
# export patched source for monero-gui
cp -r . $source
'';
nativeBuildInputs = [ cmake pkgconfig ]; nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ buildInputs = [
boost miniupnpc openssl unbound boost miniupnpc openssl unbound
zeromq pcsclite readline zeromq pcsclite readline
libsodium hidapi randomx rapidjson libsodium hidapi randomx rapidjson
protobuf libusb-compat-0_1 protobuf
] ++ stdenv.lib.optionals stdenv.isDarwin [ IOKit CoreData PCSC ]; ] ++ optionals stdenv.isDarwin [ IOKit CoreData PCSC ]
++ optionals trezorSupport [ libusb1 protobuf python3 ];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release"
"-DUSE_DEVICE_TREZOR=ON" "-DUSE_DEVICE_TREZOR=ON"
"-DBUILD_GUI_DEPS=ON" "-DBUILD_GUI_DEPS=ON"
"-DReadline_ROOT_DIR=${readline.dev}" "-DReadline_ROOT_DIR=${readline.dev}"
] ++ stdenv.lib.optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF"; "-DRandomX_ROOT_DIR=${randomx}"
] ++ optional stdenv.isDarwin "-DBoost_USE_MULTITHREADED=OFF";
outputs = [ "out" "source" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Private, secure, untraceable currency"; description = "Private, secure, untraceable currency";

View File

@ -0,0 +1,69 @@
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index a8916a7d0..39ec7747b 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -37,34 +37,16 @@
find_package(Miniupnpc REQUIRED)
-message(STATUS "Using in-tree miniupnpc")
-add_subdirectory(miniupnp/miniupnpc)
-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
-if(MSVC)
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
-elseif(NOT MSVC)
- set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
-endif()
-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)
find_package(Unbound)
if(NOT UNBOUND_INCLUDE_DIR OR STATIC)
- # NOTE: If STATIC is true, CMAKE_FIND_LIBRARY_SUFFIXES has been reordered.
- # unbound has config tests which used OpenSSL libraries, so -ldl may need to
- # be set in this case.
- # The unbound CMakeLists.txt can set it, since it's also needed for the
- # static OpenSSL libraries set up there after with target_link_libraries.
- add_subdirectory(unbound)
-
- set(UNBOUND_STATIC true PARENT_SCOPE)
- set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE)
- set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE)
- set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBDIR}" PARENT_SCOPE)
+ set(UNBOUND_STATIC false PARENT_SCOPE)
+ set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
+ set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
else()
message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}")
if(UNBOUND_LIBRARIES)
@@ -81,4 +63,5 @@ endif()
add_subdirectory(db_drivers)
add_subdirectory(easylogging++)
add_subdirectory(qrcodegen)
-add_subdirectory(randomx EXCLUDE_FROM_ALL)
+
+find_library(RANDOMX_LIBRARIES NAMES RandomX)
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 175741146..088b582f7 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -60,9 +60,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"