diff options
author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-04-06 12:44:45 +0200 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-04-06 12:45:06 +0200 |
commit | 5854964e28eeca020fa4b36a52f71e3b6a03dc65 (patch) | |
tree | 26f6761b288584759cc7795d158b66bb1eb7e91b /net-p2p | |
parent | app-metrics/scaphandre: fix LDFLAG QA notice (diff) | |
download | guru-5854964e28eeca020fa4b36a52f71e3b6a03dc65.tar.gz guru-5854964e28eeca020fa4b36a52f71e3b6a03dc65.tar.bz2 guru-5854964e28eeca020fa4b36a52f71e3b6a03dc65.zip |
Revert "net-p2p/monero: treeclean"
This reverts commit 3fa54727e8a7f69d46b81f0544508dc596dd5f11.
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'net-p2p')
-rw-r--r-- | net-p2p/monero/Manifest | 2 | ||||
-rw-r--r-- | net-p2p/monero/files/monero-0.17.1.7-linkjobs.patch | 44 | ||||
-rw-r--r-- | net-p2p/monero/files/monero-0.17.1.7-unbundle-dependencies.patch | 112 | ||||
-rw-r--r-- | net-p2p/monero/files/monero-0.17.2.0-boost-176.patch | 24 | ||||
-rw-r--r-- | net-p2p/monero/files/monerod.conf | 8 | ||||
-rw-r--r-- | net-p2p/monero/files/monerod.confd | 6 | ||||
-rw-r--r-- | net-p2p/monero/files/monerod.initd | 21 | ||||
-rw-r--r-- | net-p2p/monero/files/monerod.service | 17 | ||||
-rw-r--r-- | net-p2p/monero/metadata.xml | 31 | ||||
-rw-r--r-- | net-p2p/monero/monero-0.17.2.0.ebuild | 117 | ||||
-rw-r--r-- | net-p2p/monero/monero-0.17.2.3.ebuild | 117 | ||||
-rw-r--r-- | net-p2p/monero/monero-9999.ebuild | 114 |
12 files changed, 613 insertions, 0 deletions
diff --git a/net-p2p/monero/Manifest b/net-p2p/monero/Manifest new file mode 100644 index 000000000..40e48c455 --- /dev/null +++ b/net-p2p/monero/Manifest @@ -0,0 +1,2 @@ +DIST monero-0.17.2.0.tar.gz 10622184 BLAKE2B c439e447f524a08a7ee79420873b7cf393f5cd3269460944aac30a315ac7c273c12fd809d86d41445bfc7e8c2feb0538d4e9fc1dadeb55f7e09f2920778f07a7 SHA512 85b764f1fc25127e7ca4ada67b1d832a9604c4cf65b160d689650e7ca7bbc36b73d8b26c5409fabdaad7369684997447cd812d1c521fad19d24f5b35f4789a1e +DIST monero-0.17.2.3.tar.gz 10640501 BLAKE2B 15c7b92e7d00788214953c09af96d578e79c65ba9263d2a9ea19cfb9cc65e77d15770b873a10b77aae9e908dce74162d3577ed241600ebd57098b860bfd8f114 SHA512 7f3363c2cb66fa90a47a4cbb03b367182afa63af21d40bf07ea57cd91e4805684ec4795c0390bc966626a3b7b3c0a47167036873f5d1ea4b487a3d02bf01aaa4 diff --git a/net-p2p/monero/files/monero-0.17.1.7-linkjobs.patch b/net-p2p/monero/files/monero-0.17.1.7-linkjobs.patch new file mode 100644 index 000000000..d0f59a6f9 --- /dev/null +++ b/net-p2p/monero/files/monero-0.17.1.7-linkjobs.patch @@ -0,0 +1,44 @@ +From 12a78e5e745556c29e45b7716a8b038ecfbff800 Mon Sep 17 00:00:00 2001 +From: Matt Smith <matt@offtopica.uk> +Date: Wed, 5 Aug 2020 18:39:44 +0100 +Subject: [PATCH] cmake: Use job pool feature to limit concurrent jobs + +Add two new options, MONERO_PARALLEL_COMPILE_JOBS and +MONERO_PARALLEL_LINK_JOBS to try and prevent running out of memory when +building everything. + +Requires >= cmake 3.0.0, and the use of the Ninja generator. + +Useful links: + +* https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html +* https://reviews.llvm.org/D6304 +--- + CMakeLists.txt | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f63c07a35d..3729a6b659 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,6 +55,20 @@ else() + message(STATUS "ccache deselected") + endif() + ++if (${CMAKE_VERSION} VERSION_GREATER "3.0.0" AND CMAKE_MAKE_PROGRAM MATCHES "ninja") ++ set(MONERO_PARALLEL_COMPILE_JOBS "" CACHE STRING "The maximum number of concurrent compilation jobs.") ++ if (MONERO_PARALLEL_COMPILE_JOBS) ++ set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${MONERO_PARALLEL_COMPILE_JOBS}) ++ set(CMAKE_JOB_POOL_COMPILE compile_job_pool) ++ endif () ++ ++ set(MONERO_PARALLEL_LINK_JOBS "" CACHE STRING "The maximum number of concurrent link jobs.") ++ if (MONERO_PARALLEL_LINK_JOBS) ++ set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${MONERO_PARALLEL_LINK_JOBS}) ++ set(CMAKE_JOB_POOL_LINK link_job_pool) ++ endif () ++endif() ++ + enable_language(C ASM) + + function (die msg) diff --git a/net-p2p/monero/files/monero-0.17.1.7-unbundle-dependencies.patch b/net-p2p/monero/files/monero-0.17.1.7-unbundle-dependencies.patch new file mode 100644 index 000000000..ea7f80499 --- /dev/null +++ b/net-p2p/monero/files/monero-0.17.1.7-unbundle-dependencies.patch @@ -0,0 +1,112 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 41f82e26c..3eb2b2e78 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -312,7 +312,7 @@ endif() + # 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) + include_directories(SYSTEM /usr/include/malloc) +@@ -995,7 +995,6 @@ if(SODIUM_LIBRARY) + 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) + +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index a8916a7d0..05ab35c82 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -37,19 +37,7 @@ + + 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_LIBRARIES "miniupnpc" PARENT_SCOPE) + + find_package(Unbound) + +@@ -81,4 +69,3 @@ endif() + add_subdirectory(db_drivers) + add_subdirectory(easylogging++) + add_subdirectory(qrcodegen) +-add_subdirectory(randomx EXCLUDE_FROM_ALL) +diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt +index 3b33fe90a..ba354a0e8 100644 +--- a/src/crypto/CMakeLists.txt ++++ b/src/crypto/CMakeLists.txt +@@ -55,6 +55,7 @@ list(APPEND crypto_sources CryptonightR_template.S) + endif() + + include_directories(${RANDOMX_INCLUDE}) ++include_directories(SYSTEM /usr/include/monero) + + set(crypto_headers) + +@@ -116,6 +117,3 @@ endif() + + # cheat because cmake and ccache hate each other + set_property(SOURCE CryptonightR_template.S PROPERTY LANGUAGE C) +- +-# Must be done last, because it references libraries in this directory +-add_subdirectory(wallet) +diff --git a/src/crypto/wallet/crypto.h b/src/crypto/wallet/crypto.h +index a4c5d5a07..5c6b96cd8 100644 +--- a/src/crypto/wallet/crypto.h ++++ b/src/crypto/wallet/crypto.h +@@ -29,7 +29,6 @@ + #pragma once + + #include <cstddef> +-#include "crypto/wallet/ops.h" + + namespace crypto { + namespace wallet { +diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt +index ff2afba4b..26b0f4523 100644 +--- a/src/device/CMakeLists.txt ++++ b/src/device/CMakeLists.txt +@@ -72,7 +72,7 @@ target_link_libraries(device + ${HIDAPI_LIBRARIES} + cncrypto + ringct_basic +- wallet-crypto ++ monero-crypto + ${OPENSSL_CRYPTO_LIBRARIES} + ${Boost_SERIALIZATION_LIBRARY} + PRIVATE +diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl +index 65db2615c..3ace310f6 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" diff --git a/net-p2p/monero/files/monero-0.17.2.0-boost-176.patch b/net-p2p/monero/files/monero-0.17.2.0-boost-176.patch new file mode 100644 index 000000000..07a584a39 --- /dev/null +++ b/net-p2p/monero/files/monero-0.17.2.0-boost-176.patch @@ -0,0 +1,24 @@ +From c28d2f7c110c0a2161fa02d6c20df94a60a41965 Mon Sep 17 00:00:00 2001 +From: loqs <loqs@users.noreply.github.com> +Date: Sun, 23 May 2021 20:29:17 +0100 +Subject: [PATCH] Fix boost 1.76.0 compatibility + +Add missing header boost/mpl/contains.hpp +monero-project/monero/issues/7728 +--- + contrib/epee/include/storages/portable_storage.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/contrib/epee/include/storages/portable_storage.h b/contrib/epee/include/storages/portable_storage.h +index 1e68605abf5..801bb2c3465 100644 +--- a/contrib/epee/include/storages/portable_storage.h ++++ b/contrib/epee/include/storages/portable_storage.h +@@ -40,6 +40,8 @@ + #include "span.h" + #include "int-util.h" + ++#include <boost/mpl/contains.hpp> ++ + namespace epee + { + namespace serialization diff --git a/net-p2p/monero/files/monerod.conf b/net-p2p/monero/files/monerod.conf new file mode 100644 index 000000000..d019576c6 --- /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 000000000..94515dcc2 --- /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 000000000..c94e6ff46 --- /dev/null +++ b/net-p2p/monero/files/monerod.initd @@ -0,0 +1,21 @@ +#!/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}" + +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 000000000..327560497 --- /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 000000000..7b6989c63 --- /dev/null +++ b/net-p2p/monero/metadata.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>telans@posteo.de</email> + <name>James Beddek</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="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.17.2.0.ebuild b/net-p2p/monero/monero-0.17.2.0.ebuild new file mode 100644 index 000000000..6107e459f --- /dev/null +++ b/net-p2p/monero/monero-0.17.2.0.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +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 readline +tools +wallet-cli +wallet-rpc" +REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )" +RESTRICT="test" + +DEPEND=" + acct-group/monero + acct-user/monero + dev-libs/boost:=[nls,threads] + 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= ) +" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${PN}-0.17.1.7-unbundle-dependencies.patch" + "${FILESDIR}/${PN}-0.17.2.0-boost-176.patch" +) + +src_configure() { + local mycmakeargs=( + # TODO: Update CMake to install built libraries (help wanted) + -DBUILD_SHARED_LIBS=OFF + -DMANUAL_SUBMODULES=ON + -DMONERO_PARALLEL_LINK_JOBS=1 + -DUSE_DEVICE_TREZOR=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 (80 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 +} diff --git a/net-p2p/monero/monero-0.17.2.3.ebuild b/net-p2p/monero/monero-0.17.2.3.ebuild new file mode 100644 index 000000000..54a108f49 --- /dev/null +++ b/net-p2p/monero/monero-0.17.2.3.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +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 readline +tools +wallet-cli +wallet-rpc" +REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )" +RESTRICT="test" + +DEPEND=" + acct-group/monero + acct-user/monero + dev-libs/boost:=[nls,threads(+)] + 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= ) +" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}/${PN}-0.17.1.7-unbundle-dependencies.patch" + "${FILESDIR}/${PN}-0.17.2.0-boost-176.patch" +) + +src_configure() { + local mycmakeargs=( + # TODO: Update CMake to install built libraries (help wanted) + -DBUILD_SHARED_LIBS=OFF + -DMANUAL_SUBMODULES=ON + -DMONERO_PARALLEL_LINK_JOBS=1 + -DUSE_DEVICE_TREZOR=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 (80 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 +} diff --git a/net-p2p/monero/monero-9999.ebuild b/net-p2p/monero/monero-9999.ebuild new file mode 100644 index 000000000..1ee22fc10 --- /dev/null +++ b/net-p2p/monero/monero-9999.ebuild @@ -0,0 +1,114 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +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 readline +tools +wallet-cli +wallet-rpc" +REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )" +RESTRICT="test" + +DEPEND=" + acct-group/monero + acct-user/monero + dev-libs/boost:=[nls,threads] + 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= ) +" +RDEPEND="${DEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( "${FILESDIR}/${PN}-0.17.1.7-unbundle-dependencies.patch" ) + +src_configure() { + local mycmakeargs=( + # TODO: Update CMake to install built libraries (help wanted) + -DBUILD_SHARED_LIBS=OFF + -DMANUAL_SUBMODULES=ON + -DMONERO_PARALLEL_LINK_JOBS=1 + -DUSE_DEVICE_TREZOR=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 (80 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 +} |