commit: f4c4640b0dedf564946b8cd5a3971dc67b989ceb
Author: Filip Kobierski <fkobi <AT> pm <DOT> me>
AuthorDate: Tue Apr 29 15:29:33 2025 +0000
Commit: Filip Kobierski <fkobi <AT> pm <DOT> me>
CommitDate: Tue Apr 29 15:41:03 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=f4c4640b
net-p2p/p2pool: add 4.4-r1 with improvements
1. USE=daemon with openrc scripts
- disabled by default, the behaviour does not change
2. adjust DEPENDs
- openssl is not needed if USE=ssl
- czmq is not linked to FWICT
- add libsodium & randomx
3. Adjust style to be shorter
Signed-off-by: Filip Kobierski <fkobi <AT> pm.me>
net-p2p/p2pool/files/p2pool.confd | 26 +++++++++
net-p2p/p2pool/files/p2pool.initd | 47 +++++++++++++++++
net-p2p/p2pool/metadata.xml | 3 ++
net-p2p/p2pool/p2pool-4.4-r1.ebuild | 102 ++++++++++++++++++++++++++++++++++++
4 files changed, 178 insertions(+)
diff --git a/net-p2p/p2pool/files/p2pool.confd
b/net-p2p/p2pool/files/p2pool.confd
new file mode 100644
index 000000000..c85f275e7
--- /dev/null
+++ b/net-p2p/p2pool/files/p2pool.confd
@@ -0,0 +1,26 @@
+# /etc/conf.d/p2pool: config file for /etc/init.d/p2pool
+
+# Wallet address to recieve the payouts.
+# Note that it needs to be the primary address (start with 4)
+P2POOL_WALLET=""
+
+# IP address of your Monero node
+#P2POOL_HOST="127.0.0.1"
+
+#P2POOL_USER="monero"
+#P2POOL_GROUP="monero"
+
+#P2POOL_DATADIR="/var/lib/p2pool"
+#P2POOL_LOGLEVEL=1
+
+#P2POOL_NICE=5
+#P2POOL_IONICE=2:4 # See START-STOP-DAEMON(8) for details
+
+#P2POOL_UMASK=007
+
+# Uncomment to have a persistent log.
+# This is not recommended as it does not rotate.
+#P2POOL_KEEPLOG=1
+
+# Extra options passed to the daemon
+#P2POOL_OPTS="--mini"
diff --git a/net-p2p/p2pool/files/p2pool.initd
b/net-p2p/p2pool/files/p2pool.initd
new file mode 100644
index 000000000..d70274e56
--- /dev/null
+++ b/net-p2p/p2pool/files/p2pool.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="Decentralized Monero mining pool daemon"
+command="/usr/bin/${RC_SVCNAME}"
+command_background=1
+command_progress=1
+pidfile="/run/${RC_SVCNAME}.pid"
+retry="SIGTERM/30/SIGKILL/5" # shutting down takes 30s
+
+P2POOL_HOST=${P2POOL_HOST:-127.0.0.1}
+P2POOL_DATADIR=${P2POOL_DATADIR:-/var/lib/p2pool}
+P2POOL_LOGLEVEL=${P2POOL_LOGLEVEL:-1}
+P2POOL_NICE=${P2POOL_NICE:-5}
+P2POOL_IONICE=${P2POOL_IONICE:-2:4}
+
+command_args="--wallet ${P2POOL_WALLET} \
+ --loglevel ${P2POOL_LOGLEVEL} \
+ --data-dir ${P2POOL_DATADIR} \
+ ${P2POOL_OPTS}\
+"
+command_user="${P2POOL_USER:-monero}:${P2POOL_GROUP:-monero}"
+umask=${P2POOL_UMASK:-007}
+start_stop_daemon_args="--nicelevel ${P2POOL_NICE} --ionice ${P2POOL_IONICE}"
+
+
+depend() {
+ need net
+ [ ${P2POOL_HOST} = "127.0.0.1" ] && need monerod
+}
+
+start_pre() {
+ if [ -z ${P2POOL_WALLET} ]; then
+ eerror "p2pool cannot be started without a wallet address"
+ eerror "Please set P2POOL_WALLET in /etc/conf.d/p2pool"
+ false
+ fi
+ einfo "Will mine for wallet ${P2POOL_WALLET}"
+ checkpath --owner ${P2POOL_USER}:${P2POOL_GROUP} \
+ --directory ${P2POOL_DATADIR}
+
+ if [ -z $P2POOL_KEEPLOG ]; then
+ rm --force "${P2POOL_DATADIR}/p2pool.log"
+ fi
+
+}
diff --git a/net-p2p/p2pool/metadata.xml b/net-p2p/p2pool/metadata.xml
index f6c627271..c4ff3cf03 100644
--- a/net-p2p/p2pool/metadata.xml
+++ b/net-p2p/p2pool/metadata.xml
@@ -5,6 +5,9 @@
<email>[email protected]</email>
<name>Adam Pimentel</name>
</maintainer>
+ <use>
+ <flag name="daemon">Install OpenRC scripts allowing for running
p2pool as a system service</flag>
+ </use>
<upstream>
<bugs-to>https://github.com/SChernykh/p2pool/issues</bugs-to>
<changelog>https://github.com/SChernykh/p2pool/releases</changelog>
diff --git a/net-p2p/p2pool/p2pool-4.4-r1.ebuild
b/net-p2p/p2pool/p2pool-4.4-r1.ebuild
new file mode 100644
index 000000000..512a37f5e
--- /dev/null
+++ b/net-p2p/p2pool/p2pool-4.4-r1.ebuild
@@ -0,0 +1,102 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+#TODO: enable/fix GRPC/TLS dependency and add it as USE flag
(https://github.com/SChernykh/p2pool/issues/313)
+# These features build fine in cmake outside of portage, I can't figure
out how to link them here for the life of me.
+# It's probably better to just re-write the CMakeLists.txt to
dynamicially link with gRPC
+
+EAPI=8
+
+inherit cmake verify-sig
+
+DESCRIPTION="Decentralized pool for Monero mining"
+HOMEPAGE="https://p2pool.io"
+SRC_URI="
+
https://github.com/SChernykh/p2pool/releases/download/v${PV}/p2pool_source.tar.xz
-> ${P}.tar.xz
+ verify-sig? (
https://github.com/SChernykh/p2pool/releases/download/v${PV}/sha256sums.txt.asc
-> ${P}_shasums.asc )
+"
+
+LICENSE="BSD GPL-3+ ISC LGPL-3+ MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+#IUSE="grpc tls"
+IUSE="daemon"
+
+DEPEND="
+ dev-libs/libsodium:=
+ dev-libs/libuv:=
+ dev-libs/randomx
+ net-libs/zeromq:=
+ net-misc/curl
+ daemon? (
+ acct-group/monero
+ acct-user/monero
+ )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="verify-sig? ( sec-keys/openpgp-keys-schernykh )"
+
+src_unpack() {
+ if use verify-sig; then
+ local
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/SChernykh.asc
+ pushd "${DISTDIR}" > /dev/null || die
+ verify-sig_verify_message ${P}_shasums.asc - | \
+ tr \\r \\n | \
+ tr '[:upper:]' '[:lower:]' | \
+ sed -n '/p2pool_source/,$p' | \
+ grep -m 1 sha256: | \
+ sed "s/sha256: \(.*\)/\1 ${P}.tar.xz/" | \
+ verify-sig_verify_unsigned_checksums - sha256
${P}.tar.xz
+ assert
+ popd || die
+ fi
+ unpack ${P}.tar.xz
+ mv -T "${WORKDIR}"/{${PN},${P}} || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DSTATIC_BINARY=OFF
+ -DSTATIC_LIBS=OFF
+ -DWITH_GRPC=OFF #$(usex grpc)
+ -DWITH_TLS=OFF #$(usex tls)
+ )
+ cmake_src_configure
+}
+
+src_install(){
+ dobin "${BUILD_DIR}/p2pool"
+
+ if use daemon; then
+ # data-dir
+ keepdir /var/lib/${PN}
+ fowners monero:monero /var/lib/${PN}
+ fperms 0755 /var/lib/${PN}
+
+ # OpenRC
+ newconfd "${FILESDIR}"/${PN}.confd ${PN}
+ newinitd "${FILESDIR}"/${PN}.initd ${PN}
+ fi
+}
+
+pkg_postinst() {
+ #Some important wisdom taken from P2Pool documentation
+ ewarn "P2Pool for Monero is now installed."
+ ewarn "You can run it by doing 'p2pool --host 127.0.0.1 --wallet
YOUR_PRIMARY_ADDRESS'"
+ ewarn "Where 127.0.0.1 is the address of a local monero node (e.g.
monerod)"
+ ewarn ""
+ ewarn "Once configured, point your RandomX miner (e.g. XMRig) at p2pool"
+ ewarn "For example 'xmrig -o 127.0.0.1:3333'"
+ ewarn ""
+ ewarn "You MUST use your primary address when using p2pool, just like
solo mining."
+ ewarn "If you want privacy, create a new mainnet wallet for P2Pool
mining."
+ ewarn ""
+ ewarn "Rewards will not be visible unless you use a wallet that
supports P2Pool."
+ ewarn "See https://p2pool.io/#help and
https://github.com/SChernykh/p2pool for more information."
+
+ if use daemon; then
+ einfo "p2pool supports just OpenRC daemon right now."
+ einfo "To launch it set your wallet address in
/etc/conf.d/${PN} and run"
+ einfo " # rc-service p2pool start"
+ fi
+}