commit:     229763d2256ee36f7f47e09fe8d8b4a46c8cc9c7
Author:     Filip Kobierski <fkobi <AT> pm <DOT> me>
AuthorDate: Sat Jun  7 22:23:44 2025 +0000
Commit:     Filip Kobierski <fkobi <AT> pm <DOT> me>
CommitDate: Sun Jun  8 00:39:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=229763d2

net-p2p/monero: major improvements

ebuild:
- add USE=cpu_flags_x86_aes
- add comment about USE=test restrict
- require acct-{user,group} ony if USE=daemon
- shorten `usex readline`
- fix ineffective USE=readline
- do not build documentation
- disable ccache use
- declare targets more declaratively (src_compile)
- improve elog message by adding quotes for a command
- removed generic openrc elog
- quote just FILESDIR

init.d:
- pidfile: put in /run & guarantee uniqueness
- use command_args_background
- added custom status()

Signed-off-by: Filip Kobierski <fkobi <AT> pm.me>

 net-p2p/monero/files/monerod-0.18.4.0.initd |  13 ++-
 net-p2p/monero/monero-0.18.4.0-r4.ebuild    | 135 ++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+), 3 deletions(-)

diff --git a/net-p2p/monero/files/monerod-0.18.4.0.initd 
b/net-p2p/monero/files/monerod-0.18.4.0.initd
index 4631771b5a..baaea3b7ff 100644
--- a/net-p2p/monero/files/monerod-0.18.4.0.initd
+++ b/net-p2p/monero/files/monerod-0.18.4.0.initd
@@ -5,10 +5,11 @@
 name="Monero P2P Daemon"
 description="Connects to the Monero P2P network"
 
-pidfile=/var/run/monerod.pid
 command=/usr/bin/monerod
+pidfile=/run/${RC_SVCNAME}/${RC_SVCNAME}.pid
+
 command_args="--non-interactive ${MONEROD_ARGS}"
-command_background=1
+command_args_background="--detach --pidfile $pidfile"
 command_progress=1
 command_user="${MONEROD_USER:=monero}:${MONEROD_GROUP:=monero}"
 retry="SIGTERM/30/SIGKILL/5"
@@ -21,5 +22,11 @@ depend() {
 
 start_pre() {
     checkpath --directory --owner ${command_user} --mode 0755 \
-             /var/lib/monero /var/log/monero
+             /var/lib/monero /var/log/monero $(dirname ${pidfile})
+}
+
+status() {
+       if supervise_status; then
+               monerod status
+       fi
 }

diff --git a/net-p2p/monero/monero-0.18.4.0-r4.ebuild 
b/net-p2p/monero/monero-0.18.4.0-r4.ebuild
new file mode 100644
index 0000000000..e5a9939dfa
--- /dev/null
+++ b/net-p2p/monero/monero-0.18.4.0-r4.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2025 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 
cpu_flags_x86_aes"
+REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )"
+RESTRICT="test"
+# Test requires python's requests, psutil, deepdiff which are packaged
+# but also monotonic & zmq which we do not have
+
+DEPEND="
+       app-crypt/libmd
+       dev-libs/boost:=[nls]
+       dev-libs/libsodium:=
+       dev-libs/libbsd
+       dev-libs/openssl:=
+       dev-libs/randomx
+       dev-libs/rapidjson
+       dev-libs/supercop
+       net-dns/unbound:=[threads]
+       net-libs/miniupnpc:=
+       net-libs/zeromq:=
+       daemon? (
+               acct-group/monero
+               acct-user/monero
+       )
+       readline? ( sys-libs/readline:= )
+       hw-wallet? (
+               dev-libs/hidapi
+               dev-libs/protobuf:=
+               virtual/libusb:1
+       )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig
+       <dev-build/cmake-4
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.18.3.3-miniupnp-api-18.patch
+       "${FILESDIR}"/${PN}-0.18.4.0-unbundle-dependencies.patch
+)
+
+src_configure() {
+       local mycmakeargs=(
+               # TODO: Update CMake to install built libraries (help wanted)
+               -DBUILD_SHARED_LIBS=OFF
+               -DMANUAL_SUBMODULES=ON
+               -DUSE_CCACHE=OFF
+               -DNO_AES=$(usex !cpu_flags_x86_aes)
+               -DBUILD_DOCUMENTATION=OFF # we don't install it either way
+               -DUSE_DEVICE_TREZOR=$(usex hw-wallet)
+               -DUSE_READLINE=$(usex readline)
+       )
+
+       use elibc_musl && mycmakeargs+=( -DSTACK_TRACE=OFF )
+
+       cmake_src_configure
+}
+
+src_compile() {
+       local targets=(
+               $(usev daemon)
+               $(usev wallet-cli simplewallet)
+               $(usev wallet-rpc wallet_rpc_server)
+       )
+       use tools && targets+=(
+                       
blockchain_{ancestry,blackball,db,depth,export,import,prune,prune_known_spent_data,stats,usage}
+       )
+
+       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-0.18.4.0.confd monerod
+               newinitd "${FILESDIR}"/monerod-0.18.4.0.initd monerod
+
+               # systemd
+               systemd_dounit "${FILESDIR}"/monerod.service
+       fi
+}
+
+pkg_postinst() {
+       if use daemon; then
+               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 (250 
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
+}

Reply via email to