Gentoo Archives: gentoo-commits

From: Theo Anderson <telans@××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-p2p/monero/, net-p2p/monero/files/
Date: Mon, 28 Dec 2020 07:08:18
Message-Id: 1609130975.4f883c8574862e10542d55d41467281465c4ac63.telans@gentoo
1 commit: 4f883c8574862e10542d55d41467281465c4ac63
2 Author: Theo Anderson <telans <AT> posteo <DOT> de>
3 AuthorDate: Mon Dec 28 04:49:35 2020 +0000
4 Commit: Theo Anderson <telans <AT> posteo <DOT> de>
5 CommitDate: Mon Dec 28 04:49:35 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4f883c85
7
8 net-p2p/monero: new package
9
10 Package-Manager: Portage-3.0.12, Repoman-3.0.2
11 Signed-off-by: Theo Anderson <telans <AT> posteo.de>
12
13 net-p2p/monero/Manifest | 4 +
14 .../monero/files/monero-0.17.1.7-linkjobs.patch | 44 +++++++
15 net-p2p/monero/files/monerod.conf | 8 ++
16 net-p2p/monero/files/monerod.confd | 6 +
17 net-p2p/monero/files/monerod.initd | 21 ++++
18 net-p2p/monero/files/monerod.service | 17 +++
19 net-p2p/monero/metadata.xml | 35 ++++++
20 net-p2p/monero/monero-0.17.1.7.ebuild | 135 +++++++++++++++++++++
21 8 files changed, 270 insertions(+)
22
23 diff --git a/net-p2p/monero/Manifest b/net-p2p/monero/Manifest
24 new file mode 100644
25 index 00000000..8dc5d5af
26 --- /dev/null
27 +++ b/net-p2p/monero/Manifest
28 @@ -0,0 +1,4 @@
29 +DIST monero-0.17.1.7.tar.gz 10598750 BLAKE2B 03a80f3c38bc1b643d8d9ddba4ee1de59e0f4c6d66cfc5dcb700d19659a5cb66add4fcf1320c1ed2b7dfa15fdfe9548eb758e67661832f9da7bd0e173b5a0ae1 SHA512 b049a738eb5752a620fc19dfafd5e2996d3f33d89737774264a5ef69b7fcfcd9fe852b89e35187486f48fdc8bb73c2010a1917d1ed7fcb4f1f87b18a6bb4c2d5
30 +DIST monero-randomx-0.17.1.7.tar.gz 163581 BLAKE2B d1a4021a652c95d0af9c6bf2fdab2470641206e908778daafa2640e986d5635bdddfa39f44a6a9542d0c17284cf0551eac3be68a24176f1ba7106611517a080f SHA512 626cc83aa22015049c82811be5d66e96f3d14a413d9cb3eee3c28464fbdef71889b97a6385f24c7cac5fc5a9cada197ba887ae2c0782cec0d3e29debad0f3e91
31 +DIST monero-supercop-0.17.1.7.tar.gz 346604 BLAKE2B 10e48076acb2e5de5acb2efee61b2fac40fdfec3bc4037a94199d56ee2446466126e1b9dade56ee69598f4bd3c64b45d86d0810f24f461f6e09fb84c87e1ef93 SHA512 06cca8d1def31aa11bf5aa42d861c4a027786f7cc494fa3ab53a2bc4bd9d1f55b2389020ba5fd1816ed277b6e4320ad8edbb3117dcf4981fc7fba655c4bbe648
32 +DIST monero-trezor-common-0.17.1.7.tar.gz 1327782 BLAKE2B 738f2833317d5b5f52c21582160c1bee331fda38615c7e2c29d68cec600e849209111aaa75cce059596e87b2711c5a5749d965c91f1cf15cbe98fc86a049b5a5 SHA512 9955aa160e9a969decee598584f788e4d36e9c65f2ee730cd8f128669e86175f2189e804ca53e405871ab698ae5e683f146e59e832d8ec58fa1cb46328665ddf
33
34 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
35 new file mode 100644
36 index 00000000..d0f59a6f
37 --- /dev/null
38 +++ b/net-p2p/monero/files/monero-0.17.1.7-linkjobs.patch
39 @@ -0,0 +1,44 @@
40 +From 12a78e5e745556c29e45b7716a8b038ecfbff800 Mon Sep 17 00:00:00 2001
41 +From: Matt Smith <matt@×××××××××.uk>
42 +Date: Wed, 5 Aug 2020 18:39:44 +0100
43 +Subject: [PATCH] cmake: Use job pool feature to limit concurrent jobs
44 +
45 +Add two new options, MONERO_PARALLEL_COMPILE_JOBS and
46 +MONERO_PARALLEL_LINK_JOBS to try and prevent running out of memory when
47 +building everything.
48 +
49 +Requires >= cmake 3.0.0, and the use of the Ninja generator.
50 +
51 +Useful links:
52 +
53 +* https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html
54 +* https://reviews.llvm.org/D6304
55 +---
56 + CMakeLists.txt | 14 ++++++++++++++
57 + 1 file changed, 14 insertions(+)
58 +
59 +diff --git a/CMakeLists.txt b/CMakeLists.txt
60 +index f63c07a35d..3729a6b659 100644
61 +--- a/CMakeLists.txt
62 ++++ b/CMakeLists.txt
63 +@@ -55,6 +55,20 @@ else()
64 + message(STATUS "ccache deselected")
65 + endif()
66 +
67 ++if (${CMAKE_VERSION} VERSION_GREATER "3.0.0" AND CMAKE_MAKE_PROGRAM MATCHES "ninja")
68 ++ set(MONERO_PARALLEL_COMPILE_JOBS "" CACHE STRING "The maximum number of concurrent compilation jobs.")
69 ++ if (MONERO_PARALLEL_COMPILE_JOBS)
70 ++ set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${MONERO_PARALLEL_COMPILE_JOBS})
71 ++ set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
72 ++ endif ()
73 ++
74 ++ set(MONERO_PARALLEL_LINK_JOBS "" CACHE STRING "The maximum number of concurrent link jobs.")
75 ++ if (MONERO_PARALLEL_LINK_JOBS)
76 ++ set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${MONERO_PARALLEL_LINK_JOBS})
77 ++ set(CMAKE_JOB_POOL_LINK link_job_pool)
78 ++ endif ()
79 ++endif()
80 ++
81 + enable_language(C ASM)
82 +
83 + function (die msg)
84
85 diff --git a/net-p2p/monero/files/monerod.conf b/net-p2p/monero/files/monerod.conf
86 new file mode 100644
87 index 00000000..d019576c
88 --- /dev/null
89 +++ b/net-p2p/monero/files/monerod.conf
90 @@ -0,0 +1,8 @@
91 +# Configuration for monerod
92 +# Syntax: any command line option may be specified as 'clioptionname=value'.
93 +# Boolean options such as 'no-igd' are specified as 'no-igd=1'.
94 +# See 'monerod --help' for all available options.
95 +
96 +data-dir=/var/lib/monero
97 +log-file=/var/log/monero/monero.log
98 +log-level=0
99
100 diff --git a/net-p2p/monero/files/monerod.confd b/net-p2p/monero/files/monerod.confd
101 new file mode 100644
102 index 00000000..94515dcc
103 --- /dev/null
104 +++ b/net-p2p/monero/files/monerod.confd
105 @@ -0,0 +1,6 @@
106 +# Copyright 2020 Gentoo Authors
107 +# Distributed under the terms of the GNU General Public License v2
108 +
109 +monerod_args="--config-file /etc/monero/monerod.conf --non-interactive"
110 +monerod_user=monero
111 +monerod_group=monero
112
113 diff --git a/net-p2p/monero/files/monerod.initd b/net-p2p/monero/files/monerod.initd
114 new file mode 100644
115 index 00000000..c94e6ff4
116 --- /dev/null
117 +++ b/net-p2p/monero/files/monerod.initd
118 @@ -0,0 +1,21 @@
119 +#!/sbin/openrc-run
120 +# Copyright 2020 Gentoo Authors
121 +# Distributed under the terms of the GNU General Public License v2
122 +
123 +pidfile=/var/run/monerod.pid
124 +command=/usr/bin/monerod
125 +command_args="${monerod_args}"
126 +start_stop_daemon_args="-u ${monerod_user} -b -m -p ${pidfile}"
127 +
128 +name="Monero P2P Daemon"
129 +description="Connects to the Monero P2P network"
130 +
131 +depend() {
132 + need localmount
133 + need net
134 +}
135 +
136 +start_pre() {
137 + checkpath --directory --owner ${monerod_user}:${monerod_group} --mode 0755 \
138 + /var/lib/monero /var/log/monero
139 +}
140
141 diff --git a/net-p2p/monero/files/monerod.service b/net-p2p/monero/files/monerod.service
142 new file mode 100644
143 index 00000000..32756049
144 --- /dev/null
145 +++ b/net-p2p/monero/files/monerod.service
146 @@ -0,0 +1,17 @@
147 +[Unit]
148 +Description=Monero P2P Daemon
149 +After=network.target
150 +
151 +[Service]
152 +User=monero
153 +Group=monero
154 +StateDirectory=monero
155 +LogsDirectory=monero
156 +Type=simple
157 +ExecStart=/usr/bin/monerod --config-file /etc/monero/monerod.conf --non-interactive
158 +Restart=on-failure
159 +StandardOutput=null
160 +StandardError=null
161 +
162 +[Install]
163 +WantedBy=multi-user.target
164
165 diff --git a/net-p2p/monero/metadata.xml b/net-p2p/monero/metadata.xml
166 new file mode 100644
167 index 00000000..b865c6e7
168 --- /dev/null
169 +++ b/net-p2p/monero/metadata.xml
170 @@ -0,0 +1,35 @@
171 +<?xml version="1.0" encoding="UTF-8"?>
172 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
173 +<pkgmetadata>
174 + <maintainer type="person">
175 + <email>telans@××××××.de</email>
176 + <name>Theo Anderson</name>
177 + </maintainer>
178 + <longdescription lang="en">
179 + Monero is a private, secure, untraceable, decentralised digital
180 + currency. You are your bank, you control your funds, and nobody
181 + can trace your transfers unless you allow them to do so.
182 + </longdescription>
183 + <use>
184 + <flag name="daemon">
185 + Build the Monero daemon used to connect to the P2P network.
186 + </flag>
187 + <flag name="hw-wallet">
188 + Enable if you want to use a hardware wallet like a Trezor or
189 + Ledger.
190 + </flag>
191 + <flag name="tools">
192 + Build tools used to manipulate the blockchain as it is stored on
193 + disk.
194 + </flag>
195 + <flag name="wallet-cli">
196 + Build the command line wallet, monero-wallet-cli.
197 + </flag>
198 + <flag name="wallet-rpc">
199 + Build the RPC wallet, monero-wallet-rpc.
200 + </flag>
201 + </use>
202 + <upstream>
203 + <remote-id type="github">monero-project/monero</remote-id>
204 + </upstream>
205 +</pkgmetadata>
206
207 diff --git a/net-p2p/monero/monero-0.17.1.7.ebuild b/net-p2p/monero/monero-0.17.1.7.ebuild
208 new file mode 100644
209 index 00000000..63a2009b
210 --- /dev/null
211 +++ b/net-p2p/monero/monero-0.17.1.7.ebuild
212 @@ -0,0 +1,135 @@
213 +# Copyright 1999-2020 Gentoo Authors
214 +# Distributed under the terms of the GNU General Public License v2
215 +
216 +EAPI=7
217 +
218 +inherit cmake systemd
219 +
220 +MY_RANDOMX_REV="5ce5f4906c1eb166be980f6d83cc80f4112ffc2a"
221 +MY_SUPERCOP_REV="633500ad8c8759995049ccd022107d1fa8a1bbc9"
222 +MY_TREZORCOMMON_REV="bff7fdfe436c727982cc553bdfb29a9021b423b0"
223 +
224 +DESCRIPTION="The secure, private, untraceable cryptocurrency"
225 +HOMEPAGE="https://github.com/monero-project/monero"
226 +SRC_URI="
227 + https://github.com/monero-project/monero/archive/v${PV}.tar.gz -> ${P}.tar.gz
228 + https://github.com/tevador/RandomX/archive/${MY_RANDOMX_REV}.tar.gz -> ${PN}-randomx-${PV}.tar.gz
229 + https://github.com/monero-project/supercop/archive/${MY_SUPERCOP_REV}.tar.gz -> ${PN}-supercop-${PV}.tar.gz
230 + hw-wallet? ( https://github.com/trezor/trezor-common/archive/${MY_TREZORCOMMON_REV}.tar.gz -> ${PN}-trezor-common-${PV}.tar.gz )
231 +"
232 +
233 +LICENSE="BSD MIT"
234 +SLOT="0"
235 +KEYWORDS="~amd64 ~arm ~arm64 ~x86"
236 +IUSE="+daemon hw-wallet libressl readline tools +wallet-cli +wallet-rpc"
237 +REQUIRED_USE="|| ( daemon tools wallet-cli wallet-rpc )"
238 +
239 +DEPEND="
240 + acct-group/monero
241 + acct-user/monero
242 + dev-libs/boost:=[nls,threads]
243 + dev-libs/libsodium:=
244 + dev-libs/rapidjson
245 + net-dns/unbound:=[threads]
246 + net-libs/czmq:=
247 + net-libs/miniupnpc
248 + hw-wallet? (
249 + dev-libs/hidapi
250 + dev-libs/protobuf:=
251 + virtual/libusb:1
252 + )
253 + !libressl? ( dev-libs/openssl:= )
254 + libressl? ( dev-libs/libressl:= )
255 + readline? ( sys-libs/readline:0= )
256 +"
257 +RDEPEND="${DEPEND}"
258 +BDEPEND="virtual/pkgconfig"
259 +
260 +PATCHES=("${FILESDIR}/${P}-linkjobs.patch")
261 +
262 +src_unpack() {
263 + unpack ${A}
264 + rmdir "${S}"/external/{randomx,supercop,trezor-common} || die
265 + mv "${WORKDIR}"/RandomX-${MY_RANDOMX_REV} "${S}"/external/randomx || die
266 + mv "${WORKDIR}"/supercop-${MY_SUPERCOP_REV} "${S}"/external/supercop || die
267 + use hw-wallet && (mv "${WORKDIR}"/trezor-common-${MY_TREZORCOMMON_REV} "${S}"/external/trezor-common || die)
268 +}
269 +
270 +src_prepare() {
271 + cmake_src_prepare
272 +
273 + sed -i 's:miniupnp/::' src/p2p/net_node.inl || die
274 + sed -e 's/UPNP_LIBRARIES "libminiupnpc-static/UPNP_LIBRARIES "miniupnpc'/ \
275 + -e '/libminiupnpc-static/d' \
276 + -e '/\/miniupnpc/d' \
277 + -i external/CMakeLists.txt || die
278 +}
279 +
280 +src_configure() {
281 + local mycmakeargs=(
282 + # Monero's liblmdb conflicts with the system liblmdb :(
283 + -DBUILD_SHARED_LIBS=OFF
284 + -DMANUAL_SUBMODULES=ON
285 + -DMONERO_PARALLEL_LINK_JOBS=1
286 + -DUSE_DEVICE_TREZOR=$(usex hw-wallet 1 0)
287 + )
288 +
289 + cmake_src_configure
290 +}
291 +
292 +src_compile() {
293 + local targets=()
294 + use daemon && targets+=(daemon)
295 + use tools && targets+=(blockchain_{ancestry,blackball,db,depth,export,import,prune,prune_known_spent_data,stats,usage})
296 + use wallet-cli && targets+=(simplewallet)
297 + use wallet-rpc && targets+=(wallet_rpc_server)
298 + cmake_build ${targets[@]}
299 +}
300 +
301 +src_install() {
302 + # Install all binaries.
303 + find "${BUILD_DIR}/bin/" -type f -executable -print0 |
304 + while IFS= read -r -d '' line; do
305 + dobin "$line"
306 + done
307 +
308 + if use daemon; then
309 + dodoc utils/conf/monerod.conf
310 +
311 + # data-dir
312 + keepdir /var/lib/monero
313 + fowners monero:monero /var/lib/monero
314 + fperms 0755 /var/lib/monero
315 +
316 + # log-file dir
317 + keepdir /var/log/monero
318 + fowners monero:monero /var/log/monero
319 + fperms 0755 /var/log/monero
320 +
321 + # /etc/monero/monerod.conf
322 + insinto /etc/monero
323 + doins "${FILESDIR}/monerod.conf"
324 +
325 + # OpenRC
326 + newconfd "${FILESDIR}/monerod.confd" monerod
327 + newinitd "${FILESDIR}/monerod.initd" monerod
328 +
329 + # systemd
330 + systemd_dounit "${FILESDIR}/monerod.service"
331 + fi
332 +}
333 +
334 +pkg_postinst() {
335 + if use daemon; then
336 + einfo "Start the Monero P2P daemon as a system service with"
337 + einfo "'rc-service monerod start'. Enable it at startup with"
338 + einfo "'rc-update add monerod default'."
339 + einfo
340 + einfo "Run monerod status as any user to get sync status and other stats."
341 + einfo
342 + einfo "The Monero blockchain can take up a lot of space (80 GiB) and is stored"
343 + einfo "in /var/lib/monero by default. You may want to enable pruning by adding"
344 + einfo "'prune-blockchain=1' to /etc/monero/monerod.conf to prune the blockchain"
345 + einfo "or move the data directory to another disk."
346 + fi
347 +}