net-p2p/monero: new package

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Theo Anderson <telans@posteo.de>
This commit is contained in:
Theo Anderson
2020-12-28 17:49:35 +13:00
parent 0598391345
commit 4f883c8574
8 changed files with 270 additions and 0 deletions

4
net-p2p/monero/Manifest Normal file
View File

@@ -0,0 +1,4 @@
DIST monero-0.17.1.7.tar.gz 10598750 BLAKE2B 03a80f3c38bc1b643d8d9ddba4ee1de59e0f4c6d66cfc5dcb700d19659a5cb66add4fcf1320c1ed2b7dfa15fdfe9548eb758e67661832f9da7bd0e173b5a0ae1 SHA512 b049a738eb5752a620fc19dfafd5e2996d3f33d89737774264a5ef69b7fcfcd9fe852b89e35187486f48fdc8bb73c2010a1917d1ed7fcb4f1f87b18a6bb4c2d5
DIST monero-randomx-0.17.1.7.tar.gz 163581 BLAKE2B d1a4021a652c95d0af9c6bf2fdab2470641206e908778daafa2640e986d5635bdddfa39f44a6a9542d0c17284cf0551eac3be68a24176f1ba7106611517a080f SHA512 626cc83aa22015049c82811be5d66e96f3d14a413d9cb3eee3c28464fbdef71889b97a6385f24c7cac5fc5a9cada197ba887ae2c0782cec0d3e29debad0f3e91
DIST monero-supercop-0.17.1.7.tar.gz 346604 BLAKE2B 10e48076acb2e5de5acb2efee61b2fac40fdfec3bc4037a94199d56ee2446466126e1b9dade56ee69598f4bd3c64b45d86d0810f24f461f6e09fb84c87e1ef93 SHA512 06cca8d1def31aa11bf5aa42d861c4a027786f7cc494fa3ab53a2bc4bd9d1f55b2389020ba5fd1816ed277b6e4320ad8edbb3117dcf4981fc7fba655c4bbe648
DIST monero-trezor-common-0.17.1.7.tar.gz 1327782 BLAKE2B 738f2833317d5b5f52c21582160c1bee331fda38615c7e2c29d68cec600e849209111aaa75cce059596e87b2711c5a5749d965c91f1cf15cbe98fc86a049b5a5 SHA512 9955aa160e9a969decee598584f788e4d36e9c65f2ee730cd8f128669e86175f2189e804ca53e405871ab698ae5e683f146e59e832d8ec58fa1cb46328665ddf

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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
}

View File

@@ -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

View File

@@ -0,0 +1,35 @@
<?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>Theo Anderson</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 if you want to use a hardware wallet like a Trezor or
Ledger.
</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>

View File

@@ -0,0 +1,135 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake systemd
MY_RANDOMX_REV="5ce5f4906c1eb166be980f6d83cc80f4112ffc2a"
MY_SUPERCOP_REV="633500ad8c8759995049ccd022107d1fa8a1bbc9"
MY_TREZORCOMMON_REV="bff7fdfe436c727982cc553bdfb29a9021b423b0"
DESCRIPTION="The secure, private, untraceable cryptocurrency"
HOMEPAGE="https://github.com/monero-project/monero"
SRC_URI="
https://github.com/monero-project/monero/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/tevador/RandomX/archive/${MY_RANDOMX_REV}.tar.gz -> ${PN}-randomx-${PV}.tar.gz
https://github.com/monero-project/supercop/archive/${MY_SUPERCOP_REV}.tar.gz -> ${PN}-supercop-${PV}.tar.gz
hw-wallet? ( https://github.com/trezor/trezor-common/archive/${MY_TREZORCOMMON_REV}.tar.gz -> ${PN}-trezor-common-${PV}.tar.gz )
"
LICENSE="BSD MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
IUSE="+daemon hw-wallet libressl readline tools +wallet-cli +wallet-rpc"
REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )"
DEPEND="
acct-group/monero
acct-user/monero
dev-libs/boost:=[nls,threads]
dev-libs/libsodium:=
dev-libs/rapidjson
net-dns/unbound:=[threads]
net-libs/czmq:=
net-libs/miniupnpc
hw-wallet? (
dev-libs/hidapi
dev-libs/protobuf:=
virtual/libusb:1
)
!libressl? ( dev-libs/openssl:= )
libressl? ( dev-libs/libressl:= )
readline? ( sys-libs/readline:0= )
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=("${FILESDIR}/${P}-linkjobs.patch")
src_unpack() {
unpack ${A}
rmdir "${S}"/external/{randomx,supercop,trezor-common} || die
mv "${WORKDIR}"/RandomX-${MY_RANDOMX_REV} "${S}"/external/randomx || die
mv "${WORKDIR}"/supercop-${MY_SUPERCOP_REV} "${S}"/external/supercop || die
use hw-wallet && (mv "${WORKDIR}"/trezor-common-${MY_TREZORCOMMON_REV} "${S}"/external/trezor-common || die)
}
src_prepare() {
cmake_src_prepare
sed -i 's:miniupnp/::' src/p2p/net_node.inl || die
sed -e 's/UPNP_LIBRARIES "libminiupnpc-static/UPNP_LIBRARIES "miniupnpc'/ \
-e '/libminiupnpc-static/d' \
-e '/\/miniupnpc/d' \
-i external/CMakeLists.txt || die
}
src_configure() {
local mycmakeargs=(
# Monero's liblmdb conflicts with the system liblmdb :(
-DBUILD_SHARED_LIBS=OFF
-DMANUAL_SUBMODULES=ON
-DMONERO_PARALLEL_LINK_JOBS=1
-DUSE_DEVICE_TREZOR=$(usex hw-wallet 1 0)
)
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() {
# 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
einfo "Start the Monero P2P daemon as a system service with"
einfo "'rc-service monerod start'. Enable it at startup with"
einfo "'rc-update add monerod default'."
einfo
einfo "Run monerod status as any user to get sync status and other stats."
einfo
einfo "The Monero blockchain can take up a lot of space (80 GiB) and is stored"
einfo "in /var/lib/monero by default. You may want to enable pruning by adding"
einfo "'prune-blockchain=1' to /etc/monero/monerod.conf to prune the blockchain"
einfo "or move the data directory to another disk."
fi
}