gnu: monero: Update to 0.12.3.0.

* gnu/packages/patches/monero-use-system-miniupnpc.patch: New file.
* gnu/local.mk: Add it.
* gnu/packages/finance.scm (monero): Update to 0.12.3.0.
[source]: Add patch. Remove snippet because miniupnpc, rapidjson
and unbound are no longer bundled in-tree.
[inputs]: Add zeromq, cppzmq, libsodium. Use monero-miniupnpc.
[arguments]: Change build-type to "release".

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Theodoros Foradis 2018-07-08 20:39:26 +03:00 committed by Ludovic Courtès
parent a0bb021785
commit 0a551443ae
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 126 additions and 15 deletions

View file

@ -940,6 +940,7 @@ dist_patch_DATA = \
%D%/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch \
%D%/packages/patches/mpc123-initialize-ao.patch \
%D%/packages/patches/module-init-tools-moduledir.patch \
%D%/packages/patches/monero-use-system-miniupnpc.patch \
%D%/packages/patches/mongodb-support-unknown-linux-distributions.patch \
%D%/packages/patches/mozjs17-aarch64-support.patch \
%D%/packages/patches/mozjs24-aarch64-support.patch \

View file

@ -39,6 +39,7 @@ (define-module (gnu packages finance)
#:use-module (gnu packages base)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages crypto)
#:use-module (gnu packages databases)
#:use-module (gnu packages documentation)
#:use-module (gnu packages dns)
@ -51,6 +52,7 @@ (define-module (gnu packages finance)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages networking)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages protobuf)
#:use-module (gnu packages python)
@ -367,25 +369,18 @@ (define-public monero
;; the system's dynamically linked library.
(package
(name "monero")
(version "0.11.1.0")
(version "0.12.3.0")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/monero-project/monero/archive/v"
version ".tar.gz"))
(method git-fetch)
(uri (git-reference
(url "https://github.com/monero-project/monero")
(commit (string-append "v" version))))
(file-name (string-append name "-" version ".tar.gz"))
(modules '((guix build utils)))
(snippet
'(begin
;; Delete bundled dependencies.
(for-each
delete-file-recursively
'("external/miniupnpc" "external/rapidjson"
"external/unbound"))
#t))
(patches (search-patches "monero-use-system-miniupnpc.patch"))
(sha256
(base32
"16shd834025jyzy68h3gag1sz8vbk875hy4j97hrki8pacz8vd5m"))))
"14db9kgjm2ha93c2x5fjdw01xaqshn756qr3x2cnzyyjh7caz5qd"))))
(build-system cmake-build-system)
(native-inputs
`(("doxygen" ,doxygen)
@ -395,15 +390,19 @@ (define-public monero
(inputs
`(("bind" ,isc-bind)
("boost" ,boost)
("zeromq" ,zeromq)
("cppzmq" ,cppzmq)
("expat" ,expat)
("libsodium" ,libsodium)
("libunwind" ,libunwind)
("lmdb" ,lmdb)
("miniupnpc" ,miniupnpc)
("miniupnpc" ,monero-miniupnpc)
("openssl" ,openssl)
("rapidjson" ,rapidjson)
("unbound" ,unbound)))
(arguments
`(#:out-of-source? #t
#:build-type "release"
#:configure-flags '("-DBUILD_TESTS=ON"
,@(if (string=? "aarch64-linux" (%current-system))
'("-DARCH=armv8-a")

View file

@ -0,0 +1,111 @@
This reverts commit 1e20d705e7c64d2b17c031f345057d1e8850fafa, so that it's possible to use our own
miniupnpc, instead of a git submodule.
---
CMakeLists.txt | 8 ++++++++
external/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++----------
src/p2p/net_node.inl | 13 ++++++++++---
3 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b93988e..ef948885 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -430,6 +430,14 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/translations")
add_subdirectory(external)
+# Final setup for miniupnpc
+if(UPNP_STATIC OR IOS)
+ add_definitions("-DUPNP_STATIC")
+else()
+ add_definitions("-DUPNP_DYNAMIC")
+ include_directories(${UPNP_INCLUDE})
+endif()
+
# Final setup for libunbound
include_directories(${UNBOUND_INCLUDE})
link_directories(${UNBOUND_LIBRARY_DIRS})
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 1fc4d64c..b4f712ee 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -34,21 +34,42 @@
# We always compile if we are building statically to reduce static dependency issues...
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
# others.
+if(NOT IOS)
+ find_package(Miniupnpc QUIET)
+endif()
-find_package(Miniupnpc REQUIRED)
+# If we have the correct shared version and we're not building static, use it
+if(STATIC OR IOS)
+ set(USE_SHARED_MINIUPNPC false)
+elseif(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
+ set(USE_SHARED_MINIUPNPC true)
+endif()
-message(STATUS "Using in-tree miniupnpc")
+if(USE_SHARED_MINIUPNPC)
+ message(STATUS "Using shared miniupnpc found at ${MINIUPNP_INCLUDE_DIR}")
-add_subdirectory(miniupnp/miniupnpc)
+ set(UPNP_STATIC false PARENT_SCOPE)
+ set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
+ set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
+else()
+ if(STATIC)
+ message(STATUS "Using miniupnpc from local source tree for static build")
+ else()
+ message(STATUS "Using miniupnpc from local source tree (/external/miniupnp/miniupnpc)")
+ endif()
-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()
+ 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()
-set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+ set(UPNP_STATIC true PARENT_SCOPE)
+ set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
+endif()
find_package(Unbound)
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 9b21705e..76340a22 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -49,9 +49,16 @@
#include "storages/levin_abstract_invoke2.h"
#include "cryptonote_core/cryptonote_core.h"
-#include <miniupnp/miniupnpc/miniupnpc.h>
-#include <miniupnp/miniupnpc/upnpcommands.h>
-#include <miniupnp/miniupnpc/upnperrors.h>
+// We have to look for miniupnpc headers in different places, dependent on if its compiled or external
+#ifdef UPNP_STATIC
+ #include <miniupnp/miniupnpc/miniupnpc.h>
+ #include <miniupnp/miniupnpc/upnpcommands.h>
+ #include <miniupnp/miniupnpc/upnperrors.h>
+#else
+ #include "miniupnpc.h"
+ #include "upnpcommands.h"
+ #include "upnperrors.h"
+#endif
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
--
2.16.2