From 4c5e0520b3ae5cce70461c3f7fceb313186d6ea2 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 7 Mar 2024 19:06:59 +0000 Subject: gentoo auto-resync : 07:03:2024 - 19:06:58 --- net-p2p/bitcoin-core/Manifest | 8 +- net-p2p/bitcoin-core/bitcoin-core-25.1-r1.ebuild | 397 -------------------- net-p2p/bitcoin-core/bitcoin-core-25.1-r2.ebuild | 402 ++++++++++++++++++++ net-p2p/bitcoin-core/bitcoin-core-25.2_rc1.ebuild | 413 +++++++++++++++++++++ net-p2p/bitcoin-core/bitcoin-core-26.0-r1.ebuild | 422 +++++++++++++++++++++ net-p2p/bitcoin-core/bitcoin-core-26.0.ebuild | 417 --------------------- net-p2p/bitcoin-core/bitcoin-core-26.1_rc1.ebuild | 424 ++++++++++++++++++++++ 7 files changed, 1667 insertions(+), 816 deletions(-) delete mode 100644 net-p2p/bitcoin-core/bitcoin-core-25.1-r1.ebuild create mode 100644 net-p2p/bitcoin-core/bitcoin-core-25.1-r2.ebuild create mode 100644 net-p2p/bitcoin-core/bitcoin-core-25.2_rc1.ebuild create mode 100644 net-p2p/bitcoin-core/bitcoin-core-26.0-r1.ebuild delete mode 100644 net-p2p/bitcoin-core/bitcoin-core-26.0.ebuild create mode 100644 net-p2p/bitcoin-core/bitcoin-core-26.1_rc1.ebuild (limited to 'net-p2p/bitcoin-core') diff --git a/net-p2p/bitcoin-core/Manifest b/net-p2p/bitcoin-core/Manifest index 8b85a7483549..82e8cc705076 100644 --- a/net-p2p/bitcoin-core/Manifest +++ b/net-p2p/bitcoin-core/Manifest @@ -8,6 +8,10 @@ AUX init.patch 1472 BLAKE2B 5974542d0890234ccb2cbbcbe022c45c94e5f0235ebb3b7cee3e AUX org.bitcoin.bitcoin-qt.desktop 465 BLAKE2B 7ce8818cd967e478e6d41106b7111616b81856ae83db742ee53a28dde203cc6a2230daa562c78e7b59d1014bfe1633b4074685acb404966b2b9649c22c356262 SHA512 4f9e20094a6fb99dc47a799c9fd752d328efa2539aaab2230f9225cb80f8889fa7a28e1277694d04db72f7a052d208d6a208671dd3d0c77a9ec9d7a95169f148 DIST bitcoin-25.1.tar.gz 12498596 BLAKE2B e8e4ea99cb40db420033c4df75e985af93cbb64f9862376e2de1a0731b4aeafbf43a95b33770e882ad77b73e454d48dbd5744902c78ade2b965e3d2d4e4b4656 SHA512 310e5d976a062496d2b99d0e64c4d5d2b536a747901e887f85b75151d94237f0de800163b534c812d390eb5e93b3f7284cd7f71843ec35e891f34634b6b142ab DIST bitcoin-26.0.tar.gz 12753904 BLAKE2B 35b5d40390dc5eab18a12b0f120619d40d9d0eaf4a59f5ed943a59189c0ede5d78207b7606f1c3490b90f14c17e87882242d6637fdc348005a6f60a1d8202d13 SHA512 31b7bc66b43d073611ccf19adc80a4dd3ce3a4b5cf4c8b814f4be9e771e88721d20ae0aa83d89cd8d55ffaf0853444479932b425e82081fd66bb037c6b53e4a8 -EBUILD bitcoin-core-25.1-r1.ebuild 12483 BLAKE2B 93b1c976919b2ae0622b8922a06c66df9a8df547118b4c50041ffbb6c780752234a277cc511c0686c87a611350805d0136f262896232945cf2da84309f0a7106 SHA512 baa3923dd2fd39fa70935d72efef79a7f65660c6e45fc3cc19c052e8d3fa9d8ad17a354acfca81025dae0675bcc6258be93f107154f4b1a339ae875e69235b98 -EBUILD bitcoin-core-26.0.ebuild 12917 BLAKE2B d01cae60f3b4455cab145390e5b4f5d4d3eaa7c42d166db8b2b47e92392122b10aa1a2e440aa04aa779b5f05679cab2e695177bc4284dda4ffb43034ac1281b3 SHA512 25adb7e8452276c22094ea394c46ca2f636998a76627312fbd48b09b4e15c974d34a8027b1e53c21dfeded911d5f462f131e46dbeb61703a6ea4ea57d84d4418 +DIST bitcoin-core-25.2_rc1.tar.gz 12499745 BLAKE2B db05eb84f80aebfcbb269367ac95f8e9f710210ddb99ea44755344260be3000e0c41cf9e458fb66288f8e206a376f63b2e486ff430daee4719d201b2c18f435e SHA512 40c1b13f887d7229742155d48946e42adedf1431d92acc322426a4df38625f7acabff226a70d2a864ea12d34a16b67d657db3274891c313534c46f64e7b07a3a +DIST bitcoin-core-26.1_rc1.tar.gz 12816436 BLAKE2B 05a3c774901f75368a42f4f81b2dcf181efc1db4f82b230bca1c5f78ee9a310e00654960fdab368eb169bbc283628f9c5a020d1e7c7abcad6fe15ca4feba01c5 SHA512 5f93bc3061e93c57d65c00c458c39ede19e1908a25804b2191ed4866a7cf92438b068de15e8685a37d38608d750be3ce64d3e7cc22418e27b47ed65d9bcb7557 +EBUILD bitcoin-core-25.1-r2.ebuild 12629 BLAKE2B ca23ce3077968fd5be33f331ca0ca56414a7cbedc8be85dd495f5a4da7d15317dcae5fbc3ba493e43cd77e43208650ba8d8a7c5185e4f04bb897594ca70e1396 SHA512 8dd9d7a39fa36ed915577f52e08cf9af1c2bf4acc04cf8a0f84f1409ebd88e24cb7252ab68aff7c307e9a979742890d61919551f78390852f77735a703602088 +EBUILD bitcoin-core-25.2_rc1.ebuild 12845 BLAKE2B 85749f2ad79af48347c65ef114d4a2406538fc7c7faa704b610e8cb3abcf96df7961ee2b97eaec59745258f6ed782d5109417ac478fd4d832ad124b4981435dd SHA512 8cdd2c497a25bf47cdf78c0ec2cc82f2092c1a8fd331d631f44b92d9cda246ec8c9607b609ff7e00d8eee1cf82087644bda55fddf95c42e537d25468c7916301 +EBUILD bitcoin-core-26.0-r1.ebuild 13052 BLAKE2B 6f4863f10ac953c7b9520463cafc139f5b4cfa3fc0f36e0ac8bc4c8a761e3bc40d1742d5ba28169f94412cf4163b29e89319b511f19e9cdcb5b1df28f4e95401 SHA512 2a7abe6b9916a42165578e45e72be33f3a408224e400d45a47bb825be3cac0494829daf512f241d92ab2983db5f646222cfe429da4e1012d56641f4315e99f67 +EBUILD bitcoin-core-26.1_rc1.ebuild 13104 BLAKE2B efd0c9acecb52a1ee8a5de0ee21b21301cb1f55681c749516e93f78e7008841cad502f1e89fd2a9cdca057608b3b4680a86c81e5acfa0a906a370d3b61f3d2c2 SHA512 198dac6e37f5ebca036a4c99109561979d22cd28101fa5978b6b79733e9c564ab6c8a2d1cde6e3974dd8a2f237dee95d6ffed3674d6637065e01b697bdb1a46c MISC metadata.xml 1652 BLAKE2B 7d0646991b669df16ef19516b3fdc177379cae6388fdb67e365abe6db7f79888d934ef55f6e03cb8943b30d4f0cd29d4f2a0c03db7702a5167648a18c3218732 SHA512 1f4c73c07f874c322a99f8c929fceacb52fb2fc7be3475ec49512edd7f29e2fb8f58a04760f4b43e483181039ece66779b87f5dc77cdd14c465ce0ffb5d5bd8a diff --git a/net-p2p/bitcoin-core/bitcoin-core-25.1-r1.ebuild b/net-p2p/bitcoin-core/bitcoin-core-25.1-r1.ebuild deleted file mode 100644 index 688ac7bf25d3..000000000000 --- a/net-p2p/bitcoin-core/bitcoin-core-25.1-r1.ebuild +++ /dev/null @@ -1,397 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{10..12} ) - -inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd xdg-utils - -DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" -HOMEPAGE="https://bitcoincore.org/" -SRC_URI="https://bitcoincore.org/bin/${P}/${P/-core}.tar.gz" -S="${WORKDIR}/${P/-core}" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 x86 ~amd64-linux ~x86-linux" -# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 -IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" -RESTRICT="!test? ( test )" - -REQUIRED_USE=" - dbus? ( gui ) - kde? ( gui ) - qrcode? ( gui ) - system-leveldb? ( || ( daemon gui ) ) -" -# dev-libs/univalue is now bundled, as upstream dropped support for system copy -# and their version in the Bitcoin repo has deviated a fair bit from upstream. -# Upstream also seems very inactive. -RDEPEND=" - !=dev-libs/boost-1.81.0:= - >=dev-libs/libevent-2.1.12:= - berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) - bitcoin-cli? ( !=dev-qt/qtcore-5.15.5:5 - >=dev-qt/qtgui-5.15.5:5 - >=dev-qt/qtnetwork-5.15.5:5 - >=dev-qt/qtwidgets-5.15.5:5 - dbus? ( >=dev-qt/qtdbus-5.15.5:5 ) - ) - libs? ( !=net-libs/libnatpmp-20220705:= ) - qrcode? ( >=media-gfx/qrencode-4.1.1:= ) - sqlite? ( >=dev-db/sqlite-3.38.5:= ) - system-leveldb? ( virtual/bitcoin-leveldb ) - system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.3.1:=[recovery,schnorr] ) - upnp? ( >=net-libs/miniupnpc-2.2.2:= ) - zeromq? ( >=net-libs/zeromq-4.3.4:= ) -" -DEPEND=" - ${RDEPEND} - systemtap? ( >=dev-debug/systemtap-4.8 ) -" -BDEPEND=" - virtual/pkgconfig - daemon? ( - acct-group/bitcoin - acct-user/bitcoin - ) - gui? ( >=dev-qt/linguist-tools-5.15.5:5 ) - test? ( ${PYTHON_DEPS} ) -" -IDEPEND=" - gui? ( dev-util/desktop-file-utils ) -" - -DOCS=( - doc/bips.md - doc/bitcoin-conf.md - doc/descriptors.md - doc/files.md - doc/i2p.md - doc/JSON-RPC-interface.md - doc/multisig-tutorial.md - doc/p2p-bad-ports.md - doc/psbt.md - doc/reduce-memory.md - doc/reduce-traffic.md - doc/release-notes.md - doc/REST-interface.md - doc/tor.md -) - -PATCHES=( - "${FILESDIR}/25.0-syslibs.patch" - "${FILESDIR}/init.patch" -) - -efmt() { - : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") -} - -pkg_pretend() { - if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then - efmt ewarn <<-EOF - You are enabling neither USE="daemon" nor USE="gui". This is a valid - configuration, but you will be unable to run a Bitcoin node using this - installation. - EOF - fi - if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then - efmt ewarn <<-EOF - You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid - configuration, but you will be unable to interact with your bitcoind node - via the command line using this installation. - EOF - fi - if ! use berkdb && ! use sqlite && - { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || - { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } - then - efmt ewarn <<-EOF - You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid - configuration, but your Bitcoin node will be unable to open any wallets. - EOF - fi - - # test/functional/feature_pruning.py requires 4 GB disk space - # test/functional/wallet_pruning.py requires 1.3 GB disk space - use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend -} - -pkg_setup() { - if use test ; then - CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup - python-any-r1_pkg_setup - fi -} - -src_prepare() { - default - ! use system-leveldb || rm -r src/leveldb || die - if use system-libsecp256k1 ; then - rm -r src/secp256k1 || die - sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die - else - pushd src/secp256k1 >/dev/null || die - AT_NOELIBTOOLIZE=yes eautoreconf - popd >/dev/null || die - fi - eautoreconf - - # we say --disable-util-util, so we can't test bitcoin-util - sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ - -i test/util/data/bitcoin-util-test.json || die - - sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ - -i contrib/completions/bash/bitcoind.bash-completion || die -} - -src_configure() { - local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi - local myeconfargs=( - --disable-static - --${wallet}-wallet - $(use_with sqlite) - $(use_with berkdb bdb) - $(use_enable systemtap usdt) - $(use_with upnp miniupnpc) - $(use_with nat-pmp natpmp) - $(use_enable test tests) - --disable-bench - --disable-fuzz{,-binary} - $(use_with qrcode qrencode) - --disable-ccache - $(use_enable asm) - $(use_enable zeromq zmq) - $(use_enable man) - $(use_enable external-signer) - --with-utils - $(use_enable {bitcoin,util}-cli) - --enable-util-tx - --${wallet}-util-wallet - --disable-util-util - # syscall sandbox is missing faccessat2 and pselect6, causing bitcoind to crash during tests; - # removed upstream for 26.0 in https://github.com/bitcoin/bitcoin/commit/32e2ffc39374f61bb2435da507f285459985df9e - --without-seccomp - $(use_with libs) - $(use_with daemon) - $(use_with gui gui qt5) - $(use_with dbus qtdbus) - $(use_with system-leveldb) - $(use_with system-libsecp256k1) - ) - econf "${myeconfargs[@]}" -} - -src_test() { - emake check - - use daemon && edo "${PYTHON}" test/functional/test_runner.py \ - --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" -} - -src_install() { - use external-signer && DOCS+=( doc/external-signer.md ) - use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) - use libs && DOCS+=( doc/shared-libraries.md ) - use systemtap && DOCS+=( doc/tracing.md ) - use zeromq && DOCS+=( doc/zmq.md ) - - if use daemon ; then - # https://bugs.gentoo.org/757102 - DOCS+=( share/rpcauth/rpcauth.py ) - docompress -x "/usr/share/doc/${PF}/rpcauth.py" - fi - - default - - find "${ED}" -type f -name '*.la' -delete || die - ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die - - newbashcomp contrib/completions/bash/bitcoin-tx.bash-completion bitcoin-tx - use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash-completion bitcoin-cli - use daemon || use gui && newbashcomp contrib/completions/bash/bitcoind.bash-completion bitcoind - - if use daemon ; then - insinto /etc/bitcoin - sed -ne 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ - share/examples/bitcoin.conf >"${ED}/etc/bitcoin/bitcoin.conf" || die - fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf - fperms 0660 /etc/bitcoin/bitcoin.conf - - newconfd contrib/init/bitcoind.openrcconf bitcoind - newinitd "${FILESDIR}/bitcoind.openrc" bitcoind - systemd_newunit contrib/init/bitcoind.service bitcoind.service - - keepdir /var/lib/bitcoind - fperms 0750 /var/lib/bitcoind - fowners bitcoin:bitcoin /var/lib/bitcoind - dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf - - insinto /etc/logrotate.d - newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind - fi - - if use gui ; then - insinto /usr/share/icons/hicolor/scalable/apps - newins src/qt/res/src/bitcoin.svg bitcoin128.svg - - domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" - - if use kde ; then - insinto /usr/share/kservices5 - doins "${FILESDIR}/bitcoin-qt.protocol" - fi - fi - - if use examples ; then - docinto examples - dodoc -r contrib/{linearize,qos} - use zeromq && dodoc -r contrib/zmq - fi -} - -pkg_preinst() { - if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then - if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then - dosym -r /var/lib/bitcoin{d,/.bitcoin} - elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then - efmt ewarn <<-EOF - Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, - a deprecated location. To perform an automated migration to - ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances - that may be using the deprecated path, and then run: - - # emerge --config ${CATEGORY}/${PN} - EOF - insinto /var/lib/bitcoin - mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die - dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf - dosym -r /var/lib/bitcoin{/.bitcoin,d} - fi - fi - - if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then - dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol - fi -} - -pkg_postinst() { - # we don't use xdg.eclass because it adds unconditional IDEPENDs - if use gui ; then - xdg_desktop_database_update - xdg_icon_cache_update - fi - - if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then - efmt -su elog <<-EOF - To have ${PN} automatically use Tor when it's running, be sure your \ - 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ - correctly, and: - - Using an init script: add the 'bitcoin' user to the 'tor' user group. - - Running bitcoind directly: add that user to the 'tor' user group. - EOF - fi - - if use bitcoin-cli && use daemon ; then - efmt -su elog <<-EOF - To use bitcoin-cli with the /etc/init.d/bitcoind service: - - Add your user(s) to the 'bitcoin' group. - - Symlink ~/.bitcoin to /var/lib/bitcoind. - EOF - fi -} - -pkg_postrm() { - if use gui ; then - xdg_desktop_database_update - xdg_icon_cache_update - fi -} - -pkg_config() { - if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && - [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] - then - in_use() { - : ${1:?} ; local each - if command -v fuser >/dev/null ; then - fuser "${@}" >/dev/null 2>&1 - elif command -v lsof >/dev/null ; then - for each ; do - lsof -- "${each}" && return - done >/dev/null 2>&1 - elif mountpoint -q /proc ; then - { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + - awk '{ print $6 }' /proc/[0-9]*/maps - } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") - else - return 13 - fi - } - ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" - in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} - case $? in - 0) - eend 1 - efmt eerror <<-EOF - ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any - running bitcoind instances that may be using this data directory, and then - retry this migration. - EOF - die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" - ;; - 13) - eend 1 - if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then - efmt eerror <<-EOF - Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. - Do you have /proc mounted? To force the migration without checking, re-run - this command with BITCOIND_IS_NOT_RUNNING=1. - EOF - die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" - fi - ;; - *) - eend 0 - ;; - esac - - # find all relative symlinks that point outside the data dir - local -A symlinks - cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die - local each ; while read -r -d '' each ; do - local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && - target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && - symlinks["${each}"]="${target}" - done < <(find -type l -print0) - - einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." - rm -f -- "${EROOT}/var/lib/bitcoind" || die - mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || - die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." - - # fix up the relative symlinks - cd -- "${EROOT}/var/lib/bitcoind" || die - for each in "${!symlinks[@]}" ; do - ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails - done - - einfo 'Creating a transitional symlink for your convenience.' - ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} - einfo 'You may remove this link when you no longer need it.' - else - einfo 'Nothing to do.' - fi -} diff --git a/net-p2p/bitcoin-core/bitcoin-core-25.1-r2.ebuild b/net-p2p/bitcoin-core/bitcoin-core-25.1-r2.ebuild new file mode 100644 index 000000000000..1b14729e0a7c --- /dev/null +++ b/net-p2p/bitcoin-core/bitcoin-core-25.1-r2.ebuild @@ -0,0 +1,402 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd xdg-utils + +DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" +HOMEPAGE="https://bitcoincore.org/" +SRC_URI="https://bitcoincore.org/bin/${P}/${P/-core}.tar.gz" +S="${WORKDIR}/${P/-core}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 x86 ~amd64-linux ~x86-linux" +# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 +IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + dbus? ( gui ) + kde? ( gui ) + qrcode? ( gui ) + system-leveldb? ( || ( daemon gui ) ) +" +# dev-libs/univalue is now bundled, as upstream dropped support for system copy +# and their version in the Bitcoin repo has deviated a fair bit from upstream. +# Upstream also seems very inactive. +RDEPEND=" + !=dev-libs/boost-1.81.0:= + >=dev-libs/libevent-2.1.12:= + berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) + bitcoin-cli? ( !=dev-qt/qtcore-5.15.5:5 + >=dev-qt/qtgui-5.15.5:5 + >=dev-qt/qtnetwork-5.15.5:5 + >=dev-qt/qtwidgets-5.15.5:5 + dbus? ( >=dev-qt/qtdbus-5.15.5:5 ) + ) + libs? ( !=net-libs/libnatpmp-20220705:= ) + qrcode? ( >=media-gfx/qrencode-4.1.1:= ) + sqlite? ( >=dev-db/sqlite-3.38.5:= ) + system-leveldb? ( virtual/bitcoin-leveldb ) + system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.3.1:=[recovery,schnorr] ) + upnp? ( >=net-libs/miniupnpc-2.2.2:= ) + zeromq? ( >=net-libs/zeromq-4.3.4:= ) +" +DEPEND=" + ${RDEPEND} + systemtap? ( >=dev-debug/systemtap-4.8 ) +" +BDEPEND=" + virtual/pkgconfig + daemon? ( + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( >=dev-qt/linguist-tools-5.15.5:5 ) + test? ( ${PYTHON_DEPS} ) +" +IDEPEND=" + gui? ( dev-util/desktop-file-utils ) +" + +DOCS=( + doc/bips.md + doc/bitcoin-conf.md + doc/descriptors.md + doc/files.md + doc/i2p.md + doc/JSON-RPC-interface.md + doc/multisig-tutorial.md + doc/p2p-bad-ports.md + doc/psbt.md + doc/reduce-memory.md + doc/reduce-traffic.md + doc/release-notes.md + doc/REST-interface.md + doc/tor.md +) + +PATCHES=( + "${FILESDIR}/25.0-syslibs.patch" + "${FILESDIR}/init.patch" +) + +efmt() { + : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") +} + +pkg_pretend() { + if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then + efmt ewarn <<-EOF + You are enabling neither USE="daemon" nor USE="gui". This is a valid + configuration, but you will be unable to run a Bitcoin node using this + installation. + EOF + fi + if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then + efmt ewarn <<-EOF + You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid + configuration, but you will be unable to interact with your bitcoind node + via the command line using this installation. + EOF + fi + if ! use berkdb && ! use sqlite && + { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || + { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } + then + efmt ewarn <<-EOF + You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid + configuration, but your Bitcoin node will be unable to open any wallets. + EOF + fi + + # test/functional/feature_pruning.py requires 4 GB disk space + # test/functional/wallet_pruning.py requires 1.3 GB disk space + use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend +} + +pkg_setup() { + if use test ; then + CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup + python-any-r1_pkg_setup + fi +} + +src_prepare() { + default + ! use system-leveldb || rm -r src/leveldb || die + if use system-libsecp256k1 ; then + rm -r src/secp256k1 || die + sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die + else + pushd src/secp256k1 >/dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd >/dev/null || die + fi + eautoreconf + + # we say --disable-util-util, so we can't test bitcoin-util + sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ + -i test/util/data/bitcoin-util-test.json || die + + sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ + -i contrib/completions/bash/bitcoind.bash-completion || die +} + +src_configure() { + local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi + local myeconfargs=( + --disable-static + --${wallet}-wallet + $(use_with sqlite) + $(use_with berkdb bdb) + $(use_enable systemtap usdt) + $(use_with upnp miniupnpc) + $(use_with nat-pmp natpmp) + $(use_enable test tests) + --disable-bench + --disable-fuzz{,-binary} + $(use_with qrcode qrencode) + --disable-ccache + $(use_enable asm) + $(use_enable zeromq zmq) + $(use_enable man) + $(use_enable external-signer) + --with-utils + $(use_enable {bitcoin,util}-cli) + --enable-util-tx + --${wallet}-util-wallet + --disable-util-util + # syscall sandbox is missing faccessat2 and pselect6, causing bitcoind to crash during tests; + # removed upstream for 26.0 in https://github.com/bitcoin/bitcoin/commit/32e2ffc39374f61bb2435da507f285459985df9e + --without-seccomp + $(use_with libs) + $(use_with daemon) + $(use_with gui gui qt5) + $(use_with dbus qtdbus) + $(use_with system-leveldb) + $(use_with system-libsecp256k1) + ) + econf "${myeconfargs[@]}" +} + +src_test() { + emake check + + use daemon && edo "${PYTHON}" test/functional/test_runner.py \ + --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" +} + +src_install() { + use external-signer && DOCS+=( doc/external-signer.md ) + use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) + use libs && DOCS+=( doc/shared-libraries.md ) + use systemtap && DOCS+=( doc/tracing.md ) + use zeromq && DOCS+=( doc/zmq.md ) + + if use daemon ; then + # https://bugs.gentoo.org/757102 + DOCS+=( share/rpcauth/rpcauth.py ) + docompress -x "/usr/share/doc/${PF}/rpcauth.py" + fi + + default + + find "${ED}" -type f -name '*.la' -delete || die + ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die + + newbashcomp contrib/completions/bash/bitcoin-tx.bash-completion bitcoin-tx + use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash-completion bitcoin-cli + if use daemon ; then + newbashcomp contrib/completions/bash/bitcoind.bash-completion bitcoind + use gui && bashcomp_alias bitcoind bitcoin-qt + elif use gui ; then + newbashcomp contrib/completions/bash/bitcoind.bash-completion bitcoin-qt + fi + + if use daemon ; then + insinto /etc/bitcoin + sed -ne 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ + share/examples/bitcoin.conf >"${ED}/etc/bitcoin/bitcoin.conf" || die + fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf + fperms 0660 /etc/bitcoin/bitcoin.conf + + newconfd contrib/init/bitcoind.openrcconf bitcoind + newinitd "${FILESDIR}/bitcoind.openrc" bitcoind + systemd_newunit contrib/init/bitcoind.service bitcoind.service + + keepdir /var/lib/bitcoind + fperms 0750 /var/lib/bitcoind + fowners bitcoin:bitcoin /var/lib/bitcoind + dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf + + insinto /etc/logrotate.d + newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind + fi + + if use gui ; then + insinto /usr/share/icons/hicolor/scalable/apps + newins src/qt/res/src/bitcoin.svg bitcoin128.svg + + domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" + + if use kde ; then + insinto /usr/share/kservices5 + doins "${FILESDIR}/bitcoin-qt.protocol" + fi + fi + + if use examples ; then + docinto examples + dodoc -r contrib/{linearize,qos} + use zeromq && dodoc -r contrib/zmq + fi +} + +pkg_preinst() { + if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + dosym -r /var/lib/bitcoin{d,/.bitcoin} + elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then + efmt ewarn <<-EOF + Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, + a deprecated location. To perform an automated migration to + ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances + that may be using the deprecated path, and then run: + + # emerge --config ${CATEGORY}/${PN} + EOF + insinto /var/lib/bitcoin + mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die + dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf + dosym -r /var/lib/bitcoin{/.bitcoin,d} + fi + fi + + if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then + dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol + fi +} + +pkg_postinst() { + # we don't use xdg.eclass because it adds unconditional IDEPENDs + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi + + if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then + efmt -su elog <<-EOF + To have ${PN} automatically use Tor when it's running, be sure your \ + 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ + correctly, and: + - Using an init script: add the 'bitcoin' user to the 'tor' user group. + - Running bitcoind directly: add that user to the 'tor' user group. + EOF + fi + + if use bitcoin-cli && use daemon ; then + efmt -su elog <<-EOF + To use bitcoin-cli with the /etc/init.d/bitcoind service: + - Add your user(s) to the 'bitcoin' group. + - Symlink ~/.bitcoin to /var/lib/bitcoind. + EOF + fi +} + +pkg_postrm() { + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi +} + +pkg_config() { + if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && + [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] + then + in_use() { + : ${1:?} ; local each + if command -v fuser >/dev/null ; then + fuser "${@}" >/dev/null 2>&1 + elif command -v lsof >/dev/null ; then + for each ; do + lsof -- "${each}" && return + done >/dev/null 2>&1 + elif mountpoint -q /proc ; then + { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + + awk '{ print $6 }' /proc/[0-9]*/maps + } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") + else + return 13 + fi + } + ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" + in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} + case $? in + 0) + eend 1 + efmt eerror <<-EOF + ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any + running bitcoind instances that may be using this data directory, and then + retry this migration. + EOF + die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + ;; + 13) + eend 1 + if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then + efmt eerror <<-EOF + Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. + Do you have /proc mounted? To force the migration without checking, re-run + this command with BITCOIND_IS_NOT_RUNNING=1. + EOF + die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + fi + ;; + *) + eend 0 + ;; + esac + + # find all relative symlinks that point outside the data dir + local -A symlinks + cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die + local each ; while read -r -d '' each ; do + local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && + target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && + symlinks["${each}"]="${target}" + done < <(find -type l -print0) + + einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + rm -f -- "${EROOT}/var/lib/bitcoind" || die + mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || + die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + + # fix up the relative symlinks + cd -- "${EROOT}/var/lib/bitcoind" || die + for each in "${!symlinks[@]}" ; do + ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails + done + + einfo 'Creating a transitional symlink for your convenience.' + ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} + einfo 'You may remove this link when you no longer need it.' + else + einfo 'Nothing to do.' + fi +} diff --git a/net-p2p/bitcoin-core/bitcoin-core-25.2_rc1.ebuild b/net-p2p/bitcoin-core/bitcoin-core-25.2_rc1.ebuild new file mode 100644 index 000000000000..f0ad56e4ac05 --- /dev/null +++ b/net-p2p/bitcoin-core/bitcoin-core-25.2_rc1.ebuild @@ -0,0 +1,413 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd toolchain-funcs xdg-utils + +DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" +HOMEPAGE="https://bitcoincore.org/" +SRC_URI="https://github.com/bitcoin/bitcoin/archive/v${PV/_rc/rc}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN/-core}-${PV/_rc/rc}" + +LICENSE="MIT" +SLOT="0" +if [[ "${PV}" != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" +fi +# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 +IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + dbus? ( gui ) + kde? ( gui ) + qrcode? ( gui ) + system-leveldb? ( || ( daemon gui ) ) +" +# dev-libs/univalue is now bundled, as upstream dropped support for system copy +# and their version in the Bitcoin repo has deviated a fair bit from upstream. +# Upstream also seems very inactive. +RDEPEND=" + !dev-util/bitcoin-tx + >=dev-libs/boost-1.81.0:= + >=dev-libs/libevent-2.1.12:= + berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) + bitcoin-cli? ( !net-p2p/bitcoin-cli ) + daemon? ( + !net-p2p/bitcoind + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( + !net-p2p/bitcoin-qt + >=dev-qt/qtcore-5.15.5:5 + >=dev-qt/qtgui-5.15.5:5 + >=dev-qt/qtnetwork-5.15.5:5 + >=dev-qt/qtwidgets-5.15.5:5 + dbus? ( >=dev-qt/qtdbus-5.15.5:5 ) + ) + libs? ( !net-libs/libbitcoinconsensus ) + nat-pmp? ( >=net-libs/libnatpmp-20220705:= ) + qrcode? ( >=media-gfx/qrencode-4.1.1:= ) + sqlite? ( >=dev-db/sqlite-3.38.5:= ) + system-leveldb? ( virtual/bitcoin-leveldb ) + system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.3.1:=[recovery,schnorr] ) + upnp? ( >=net-libs/miniupnpc-2.2.2:= ) + zeromq? ( >=net-libs/zeromq-4.3.4:= ) +" +DEPEND=" + ${RDEPEND} + systemtap? ( >=dev-debug/systemtap-4.8 ) +" +BDEPEND=" + virtual/pkgconfig + daemon? ( + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( >=dev-qt/linguist-tools-5.15.5:5 ) + test? ( ${PYTHON_DEPS} ) +" +IDEPEND=" + gui? ( dev-util/desktop-file-utils ) +" + +DOCS=( + doc/bips.md + doc/bitcoin-conf.md + doc/descriptors.md + doc/files.md + doc/i2p.md + doc/JSON-RPC-interface.md + doc/multisig-tutorial.md + doc/p2p-bad-ports.md + doc/psbt.md + doc/reduce-memory.md + doc/reduce-traffic.md + doc/release-notes.md + doc/REST-interface.md + doc/tor.md +) + +PATCHES=( + "${FILESDIR}/25.0-syslibs.patch" + "${FILESDIR}/init.patch" +) + +efmt() { + : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") +} + +pkg_pretend() { + if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then + efmt ewarn <<-EOF + You are enabling neither USE="daemon" nor USE="gui". This is a valid + configuration, but you will be unable to run a Bitcoin node using this + installation. + EOF + fi + if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then + efmt ewarn <<-EOF + You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid + configuration, but you will be unable to interact with your bitcoind node + via the command line using this installation. + EOF + fi + if ! use berkdb && ! use sqlite && + { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || + { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } + then + efmt ewarn <<-EOF + You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid + configuration, but your Bitcoin node will be unable to open any wallets. + EOF + fi + + # test/functional/feature_pruning.py requires 4 GB disk space + # test/functional/wallet_pruning.py requires 1.3 GB disk space + use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend +} + +pkg_setup() { + if use test ; then + CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup + python-any-r1_pkg_setup + fi +} + +src_prepare() { + default + ! use system-leveldb || rm -r src/leveldb || die + if use system-libsecp256k1 ; then + rm -r src/secp256k1 || die + sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die + else + pushd src/secp256k1 >/dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd >/dev/null || die + fi + eautoreconf + + # we say --disable-util-util, so we can't test bitcoin-util + sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ + -i test/util/data/bitcoin-util-test.json || die + + sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ + -i contrib/completions/bash/bitcoind.bash-completion || die +} + +src_configure() { + local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi + local myeconfargs=( + --disable-static + --${wallet}-wallet + $(use_with sqlite) + $(use_with berkdb bdb) + $(use_enable systemtap usdt) + $(use_with upnp miniupnpc) + $(use_with nat-pmp natpmp) + $(use_enable test tests) + --disable-bench + --disable-fuzz{,-binary} + $(use_with qrcode qrencode) + --disable-ccache + $(use_enable asm) + $(use_enable zeromq zmq) + $(use_enable man) + $(use_enable external-signer) + --with-utils + $(use_enable {bitcoin,util}-cli) + --enable-util-tx + --${wallet}-util-wallet + --disable-util-util + # syscall sandbox is missing faccessat2 and pselect6, causing bitcoind to crash during tests; + # removed upstream for 26.0 in https://github.com/bitcoin/bitcoin/commit/32e2ffc39374f61bb2435da507f285459985df9e + --without-seccomp + $(use_with libs) + $(use_with daemon) + $(use_with gui gui qt5) + $(use_with dbus qtdbus) + $(use_with system-leveldb) + $(use_with system-libsecp256k1) + ) + econf "${myeconfargs[@]}" +} + +src_compile() { + default + + if use daemon && ! tc-is-cross-compiler ; then + TOPDIR="${S}" bash contrib/devtools/gen-bitcoin-conf.sh || die + fi + sed -e 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ + -ni share/examples/bitcoin.conf || die +} + +src_test() { + emake check + + use daemon && edo "${PYTHON}" test/functional/test_runner.py \ + --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" +} + +src_install() { + use external-signer && DOCS+=( doc/external-signer.md ) + use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) + use libs && DOCS+=( doc/shared-libraries.md ) + use systemtap && DOCS+=( doc/tracing.md ) + use zeromq && DOCS+=( doc/zmq.md ) + + if use daemon ; then + # https://bugs.gentoo.org/757102 + DOCS+=( share/rpcauth/rpcauth.py ) + docompress -x "/usr/share/doc/${PF}/rpcauth.py" + fi + + default + + find "${ED}" -type f -name '*.la' -delete || die + ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die + + newbashcomp contrib/completions/bash/bitcoin-tx.bash-completion bitcoin-tx + use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash-completion bitcoin-cli + if use daemon ; then + newbashcomp contrib/completions/bash/bitcoind.bash-completion bitcoind + use gui && bashcomp_alias bitcoind bitcoin-qt + elif use gui ; then + newbashcomp contrib/completions/bash/bitcoind.bash-completion bitcoin-qt + fi + + if use daemon ; then + insinto /etc/bitcoin + doins share/examples/bitcoin.conf + fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf + fperms 0660 /etc/bitcoin/bitcoin.conf + + newconfd contrib/init/bitcoind.openrcconf bitcoind + newinitd "${FILESDIR}/bitcoind.openrc" bitcoind + systemd_newunit contrib/init/bitcoind.service bitcoind.service + + keepdir /var/lib/bitcoind + fperms 0750 /var/lib/bitcoind + fowners bitcoin:bitcoin /var/lib/bitcoind + dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf + + insinto /etc/logrotate.d + newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind + fi + + if use gui ; then + insinto /usr/share/icons/hicolor/scalable/apps + newins src/qt/res/src/bitcoin.svg bitcoin128.svg + + domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" + + if use kde ; then + insinto /usr/share/kservices5 + doins "${FILESDIR}/bitcoin-qt.protocol" + fi + fi + + if use examples ; then + docinto examples + dodoc -r contrib/{linearize,qos} + use zeromq && dodoc -r contrib/zmq + fi +} + +pkg_preinst() { + if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + dosym -r /var/lib/bitcoin{d,/.bitcoin} + elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then + efmt ewarn <<-EOF + Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, + a deprecated location. To perform an automated migration to + ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances + that may be using the deprecated path, and then run: + + # emerge --config ${CATEGORY}/${PN} + EOF + insinto /var/lib/bitcoin + mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die + dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf + dosym -r /var/lib/bitcoin{/.bitcoin,d} + fi + fi + + if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then + dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol + fi +} + +pkg_postinst() { + # we don't use xdg.eclass because it adds unconditional IDEPENDs + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi + + if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then + efmt -su elog <<-EOF + To have ${PN} automatically use Tor when it's running, be sure your \ + 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ + correctly, and: + - Using an init script: add the 'bitcoin' user to the 'tor' user group. + - Running bitcoind directly: add that user to the 'tor' user group. + EOF + fi + + if use bitcoin-cli && use daemon ; then + efmt -su elog <<-EOF + To use bitcoin-cli with the /etc/init.d/bitcoind service: + - Add your user(s) to the 'bitcoin' group. + - Symlink ~/.bitcoin to /var/lib/bitcoind. + EOF + fi +} + +pkg_postrm() { + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi +} + +pkg_config() { + if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && + [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] + then + in_use() { + : ${1:?} ; local each + if command -v fuser >/dev/null ; then + fuser "${@}" >/dev/null 2>&1 + elif command -v lsof >/dev/null ; then + for each ; do + lsof -- "${each}" && return + done >/dev/null 2>&1 + elif mountpoint -q /proc ; then + { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + + awk '{ print $6 }' /proc/[0-9]*/maps + } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") + else + return 13 + fi + } + ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" + in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} + case $? in + 0) + eend 1 + efmt eerror <<-EOF + ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any + running bitcoind instances that may be using this data directory, and then + retry this migration. + EOF + die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + ;; + 13) + eend 1 + if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then + efmt eerror <<-EOF + Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. + Do you have /proc mounted? To force the migration without checking, re-run + this command with BITCOIND_IS_NOT_RUNNING=1. + EOF + die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + fi + ;; + *) + eend 0 + ;; + esac + + # find all relative symlinks that point outside the data dir + local -A symlinks + cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die + local each ; while read -r -d '' each ; do + local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && + target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && + symlinks["${each}"]="${target}" + done < <(find -type l -print0) + + einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + rm -f -- "${EROOT}/var/lib/bitcoind" || die + mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || + die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + + # fix up the relative symlinks + cd -- "${EROOT}/var/lib/bitcoind" || die + for each in "${!symlinks[@]}" ; do + ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails + done + + einfo 'Creating a transitional symlink for your convenience.' + ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} + einfo 'You may remove this link when you no longer need it.' + else + einfo 'Nothing to do.' + fi +} diff --git a/net-p2p/bitcoin-core/bitcoin-core-26.0-r1.ebuild b/net-p2p/bitcoin-core/bitcoin-core-26.0-r1.ebuild new file mode 100644 index 000000000000..bc609a903ac0 --- /dev/null +++ b/net-p2p/bitcoin-core/bitcoin-core-26.0-r1.ebuild @@ -0,0 +1,422 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd toolchain-funcs xdg-utils + +DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" +HOMEPAGE="https://bitcoincore.org/" +SRC_URI="https://github.com/bitcoin/bitcoin/archive/v${PV}.tar.gz -> ${P/-core}.tar.gz" +S="${WORKDIR}/${P/-core}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" +# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 +IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + dbus? ( gui ) + kde? ( gui ) + qrcode? ( gui ) + system-leveldb? ( || ( daemon gui ) ) +" +# dev-libs/univalue is now bundled, as upstream dropped support for system copy +# and their version in the Bitcoin repo has deviated a fair bit from upstream. +# Upstream also seems very inactive. +RDEPEND=" + !dev-util/bitcoin-tx + >=dev-libs/boost-1.81.0:= + >=dev-libs/libevent-2.1.12:= + berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) + bitcoin-cli? ( !net-p2p/bitcoin-cli ) + daemon? ( + !net-p2p/bitcoind + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( + !net-p2p/bitcoin-qt + >=dev-qt/qtcore-5.15.10:5 + >=dev-qt/qtgui-5.15.10:5 + >=dev-qt/qtnetwork-5.15.10:5 + >=dev-qt/qtwidgets-5.15.10:5 + dbus? ( >=dev-qt/qtdbus-5.15.10:5 ) + ) + libs? ( !net-libs/libbitcoinconsensus ) + nat-pmp? ( >=net-libs/libnatpmp-20220705:= ) + qrcode? ( >=media-gfx/qrencode-4.1.1:= ) + sqlite? ( >=dev-db/sqlite-3.38.5:= ) + system-leveldb? ( virtual/bitcoin-leveldb ) + system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.4.0:=[ellswift,extrakeys,recovery,schnorr] ) + upnp? ( >=net-libs/miniupnpc-2.2.2:= ) + zeromq? ( >=net-libs/zeromq-4.3.4:= ) +" +DEPEND=" + ${RDEPEND} + systemtap? ( >=dev-debug/systemtap-4.8 ) +" +BDEPEND=" + virtual/pkgconfig + daemon? ( + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( >=dev-qt/linguist-tools-5.15.10:5 ) + test? ( ${PYTHON_DEPS} ) +" +IDEPEND=" + gui? ( dev-util/desktop-file-utils ) +" + +DOCS=( + doc/bips.md + doc/bitcoin-conf.md + doc/descriptors.md + doc/files.md + doc/i2p.md + doc/JSON-RPC-interface.md + doc/multisig-tutorial.md + doc/p2p-bad-ports.md + doc/psbt.md + doc/reduce-memory.md + doc/reduce-traffic.md + doc/release-notes.md + doc/REST-interface.md + doc/tor.md +) + +PATCHES=( + "${FILESDIR}/26.0-syslibs.patch" + "${FILESDIR}/26.0-init.patch" +) + +efmt() { + : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") +} + +pkg_pretend() { + if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then + efmt ewarn <<-EOF + You are enabling neither USE="daemon" nor USE="gui". This is a valid + configuration, but you will be unable to run a Bitcoin node using this + installation. + EOF + fi + if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then + efmt ewarn <<-EOF + You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid + configuration, but you will be unable to interact with your bitcoind node + via the command line using this installation. + EOF + fi + if ! use berkdb && ! use sqlite && + { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || + { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } + then + efmt ewarn <<-EOF + You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid + configuration, but your Bitcoin node will be unable to open any wallets. + EOF + fi + + # test/functional/feature_pruning.py requires 4 GB disk space + # test/functional/wallet_pruning.py requires 1.3 GB disk space + use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend +} + +pkg_setup() { + if use test ; then + CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup + python-any-r1_pkg_setup + fi +} + +src_prepare() { + default + ! use system-leveldb || rm -r src/leveldb || die + if use system-libsecp256k1 ; then + rm -r src/secp256k1 || die + sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die + else + pushd src/secp256k1 >/dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd >/dev/null || die + fi + eautoreconf + + # we say --disable-util-util, so we can't test bitcoin-util + sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ + -i test/util/data/bitcoin-util-test.json || die + + sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ + -i contrib/completions/bash/bitcoind.bash || die +} + +src_configure() { + local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi + local myeconfargs=( + --disable-static + --${wallet}-wallet + $(use_with sqlite) + $(use_with berkdb bdb) + $(use_enable systemtap usdt) + $(use_with upnp miniupnpc) + $(use_with nat-pmp natpmp) + $(use_enable test tests) + --disable-bench + --disable-fuzz{,-binary} + $(use_with qrcode qrencode) + --disable-ccache + $(use_enable asm) + $(use_enable zeromq zmq) + $(use_enable man) + $(use_enable external-signer) + --with-utils + $(use_enable {bitcoin,util}-cli) + --enable-util-tx + --${wallet}-util-wallet + --disable-util-util + $(use_with libs) + $(use_with daemon) + $(use_with gui gui qt5) + $(use_with dbus qtdbus) + $(use_with system-leveldb) + $(use_with system-libsecp256k1) + ) + econf "${myeconfargs[@]}" +} + +src_compile() { + default + + if use daemon && ! tc-is-cross-compiler ; then + TOPDIR="${S}" bash contrib/devtools/gen-bitcoin-conf.sh || die + fi + sed -e 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ + -ni share/examples/bitcoin.conf || die +} + +src_test() { + emake check + + use daemon && edo "${PYTHON}" test/functional/test_runner.py \ + --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" +} + +src_install() { + use external-signer && DOCS+=( doc/external-signer.md ) + use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) + use libs && DOCS+=( doc/shared-libraries.md ) + use systemtap && DOCS+=( doc/tracing.md ) + use zeromq && DOCS+=( doc/zmq.md ) + + if use daemon ; then + # https://bugs.gentoo.org/757102 + DOCS+=( share/rpcauth/rpcauth.py ) + docompress -x "/usr/share/doc/${PF}/rpcauth.py" + fi + + default + + find "${ED}" -type f -name '*.la' -delete || die + ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die + + newbashcomp contrib/completions/bash/bitcoin-tx.bash bitcoin-tx + use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash bitcoin-cli + if use daemon ; then + newbashcomp contrib/completions/bash/bitcoind.bash bitcoind + use gui && bashcomp_alias bitcoind bitcoin-qt + elif use gui ; then + newbashcomp contrib/completions/bash/bitcoind.bash bitcoin-qt + fi + + if use daemon ; then + insinto /etc/bitcoin + doins share/examples/bitcoin.conf + fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf + fperms 0660 /etc/bitcoin/bitcoin.conf + + newconfd contrib/init/bitcoind.openrcconf bitcoind + newinitd "${FILESDIR}/bitcoind.openrc" bitcoind + systemd_newunit contrib/init/bitcoind.service bitcoind.service + + keepdir /var/lib/bitcoind + fperms 0750 /var/lib/bitcoind + fowners bitcoin:bitcoin /var/lib/bitcoind + dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf + + insinto /etc/logrotate.d + newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind + fi + + if use gui ; then + insinto /usr/share/icons/hicolor/scalable/apps + newins src/qt/res/src/bitcoin.svg bitcoin128.svg + + domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" + + if use kde ; then + insinto /usr/share/kservices5 + doins "${FILESDIR}/bitcoin-qt.protocol" + fi + fi + + if use examples ; then + docinto examples + dodoc -r contrib/{linearize,qos} + use zeromq && dodoc -r contrib/zmq + fi +} + +pkg_preinst() { + if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + dosym -r /var/lib/bitcoin{d,/.bitcoin} + elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then + efmt ewarn <<-EOF + Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, + a deprecated location. To perform an automated migration to + ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances + that may be using the deprecated path, and then run: + + # emerge --config ${CATEGORY}/${PN} + EOF + insinto /var/lib/bitcoin + mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die + dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf + dosym -r /var/lib/bitcoin{/.bitcoin,d} + fi + fi + + if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then + dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol + fi +} + +pkg_postinst() { + # we don't use xdg.eclass because it adds unconditional IDEPENDs + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi + + if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then + efmt -su elog <<-EOF + To have ${PN} automatically use Tor when it's running, be sure your \ + 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ + correctly, and: + - Using an init script: add the 'bitcoin' user to the 'tor' user group. + - Running bitcoind directly: add that user to the 'tor' user group. + EOF + fi + + if use bitcoin-cli && use daemon ; then + efmt -su elog <<-EOF + To use bitcoin-cli with the /etc/init.d/bitcoind service: + - Add your user(s) to the 'bitcoin' group. + - Symlink ~/.bitcoin to /var/lib/bitcoind. + EOF + fi + + if use berkdb ; then + # https://github.com/bitcoin/bitcoin/pull/28597 + # https://bitcoincore.org/en/releases/26.0/#wallet + efmt ewarn <<-EOF + Creation of legacy (Berkeley DB) wallets is refused starting with Bitcoin + Core 26.0, pending the deprecation and eventual removal of support for + legacy wallets altogether in future releases. At present you can still + force support for the creation of legacy wallets by adding the following + line to your bitcoin.conf: + + deprecatedrpc=create_bdb + EOF + fi +} + +pkg_postrm() { + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi +} + +pkg_config() { + if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && + [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] + then + in_use() { + : ${1:?} ; local each + if command -v fuser >/dev/null ; then + fuser "${@}" >/dev/null 2>&1 + elif command -v lsof >/dev/null ; then + for each ; do + lsof -- "${each}" && return + done >/dev/null 2>&1 + elif mountpoint -q /proc ; then + { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + + awk '{ print $6 }' /proc/[0-9]*/maps + } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") + else + return 13 + fi + } + ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" + in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} + case $? in + 0) + eend 1 + efmt eerror <<-EOF + ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any + running bitcoind instances that may be using this data directory, and then + retry this migration. + EOF + die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + ;; + 13) + eend 1 + if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then + efmt eerror <<-EOF + Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. + Do you have /proc mounted? To force the migration without checking, re-run + this command with BITCOIND_IS_NOT_RUNNING=1. + EOF + die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + fi + ;; + *) + eend 0 + ;; + esac + + # find all relative symlinks that point outside the data dir + local -A symlinks + cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die + local each ; while read -r -d '' each ; do + local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && + target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && + symlinks["${each}"]="${target}" + done < <(find -type l -print0) + + einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + rm -f -- "${EROOT}/var/lib/bitcoind" || die + mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || + die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + + # fix up the relative symlinks + cd -- "${EROOT}/var/lib/bitcoind" || die + for each in "${!symlinks[@]}" ; do + ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails + done + + einfo 'Creating a transitional symlink for your convenience.' + ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} + einfo 'You may remove this link when you no longer need it.' + else + einfo 'Nothing to do.' + fi +} diff --git a/net-p2p/bitcoin-core/bitcoin-core-26.0.ebuild b/net-p2p/bitcoin-core/bitcoin-core-26.0.ebuild deleted file mode 100644 index 90d9df5ad6dd..000000000000 --- a/net-p2p/bitcoin-core/bitcoin-core-26.0.ebuild +++ /dev/null @@ -1,417 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{10..12} ) - -inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd toolchain-funcs xdg-utils - -DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" -HOMEPAGE="https://bitcoincore.org/" -SRC_URI="https://github.com/bitcoin/bitcoin/archive/v${PV}.tar.gz -> ${P/-core}.tar.gz" -S="${WORKDIR}/${P/-core}" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" -# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 -IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" -RESTRICT="!test? ( test )" - -REQUIRED_USE=" - dbus? ( gui ) - kde? ( gui ) - qrcode? ( gui ) - system-leveldb? ( || ( daemon gui ) ) -" -# dev-libs/univalue is now bundled, as upstream dropped support for system copy -# and their version in the Bitcoin repo has deviated a fair bit from upstream. -# Upstream also seems very inactive. -RDEPEND=" - !dev-util/bitcoin-tx - >=dev-libs/boost-1.81.0:= - >=dev-libs/libevent-2.1.12:= - berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) - bitcoin-cli? ( !net-p2p/bitcoin-cli ) - daemon? ( - !net-p2p/bitcoind - acct-group/bitcoin - acct-user/bitcoin - ) - gui? ( - !net-p2p/bitcoin-qt - >=dev-qt/qtcore-5.15.10:5 - >=dev-qt/qtgui-5.15.10:5 - >=dev-qt/qtnetwork-5.15.10:5 - >=dev-qt/qtwidgets-5.15.10:5 - dbus? ( >=dev-qt/qtdbus-5.15.10:5 ) - ) - libs? ( !net-libs/libbitcoinconsensus ) - nat-pmp? ( >=net-libs/libnatpmp-20220705:= ) - qrcode? ( >=media-gfx/qrencode-4.1.1:= ) - sqlite? ( >=dev-db/sqlite-3.38.5:= ) - system-leveldb? ( virtual/bitcoin-leveldb ) - system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.4.0:=[ellswift,extrakeys,recovery,schnorr] ) - upnp? ( >=net-libs/miniupnpc-2.2.2:= ) - zeromq? ( >=net-libs/zeromq-4.3.4:= ) -" -DEPEND=" - ${RDEPEND} - systemtap? ( >=dev-debug/systemtap-4.8 ) -" -BDEPEND=" - virtual/pkgconfig - daemon? ( - acct-group/bitcoin - acct-user/bitcoin - ) - gui? ( >=dev-qt/linguist-tools-5.15.10:5 ) - test? ( ${PYTHON_DEPS} ) -" -IDEPEND=" - gui? ( dev-util/desktop-file-utils ) -" - -DOCS=( - doc/bips.md - doc/bitcoin-conf.md - doc/descriptors.md - doc/files.md - doc/i2p.md - doc/JSON-RPC-interface.md - doc/multisig-tutorial.md - doc/p2p-bad-ports.md - doc/psbt.md - doc/reduce-memory.md - doc/reduce-traffic.md - doc/release-notes.md - doc/REST-interface.md - doc/tor.md -) - -PATCHES=( - "${FILESDIR}/26.0-syslibs.patch" - "${FILESDIR}/26.0-init.patch" -) - -efmt() { - : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") -} - -pkg_pretend() { - if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then - efmt ewarn <<-EOF - You are enabling neither USE="daemon" nor USE="gui". This is a valid - configuration, but you will be unable to run a Bitcoin node using this - installation. - EOF - fi - if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then - efmt ewarn <<-EOF - You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid - configuration, but you will be unable to interact with your bitcoind node - via the command line using this installation. - EOF - fi - if ! use berkdb && ! use sqlite && - { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || - { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } - then - efmt ewarn <<-EOF - You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid - configuration, but your Bitcoin node will be unable to open any wallets. - EOF - fi - - # test/functional/feature_pruning.py requires 4 GB disk space - # test/functional/wallet_pruning.py requires 1.3 GB disk space - use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend -} - -pkg_setup() { - if use test ; then - CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup - python-any-r1_pkg_setup - fi -} - -src_prepare() { - default - ! use system-leveldb || rm -r src/leveldb || die - if use system-libsecp256k1 ; then - rm -r src/secp256k1 || die - sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die - else - pushd src/secp256k1 >/dev/null || die - AT_NOELIBTOOLIZE=yes eautoreconf - popd >/dev/null || die - fi - eautoreconf - - # we say --disable-util-util, so we can't test bitcoin-util - sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ - -i test/util/data/bitcoin-util-test.json || die - - sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ - -i contrib/completions/bash/bitcoind.bash || die -} - -src_configure() { - local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi - local myeconfargs=( - --disable-static - --${wallet}-wallet - $(use_with sqlite) - $(use_with berkdb bdb) - $(use_enable systemtap usdt) - $(use_with upnp miniupnpc) - $(use_with nat-pmp natpmp) - $(use_enable test tests) - --disable-bench - --disable-fuzz{,-binary} - $(use_with qrcode qrencode) - --disable-ccache - $(use_enable asm) - $(use_enable zeromq zmq) - $(use_enable man) - $(use_enable external-signer) - --with-utils - $(use_enable {bitcoin,util}-cli) - --enable-util-tx - --${wallet}-util-wallet - --disable-util-util - $(use_with libs) - $(use_with daemon) - $(use_with gui gui qt5) - $(use_with dbus qtdbus) - $(use_with system-leveldb) - $(use_with system-libsecp256k1) - ) - econf "${myeconfargs[@]}" -} - -src_compile() { - default - - if use daemon && ! tc-is-cross-compiler ; then - TOPDIR="${S}" bash contrib/devtools/gen-bitcoin-conf.sh || die - fi - sed -e 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ - -ni share/examples/bitcoin.conf || die -} - -src_test() { - emake check - - use daemon && edo "${PYTHON}" test/functional/test_runner.py \ - --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" -} - -src_install() { - use external-signer && DOCS+=( doc/external-signer.md ) - use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) - use libs && DOCS+=( doc/shared-libraries.md ) - use systemtap && DOCS+=( doc/tracing.md ) - use zeromq && DOCS+=( doc/zmq.md ) - - if use daemon ; then - # https://bugs.gentoo.org/757102 - DOCS+=( share/rpcauth/rpcauth.py ) - docompress -x "/usr/share/doc/${PF}/rpcauth.py" - fi - - default - - find "${ED}" -type f -name '*.la' -delete || die - ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die - - newbashcomp contrib/completions/bash/bitcoin-tx.bash bitcoin-tx - use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash bitcoin-cli - use daemon || use gui && newbashcomp contrib/completions/bash/bitcoind.bash bitcoind - - if use daemon ; then - insinto /etc/bitcoin - doins share/examples/bitcoin.conf - fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf - fperms 0660 /etc/bitcoin/bitcoin.conf - - newconfd contrib/init/bitcoind.openrcconf bitcoind - newinitd "${FILESDIR}/bitcoind.openrc" bitcoind - systemd_newunit contrib/init/bitcoind.service bitcoind.service - - keepdir /var/lib/bitcoind - fperms 0750 /var/lib/bitcoind - fowners bitcoin:bitcoin /var/lib/bitcoind - dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf - - insinto /etc/logrotate.d - newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind - fi - - if use gui ; then - insinto /usr/share/icons/hicolor/scalable/apps - newins src/qt/res/src/bitcoin.svg bitcoin128.svg - - domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" - - if use kde ; then - insinto /usr/share/kservices5 - doins "${FILESDIR}/bitcoin-qt.protocol" - fi - fi - - if use examples ; then - docinto examples - dodoc -r contrib/{linearize,qos} - use zeromq && dodoc -r contrib/zmq - fi -} - -pkg_preinst() { - if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then - if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then - dosym -r /var/lib/bitcoin{d,/.bitcoin} - elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then - efmt ewarn <<-EOF - Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, - a deprecated location. To perform an automated migration to - ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances - that may be using the deprecated path, and then run: - - # emerge --config ${CATEGORY}/${PN} - EOF - insinto /var/lib/bitcoin - mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die - dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf - dosym -r /var/lib/bitcoin{/.bitcoin,d} - fi - fi - - if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then - dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol - fi -} - -pkg_postinst() { - # we don't use xdg.eclass because it adds unconditional IDEPENDs - if use gui ; then - xdg_desktop_database_update - xdg_icon_cache_update - fi - - if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then - efmt -su elog <<-EOF - To have ${PN} automatically use Tor when it's running, be sure your \ - 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ - correctly, and: - - Using an init script: add the 'bitcoin' user to the 'tor' user group. - - Running bitcoind directly: add that user to the 'tor' user group. - EOF - fi - - if use bitcoin-cli && use daemon ; then - efmt -su elog <<-EOF - To use bitcoin-cli with the /etc/init.d/bitcoind service: - - Add your user(s) to the 'bitcoin' group. - - Symlink ~/.bitcoin to /var/lib/bitcoind. - EOF - fi - - if use berkdb ; then - # https://github.com/bitcoin/bitcoin/pull/28597 - # https://bitcoincore.org/en/releases/26.0/#wallet - efmt ewarn <<-EOF - Creation of legacy (Berkeley DB) wallets is refused starting with Bitcoin - Core 26.0, pending the deprecation and eventual removal of support for - legacy wallets altogether in future releases. At present you can still - force support for the creation of legacy wallets by adding the following - line to your bitcoin.conf: - - deprecatedrpc=create_bdb - EOF - fi -} - -pkg_postrm() { - if use gui ; then - xdg_desktop_database_update - xdg_icon_cache_update - fi -} - -pkg_config() { - if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && - [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] - then - in_use() { - : ${1:?} ; local each - if command -v fuser >/dev/null ; then - fuser "${@}" >/dev/null 2>&1 - elif command -v lsof >/dev/null ; then - for each ; do - lsof -- "${each}" && return - done >/dev/null 2>&1 - elif mountpoint -q /proc ; then - { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + - awk '{ print $6 }' /proc/[0-9]*/maps - } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") - else - return 13 - fi - } - ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" - in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} - case $? in - 0) - eend 1 - efmt eerror <<-EOF - ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any - running bitcoind instances that may be using this data directory, and then - retry this migration. - EOF - die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" - ;; - 13) - eend 1 - if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then - efmt eerror <<-EOF - Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. - Do you have /proc mounted? To force the migration without checking, re-run - this command with BITCOIND_IS_NOT_RUNNING=1. - EOF - die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" - fi - ;; - *) - eend 0 - ;; - esac - - # find all relative symlinks that point outside the data dir - local -A symlinks - cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die - local each ; while read -r -d '' each ; do - local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && - target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && - symlinks["${each}"]="${target}" - done < <(find -type l -print0) - - einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." - rm -f -- "${EROOT}/var/lib/bitcoind" || die - mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || - die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." - - # fix up the relative symlinks - cd -- "${EROOT}/var/lib/bitcoind" || die - for each in "${!symlinks[@]}" ; do - ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails - done - - einfo 'Creating a transitional symlink for your convenience.' - ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} - einfo 'You may remove this link when you no longer need it.' - else - einfo 'Nothing to do.' - fi -} diff --git a/net-p2p/bitcoin-core/bitcoin-core-26.1_rc1.ebuild b/net-p2p/bitcoin-core/bitcoin-core-26.1_rc1.ebuild new file mode 100644 index 000000000000..cf31b6360f4b --- /dev/null +++ b/net-p2p/bitcoin-core/bitcoin-core-26.1_rc1.ebuild @@ -0,0 +1,424 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +inherit autotools bash-completion-r1 check-reqs db-use desktop edo multiprocessing python-any-r1 systemd toolchain-funcs xdg-utils + +DESCRIPTION="Reference implementation of the Bitcoin cryptocurrency" +HOMEPAGE="https://bitcoincore.org/" +SRC_URI="https://github.com/bitcoin/bitcoin/archive/v${PV/_rc/rc}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN/-core}-${PV/_rc/rc}" + +LICENSE="MIT" +SLOT="0" +if [[ "${PV}" != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux" +fi +# IUSE="+cli" doesn't work due to https://bugs.gentoo.org/831045#c3 +IUSE="+asm +berkdb +bitcoin-cli +daemon dbus examples +external-signer gui kde libs +man nat-pmp +qrcode +sqlite system-leveldb +system-libsecp256k1 systemtap test upnp zeromq" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + dbus? ( gui ) + kde? ( gui ) + qrcode? ( gui ) + system-leveldb? ( || ( daemon gui ) ) +" +# dev-libs/univalue is now bundled, as upstream dropped support for system copy +# and their version in the Bitcoin repo has deviated a fair bit from upstream. +# Upstream also seems very inactive. +RDEPEND=" + !dev-util/bitcoin-tx + >=dev-libs/boost-1.81.0:= + >=dev-libs/libevent-2.1.12:= + berkdb? ( >=sys-libs/db-4.8.30:$(db_ver_to_slot 4.8)=[cxx] ) + bitcoin-cli? ( !net-p2p/bitcoin-cli ) + daemon? ( + !net-p2p/bitcoind + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( + !net-p2p/bitcoin-qt + >=dev-qt/qtcore-5.15.10:5 + >=dev-qt/qtgui-5.15.10:5 + >=dev-qt/qtnetwork-5.15.10:5 + >=dev-qt/qtwidgets-5.15.10:5 + dbus? ( >=dev-qt/qtdbus-5.15.10:5 ) + ) + libs? ( !net-libs/libbitcoinconsensus ) + nat-pmp? ( >=net-libs/libnatpmp-20220705:= ) + qrcode? ( >=media-gfx/qrencode-4.1.1:= ) + sqlite? ( >=dev-db/sqlite-3.38.5:= ) + system-leveldb? ( virtual/bitcoin-leveldb ) + system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.4.0:=[ellswift,extrakeys,recovery,schnorr] ) + upnp? ( >=net-libs/miniupnpc-2.2.2:= ) + zeromq? ( >=net-libs/zeromq-4.3.4:= ) +" +DEPEND=" + ${RDEPEND} + systemtap? ( >=dev-debug/systemtap-4.8 ) +" +BDEPEND=" + virtual/pkgconfig + daemon? ( + acct-group/bitcoin + acct-user/bitcoin + ) + gui? ( >=dev-qt/linguist-tools-5.15.10:5 ) + test? ( ${PYTHON_DEPS} ) +" +IDEPEND=" + gui? ( dev-util/desktop-file-utils ) +" + +DOCS=( + doc/bips.md + doc/bitcoin-conf.md + doc/descriptors.md + doc/files.md + doc/i2p.md + doc/JSON-RPC-interface.md + doc/multisig-tutorial.md + doc/p2p-bad-ports.md + doc/psbt.md + doc/reduce-memory.md + doc/reduce-traffic.md + doc/release-notes.md + doc/REST-interface.md + doc/tor.md +) + +PATCHES=( + "${FILESDIR}/26.0-syslibs.patch" + "${FILESDIR}/26.0-init.patch" +) + +efmt() { + : ${1:?} ; local l ; while read -r l ; do "${!#}" "${l}" ; done < <(fmt "${@:1:$#-1}") +} + +pkg_pretend() { + if ! use daemon && ! use gui && ! has_version "${CATEGORY}/${PN}[-daemon,-gui(-),-qt5(-)]" ; then + efmt ewarn <<-EOF + You are enabling neither USE="daemon" nor USE="gui". This is a valid + configuration, but you will be unable to run a Bitcoin node using this + installation. + EOF + fi + if use daemon && ! use bitcoin-cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli]" ; then + efmt ewarn <<-EOF + You are enabling USE="daemon" but not USE="bitcoin-cli". This is a valid + configuration, but you will be unable to interact with your bitcoind node + via the command line using this installation. + EOF + fi + if ! use berkdb && ! use sqlite && + { { use daemon && ! has_version "${CATEGORY}/${PN}[daemon,-berkdb,-sqlite]" ; } || + { use gui && ! has_version "${CATEGORY}/${PN}[gui,-berkdb,-sqlite]" ; } ; } + then + efmt ewarn <<-EOF + You are enabling neither USE="berkdb" nor USE="sqlite". This is a valid + configuration, but your Bitcoin node will be unable to open any wallets. + EOF + fi + + # test/functional/feature_pruning.py requires 4 GB disk space + # test/functional/wallet_pruning.py requires 1.3 GB disk space + use test && CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_pretend +} + +pkg_setup() { + if use test ; then + CHECKREQS_DISK_BUILD="6G" check-reqs_pkg_setup + python-any-r1_pkg_setup + fi +} + +src_prepare() { + default + ! use system-leveldb || rm -r src/leveldb || die + if use system-libsecp256k1 ; then + rm -r src/secp256k1 || die + sed -e '/^DIST_SUBDIRS *=/s/\bsecp256k1\b//' -i src/Makefile.am || die + else + pushd src/secp256k1 >/dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd >/dev/null || die + fi + eautoreconf + + # we say --disable-util-util, so we can't test bitcoin-util + sed -ne '/^ {/{h;:0;n;H;/^ }/!b0;g;\|"exec": *"\./bitcoin-util"|d};p' \ + -i test/util/data/bitcoin-util-test.json || die + + sed -e 's/^\(complete -F _bitcoind\b\).*$/\1'"$(usev daemon ' bitcoind')$(usev gui ' bitcoin-qt')/" \ + -i contrib/completions/bash/bitcoind.bash || die +} + +src_configure() { + local wallet ; if use berkdb || use sqlite ; then wallet=enable ; else wallet=disable ; fi + local myeconfargs=( + --disable-static + --${wallet}-wallet + $(use_with sqlite) + $(use_with berkdb bdb) + $(use_enable systemtap usdt) + $(use_with upnp miniupnpc) + $(use_with nat-pmp natpmp) + $(use_enable test tests) + --disable-bench + --disable-fuzz{,-binary} + $(use_with qrcode qrencode) + --disable-ccache + $(use_enable asm) + $(use_enable zeromq zmq) + $(use_enable man) + $(use_enable external-signer) + --with-utils + $(use_enable {bitcoin,util}-cli) + --enable-util-tx + --${wallet}-util-wallet + --disable-util-util + $(use_with libs) + $(use_with daemon) + $(use_with gui gui qt5) + $(use_with dbus qtdbus) + $(use_with system-leveldb) + $(use_with system-libsecp256k1) + ) + econf "${myeconfargs[@]}" +} + +src_compile() { + default + + if use daemon && ! tc-is-cross-compiler ; then + TOPDIR="${S}" bash contrib/devtools/gen-bitcoin-conf.sh || die + fi + sed -e 's/ To use, copy this file$//p;Tp;:0;n;/save the file\.$/!b0;d;:p;p' \ + -ni share/examples/bitcoin.conf || die +} + +src_test() { + emake check + + use daemon && edo "${PYTHON}" test/functional/test_runner.py \ + --ansi --extended --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}" +} + +src_install() { + use external-signer && DOCS+=( doc/external-signer.md ) + use berkdb || use sqlite && DOCS+=( doc/managing-wallets.md ) + use libs && DOCS+=( doc/shared-libraries.md ) + use systemtap && DOCS+=( doc/tracing.md ) + use zeromq && DOCS+=( doc/zmq.md ) + + if use daemon ; then + # https://bugs.gentoo.org/757102 + DOCS+=( share/rpcauth/rpcauth.py ) + docompress -x "/usr/share/doc/${PF}/rpcauth.py" + fi + + default + + find "${ED}" -type f -name '*.la' -delete || die + ! use test || rm -f -- "${ED}"/usr/bin/test_bitcoin{,-qt} || die + + newbashcomp contrib/completions/bash/bitcoin-tx.bash bitcoin-tx + use bitcoin-cli && newbashcomp contrib/completions/bash/bitcoin-cli.bash bitcoin-cli + if use daemon ; then + newbashcomp contrib/completions/bash/bitcoind.bash bitcoind + use gui && bashcomp_alias bitcoind bitcoin-qt + elif use gui ; then + newbashcomp contrib/completions/bash/bitcoind.bash bitcoin-qt + fi + + if use daemon ; then + insinto /etc/bitcoin + doins share/examples/bitcoin.conf + fowners bitcoin:bitcoin /etc/bitcoin/bitcoin.conf + fperms 0660 /etc/bitcoin/bitcoin.conf + + newconfd contrib/init/bitcoind.openrcconf bitcoind + newinitd "${FILESDIR}/bitcoind.openrc" bitcoind + systemd_newunit contrib/init/bitcoind.service bitcoind.service + + keepdir /var/lib/bitcoind + fperms 0750 /var/lib/bitcoind + fowners bitcoin:bitcoin /var/lib/bitcoind + dosym -r {/etc/bitcoin,/var/lib/bitcoind}/bitcoin.conf + + insinto /etc/logrotate.d + newins "${FILESDIR}/bitcoind.logrotate-r1" bitcoind + fi + + if use gui ; then + insinto /usr/share/icons/hicolor/scalable/apps + newins src/qt/res/src/bitcoin.svg bitcoin128.svg + + domenu "${FILESDIR}/org.bitcoin.bitcoin-qt.desktop" + + if use kde ; then + insinto /usr/share/kservices5 + doins "${FILESDIR}/bitcoin-qt.protocol" + fi + fi + + if use examples ; then + docinto examples + dodoc -r contrib/{linearize,qos} + use zeromq && dodoc -r contrib/zmq + fi +} + +pkg_preinst() { + if use daemon && [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + if [[ -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] ; then + dosym -r /var/lib/bitcoin{d,/.bitcoin} + elif [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] ; then + efmt ewarn <<-EOF + Your bitcoind data directory is located at ${EPREFIX}/var/lib/bitcoin/.bitcoin, + a deprecated location. To perform an automated migration to + ${EPREFIX}/var/lib/bitcoind, first shut down any running bitcoind instances + that may be using the deprecated path, and then run: + + # emerge --config ${CATEGORY}/${PN} + EOF + insinto /var/lib/bitcoin + mv -- "${ED}/var/lib/bitcoin"{d,/.bitcoin} || die + dosym -r {/etc/,/var/lib/bitcoin/.}bitcoin/bitcoin.conf + dosym -r /var/lib/bitcoin{/.bitcoin,d} + fi + fi + + if use kde && [[ -d "${EROOT}/usr/share/kde4" ]] ; then + dosym -r /usr/share/{kservices5,kde4/services}/bitcoin-qt.protocol + fi +} + +pkg_postinst() { + # we don't use xdg.eclass because it adds unconditional IDEPENDs + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi + + if use daemon && [[ -z "${REPLACING_VERSIONS}" ]] ; then + efmt -su elog <<-EOF + To have ${PN} automatically use Tor when it's running, be sure your \ + 'torrc' config file has 'ControlPort' and 'CookieAuthentication' set up \ + correctly, and: + - Using an init script: add the 'bitcoin' user to the 'tor' user group. + - Running bitcoind directly: add that user to the 'tor' user group. + EOF + fi + + if use bitcoin-cli && use daemon ; then + efmt -su elog <<-EOF + To use bitcoin-cli with the /etc/init.d/bitcoind service: + - Add your user(s) to the 'bitcoin' group. + - Symlink ~/.bitcoin to /var/lib/bitcoind. + EOF + fi + + if use berkdb ; then + # https://github.com/bitcoin/bitcoin/pull/28597 + # https://bitcoincore.org/en/releases/26.0/#wallet + efmt ewarn <<-EOF + Creation of legacy (Berkeley DB) wallets is refused starting with Bitcoin + Core 26.0, pending the deprecation and eventual removal of support for + legacy wallets altogether in future releases. At present you can still + force support for the creation of legacy wallets by adding the following + line to your bitcoin.conf: + + deprecatedrpc=create_bdb + EOF + fi +} + +pkg_postrm() { + if use gui ; then + xdg_desktop_database_update + xdg_icon_cache_update + fi +} + +pkg_config() { + if [[ -d "${EROOT}/var/lib/bitcoin/.bitcoin" && ! -h "${EROOT}/var/lib/bitcoin/.bitcoin" ]] && + [[ ! -e "${EROOT}/var/lib/bitcoind" || -h "${EROOT}/var/lib/bitcoind" ]] + then + in_use() { + : ${1:?} ; local each + if command -v fuser >/dev/null ; then + fuser "${@}" >/dev/null 2>&1 + elif command -v lsof >/dev/null ; then + for each ; do + lsof -- "${each}" && return + done >/dev/null 2>&1 + elif mountpoint -q /proc ; then + { find /proc/[0-9]*/{cwd,exe,fd} -type l -exec readlink -- {} + + awk '{ print $6 }' /proc/[0-9]*/maps + } 2>/dev/null | grep -Fqx -f <(printf '%s\n' "${@}" ; readlink -m -- "${@}") + else + return 13 + fi + } + ebegin "Checking that ${EPREFIX}/var/lib/bitcoin/.bitcoin is not in use" + in_use "${EROOT}/var/lib/bitcoin/.bitcoin"{,/.lock} + case $? in + 0) + eend 1 + efmt eerror <<-EOF + ${EPREFIX}/var/lib/bitcoin/.bitcoin is currently in use. Please stop any + running bitcoind instances that may be using this data directory, and then + retry this migration. + EOF + die "${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + ;; + 13) + eend 1 + if [[ "${BITCOIND_IS_NOT_RUNNING}" != 1 ]] ; then + efmt eerror <<-EOF + Found no way to check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use. + Do you have /proc mounted? To force the migration without checking, re-run + this command with BITCOIND_IS_NOT_RUNNING=1. + EOF + die "could not check whether ${EPREFIX}/var/lib/bitcoin/.bitcoin is in use" + fi + ;; + *) + eend 0 + ;; + esac + + # find all relative symlinks that point outside the data dir + local -A symlinks + cd -- "${EROOT}/var/lib/bitcoin/.bitcoin" || die + local each ; while read -r -d '' each ; do + local target=$(readlink -- "${each}") && [[ "${target}" == ../* ]] && + target=$(readlink -e -- "${each}") && [[ "${target}" != "${EROOT}/var/lib/bitcoin/.bitcoin/"* ]] && + symlinks["${each}"]="${target}" + done < <(find -type l -print0) + + einfo "Moving your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + rm -f -- "${EROOT}/var/lib/bitcoind" || die + mv --no-clobber --no-copy --no-target-directory -- "${EROOT}/var/lib/bitcoin"{/.bitcoin,d} || + die "Failed to move your ${EPREFIX}/var/lib/bitcoin/.bitcoin to ${EPREFIX}/var/lib/bitcoind." + + # fix up the relative symlinks + cd -- "${EROOT}/var/lib/bitcoind" || die + for each in "${!symlinks[@]}" ; do + ln -fnrs -- "${symlinks[${each}]}" "${each}" # keep going even if this fails + done + + einfo 'Creating a transitional symlink for your convenience.' + ln -fnrsv -- "${EROOT}/var/lib/bitcoin"{d,/.bitcoin} + einfo 'You may remove this link when you no longer need it.' + else + einfo 'Nothing to do.' + fi +} -- cgit v1.2.3