commit: 54727926a77f37245155e680bfd4b08715e20674 Author: John M. Harris Jr. <johnmh <AT> johnmh <DOT> me> AuthorDate: Sat Nov 2 18:40:12 2024 +0000 Commit: John M. Harris, Jr. <johnmh <AT> johnmh <DOT> me> CommitDate: Sat Nov 2 18:40:12 2024 +0000 URL: https://gitweb.gentoo.org/repo/user/johnmh.git/commit/?id=54727926
net-p2p/monero: new package, add 0.18.3.4 Signed-off-by: John M. Harris Jr. <johnmh <AT> johnmh.me> net-p2p/monero/Manifest | 9 ++ .../files/monero-0.18.3.3-miniupnp-api-18.patch | 30 +++++ .../monero-0.18.3.3-unbundle-dependencies.patch | 102 +++++++++++++++++ net-p2p/monero/files/monerod.conf | 8 ++ net-p2p/monero/files/monerod.confd | 6 + net-p2p/monero/files/monerod.initd | 22 ++++ net-p2p/monero/files/monerod.service | 17 +++ net-p2p/monero/metadata.xml | 34 ++++++ net-p2p/monero/monero-0.18.3.4.ebuild | 125 +++++++++++++++++++++ 9 files changed, 353 insertions(+) diff --git a/net-p2p/monero/Manifest b/net-p2p/monero/Manifest new file mode 100644 index 0000000..46a7671 --- /dev/null +++ b/net-p2p/monero/Manifest @@ -0,0 +1,9 @@ +AUX monero-0.18.3.3-miniupnp-api-18.patch 1141 BLAKE2B 4011addc3b5336ae748a0d6f8e85143153c6ab92685334ca03ca4a5dcec9e4bfa30f5a5a8098e6797e9be1abcf4b2c25da8b7da97e3f109590ce8f321cf78147 SHA512 f02b555c0b6d9055b6e5167984c2dc3d3b4d9878b9d069a0b253f9f4d0ccf27fd5b8d58b8b5f12df9662fac3fc1fb84260038da6866db6d1f507884fb86dcf07 +AUX monero-0.18.3.3-unbundle-dependencies.patch 3251 BLAKE2B e30193a12401a449632f3315b63d43f1d79be0850b3b90ce6126b906b57e2d2c2060a91858cf30a5ae2be09f09f0187e04f8c67cdbd8c9cb5e719eaa88d6baf8 SHA512 df0b223ad6b3da15af2d92d15e30c3b2314b49afe39b5ff977bf1959f7cb66a21f5857bbc393fbf80558c0ac9f9e4865d9fd5b3e7a28d71a1faf4bc74b5b7708 +AUX monerod.conf 301 BLAKE2B 48e8545ac02afbb8edd32d1457afcd52c30380ba03e526c982eb91ce9fa0c5733fdbc9547fd7a01f525176122bc201f5e8f5bc88125bbaf6bf762c0f5df7a220 SHA512 ca7fa3003f8e87c66e3a1986555327e1ce767d694daa506a8889aea8fe8b646cfece54bee1a1d029c66e32aa7845501059c2810bb030c445f3dfa46c43704d41 +AUX monerod.confd 213 BLAKE2B 25a6f44d2d1bdbc21990e18e19239ce8b75a9d0228978c352e142e939b5db3f2c6ceed22f39ac7ad956e377fc9a062616d4d6677c7f0ba05d7683593867cb01b SHA512 68eb1575297a992023a14db60239ac0b031b2a10cfd207252aba16d709d721fd89451aba05635c3f5a5351109317f32ca3acc66c1203098a1f13e91007b33073 +AUX monerod.initd 556 BLAKE2B abc203c1ac5fd900bf9090ba74c4e9fc4aae55e436e7152681c6663e60bea9fdc2fd327ec619e51f81a92550ee5a943881971aae90f3fe77ec6826f34d1ef4c9 SHA512 5ee0e2ae8562c84d4ed6eb279c280b9b641f098c210488d608addbb2344ce99dd13bb69afa86aac3f788f52defe1a61b8548b29adec37fc2aba000c1551f6bb7 +AUX monerod.service 329 BLAKE2B e4390612e1e37cb47164967cc086eb32b1dac61ceba621d376ae87220245284d83dd0895e786daf1652ff40c0161f713cd4f124ae7b2d57306208d5886c8aeb3 SHA512 38eb172bcd46c98a5aaa8f7c0d8bf011c183fd4d09f9d38c14679a4a0ee628d58c6dde6cce181745b053576e3b8907038d75ec3bcb3b0bb03e62c606573038b3 +DIST monero-0.18.3.4.tar.gz 14039924 BLAKE2B cb60f1db4f482bac3b3f5fa606bf1c78103b14f927d4636e5fda4aa96dcc08a9f990355ceb1cdc8c253245a0a2a1c98cf4fd7101d13d78ac6e7d1450192fc2db SHA512 f2708bf7698410c1509ae41148c298e352b3401e1df900b7152c25cb5ceb2f5bde68274fd37b1a328e932be50bdf93fe364561c520a15e3df7de2cdbd20d1be8 +EBUILD monero-0.18.3.4.ebuild 3112 BLAKE2B 4efbeaf1d243eca8205985874ab0355f04a3e17604f2650f908bd08328379bea5b16f93fb8a9448b20801806522a41e0cd43ede3fffdf981c9aab47e18d53cce SHA512 314699cd636577e5417520422084e5681cfc7ccb1426b54f1068f3232d2f2117bc936752788007574a23d3d6396943a40d47847c0c20043642c44d06fe0b15f1 +MISC metadata.xml 1105 BLAKE2B a05d4cdfb8bc8430cf930d5d9b39ea2801eb14f3a2e6b3eaba81f383c68017d4e219f30be23a4f7c6f52dbe18003147a9b86f75f99ba251b5450d7d2aa13ddc2 SHA512 0bb9608894f3360cd40da7db41a7813b68fe82848e26cb090ffbde38870e596103ab61f70ec4c07437ac3ff8382e60d1e387ff2936759fc78537dbf27c186d18 diff --git a/net-p2p/monero/files/monero-0.18.3.3-miniupnp-api-18.patch b/net-p2p/monero/files/monero-0.18.3.3-miniupnp-api-18.patch new file mode 100644 index 0000000..d281f60 --- /dev/null +++ b/net-p2p/monero/files/monero-0.18.3.3-miniupnp-api-18.patch @@ -0,0 +1,30 @@ +diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl +index 30e3d31b9..c49783e1c 100644 +--- a/src/p2p/net_node.inl ++++ b/src/p2p/net_node.inl +@@ -2989,7 +2989,12 @@ namespace nodetool + UPNPUrls urls; + IGDdatas igdData; + char lanAddress[64]; ++#if MINIUPNPC_API_VERSION > 17 ++ char wanAddress[64]; ++ result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof(wanAddress)); ++#else + result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress); ++#endif + freeUPNPDevlist(deviceList); + if (result > 0) { + if (result == 1) { +@@ -3057,7 +3062,12 @@ namespace nodetool + UPNPUrls urls; + IGDdatas igdData; + char lanAddress[64]; ++#if MINIUPNPC_API_VERSION > 17 ++ char wanAddress[64]; ++ result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanAddress, sizeof(wanAddress)); ++#else + result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress); ++#endif + freeUPNPDevlist(deviceList); + if (result > 0) { + if (result == 1) { diff --git a/net-p2p/monero/files/monero-0.18.3.3-unbundle-dependencies.patch b/net-p2p/monero/files/monero-0.18.3.3-unbundle-dependencies.patch new file mode 100644 index 0000000..6cd7e7c --- /dev/null +++ b/net-p2p/monero/files/monero-0.18.3.3-unbundle-dependencies.patch @@ -0,0 +1,102 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -458,7 +458,7 @@ + # elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") + # set(BSDI TRUE) + +-include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include) ++include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external ) + + if(APPLE) + cmake_policy(SET CMP0042 NEW) +@@ -1201,7 +1201,6 @@ + set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}") + endif() + +-include(external/supercop/functions.cmake) # place after setting flags and before src directory inclusion + add_subdirectory(contrib) + add_subdirectory(src) + +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -37,21 +37,7 @@ + + find_package(Miniupnpc REQUIRED) + +-message(STATUS "Using in-tree miniupnpc") +-set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE) +-add_subdirectory(miniupnp/miniupnpc) +-set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external") +-set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON) +-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_LIBRARIES "miniupnpc" PARENT_SCOPE) + + find_package(Unbound) + +@@ -69,4 +55,3 @@ + add_subdirectory(db_drivers) + add_subdirectory(easylogging++) + add_subdirectory(qrcodegen) +-add_subdirectory(randomx EXCLUDE_FROM_ALL) +--- a/src/crypto/CMakeLists.txt ++++ b/src/crypto/CMakeLists.txt +@@ -55,6 +55,7 @@ + endif() + + include_directories(${RANDOMX_INCLUDE}) ++include_directories(SYSTEM /usr/include/monero) + + set(crypto_headers) + +@@ -97,6 +98,3 @@ + # cheat because cmake and ccache hate each other + set_property(SOURCE CryptonightR_template.S PROPERTY LANGUAGE C) + set_property(SOURCE CryptonightR_template.S PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.asm) +- +-# Must be done last, because it references libraries in this directory +-add_subdirectory(wallet) +--- a/src/crypto/wallet/crypto.h ++++ b/src/crypto/wallet/crypto.h +@@ -30,7 +30,6 @@ + #pragma once + + #include <cstddef> +-#include "crypto/wallet/ops.h" + + namespace crypto { + namespace wallet { +--- a/src/device/CMakeLists.txt ++++ b/src/device/CMakeLists.txt +@@ -73,7 +73,7 @@ + cncrypto + cryptonote_format_utils_basic + ringct_basic +- wallet-crypto ++ monero-crypto + ${OPENSSL_CRYPTO_LIBRARIES} + ${Boost_SERIALIZATION_LIBRARY} + PRIVATE +--- 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" diff --git a/net-p2p/monero/files/monerod.conf b/net-p2p/monero/files/monerod.conf new file mode 100644 index 0000000..d019576 --- /dev/null +++ b/net-p2p/monero/files/monerod.conf @@ -0,0 +1,8 @@ +# Configuration for monerod +# Syntax: any command line option may be specified as 'clioptionname=value'. +# Boolean options such as 'no-igd' are specified as 'no-igd=1'. +# See 'monerod --help' for all available options. + +data-dir=/var/lib/monero +log-file=/var/log/monero/monero.log +log-level=0 diff --git a/net-p2p/monero/files/monerod.confd b/net-p2p/monero/files/monerod.confd new file mode 100644 index 0000000..94515dc --- /dev/null +++ b/net-p2p/monero/files/monerod.confd @@ -0,0 +1,6 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +monerod_args="--config-file /etc/monero/monerod.conf --non-interactive" +monerod_user=monero +monerod_group=monero diff --git a/net-p2p/monero/files/monerod.initd b/net-p2p/monero/files/monerod.initd new file mode 100644 index 0000000..48a46d5 --- /dev/null +++ b/net-p2p/monero/files/monerod.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +pidfile=/var/run/monerod.pid +command=/usr/bin/monerod +command_args="${monerod_args}" +start_stop_daemon_args="-u ${monerod_user} -b -m -p ${pidfile}" +retry="SIGTERM/30/SIGKILL/5" + +name="Monero P2P Daemon" +description="Connects to the Monero P2P network" + +depend() { + need localmount + need net +} + +start_pre() { + checkpath --directory --owner ${monerod_user}:${monerod_group} --mode 0755 \ + /var/lib/monero /var/log/monero +} diff --git a/net-p2p/monero/files/monerod.service b/net-p2p/monero/files/monerod.service new file mode 100644 index 0000000..3275604 --- /dev/null +++ b/net-p2p/monero/files/monerod.service @@ -0,0 +1,17 @@ +[Unit] +Description=Monero P2P Daemon +After=network.target + +[Service] +User=monero +Group=monero +StateDirectory=monero +LogsDirectory=monero +Type=simple +ExecStart=/usr/bin/monerod --config-file /etc/monero/monerod.conf --non-interactive +Restart=on-failure +StandardOutput=null +StandardError=null + +[Install] +WantedBy=multi-user.target diff --git a/net-p2p/monero/metadata.xml b/net-p2p/monero/metadata.xml new file mode 100644 index 0000000..af37030 --- /dev/null +++ b/net-p2p/monero/metadata.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>joh...@johnmh.me</email> + <name>John M. Harris, Jr.</name> + </maintainer> + <longdescription lang="en"> + Monero is a private, secure, untraceable, decentralised digital + currency. You are your bank, you control your funds, and nobody + can trace your transfers unless you allow them to do so. + </longdescription> + <use> + <flag name="daemon"> + Build the Monero daemon used to connect to the P2P network. + </flag> + <flag name="hw-wallet"> + Enable Trezor hardware wallet support. + </flag> + <flag name="tools"> + Build tools used to manipulate the blockchain as it is stored on + disk. + </flag> + <flag name="wallet-cli"> + Build the command line wallet, monero-wallet-cli. + </flag> + <flag name="wallet-rpc"> + Build the RPC wallet, monero-wallet-rpc. + </flag> + </use> + <upstream> + <remote-id type="github">monero-project/monero</remote-id> + </upstream> +</pkgmetadata> diff --git a/net-p2p/monero/monero-0.18.3.4.ebuild b/net-p2p/monero/monero-0.18.3.4.ebuild new file mode 100644 index 0000000..0de3b32 --- /dev/null +++ b/net-p2p/monero/monero-0.18.3.4.ebuild @@ -0,0 +1,125 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake systemd + +DESCRIPTION="The secure, private, untraceable cryptocurrency" +HOMEPAGE="https://github.com/monero-project/monero" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/monero-project/monero.git" + EGIT_SUBMODULES=() +else + SRC_URI="https://github.com/monero-project/monero/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm64 ~x86" +fi + +LICENSE="BSD MIT" +SLOT="0" +IUSE="+daemon hw-wallet readline +tools +wallet-cli +wallet-rpc" +REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )" +RESTRICT="test" + +DEPEND=" + daemon? ( + acct-group/monero + acct-user/monero + ) + dev-libs/boost:=[nls] + dev-libs/libsodium:= + dev-libs/openssl:= + dev-libs/randomx + dev-libs/rapidjson + dev-libs/supercop + net-dns/unbound:=[threads] + net-libs/czmq:= + net-libs/miniupnpc:= + readline? ( sys-libs/readline:0= ) + hw-wallet? ( + dev-libs/hidapi + dev-libs/protobuf:= + virtual/libusb:1 + ) +" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${PN}-0.18.3.3-unbundle-dependencies.patch" + "${FILESDIR}/${PN}-0.18.3.3-miniupnp-api-18.patch" +) + +src_configure() { + local mycmakeargs=( + # TODO: Update CMake to install built libraries (help wanted) + -DBUILD_SHARED_LIBS=OFF + -DMANUAL_SUBMODULES=ON + -DUSE_DEVICE_TREZOR=$(usex hw-wallet ON OFF) + ) + + use elibc_musl && mycmakeargs+=( -DSTACK_TRACE=OFF ) + + cmake_src_configure +} + +src_compile() { + local targets=() + use daemon && targets+=(daemon) + use tools && targets+=(blockchain_{ancestry,blackball,db,depth,export,import,prune,prune_known_spent_data,stats,usage}) + use wallet-cli && targets+=(simplewallet) + use wallet-rpc && targets+=(wallet_rpc_server) + cmake_build ${targets[@]} +} + +src_install() { + einstalldocs + + # Install all binaries. + find "${BUILD_DIR}/bin/" -type f -executable -print0 | + while IFS= read -r -d '' line; do + dobin "$line" + done + + if use daemon; then + dodoc utils/conf/monerod.conf + + # data-dir + keepdir /var/lib/monero + fowners monero:monero /var/lib/monero + fperms 0755 /var/lib/monero + + # log-file dir + keepdir /var/log/monero + fowners monero:monero /var/log/monero + fperms 0755 /var/log/monero + + # /etc/monero/monerod.conf + insinto /etc/monero + doins "${FILESDIR}/monerod.conf" + + # OpenRC + newconfd "${FILESDIR}/monerod.confd" monerod + newinitd "${FILESDIR}/monerod.initd" monerod + + # systemd + systemd_dounit "${FILESDIR}/monerod.service" + fi +} + +pkg_postinst() { + if use daemon; then + elog "Start the Monero P2P daemon as a system service with" + elog "'rc-service monerod start'. Enable it at startup with" + elog "'rc-update add monerod default'." + elog + elog "Run monerod status as any user to get sync status and other stats." + elog + elog "The Monero blockchain can take up a lot of space (200 GiB) and is stored" + elog "in /var/lib/monero by default. You may want to enable pruning by adding" + elog "'prune-blockchain=1' to /etc/monero/monerod.conf to prune the blockchain" + elog "or move the data directory to another disk." + fi +}