net-p2p/bitcoin-core: drop 28.1, 28.1-r1

Closes: https://bugs.gentoo.org/955268
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2025-05-21 22:35:35 +02:00
parent 445c193b77
commit f52096f978
6 changed files with 0 additions and 1424 deletions

View File

@@ -1,2 +1 @@
DIST bitcoin-core-28.1.tar.gz 12601466 BLAKE2B f6dd3c269b0e132798b3bea96a122a89b95e7544f01fd3401bfc2fd1ef11fc847a3570f8d5c0339778df0a3ecf17cf49af4148c2f68d7719d6f85ac2688e9d3c SHA512 859c5f0b2f927969766d3ebde64173469e5810694ba317629fac64c66311d847698ae093dbf585e327cf4e75983b722ff45a23ed3fe6f1f13752db4cf6846aa9
DIST bitcoin-core-29.0.tar.gz 12931219 BLAKE2B ee4a9b67ceb3e7a1851f844a090a099267798f83fbeb4fb76e0dd30ec24ce3fb967ab032179492cb8c02f0e470b3c2546ad589f940487bb0a0cc4d469bf3e1f9 SHA512 1373348fff7ac978fd28a8e29eda9ba9af745f947153a2c6c099b1e997d0d55611627f4c5299e350be3a9b555406da6bf056d2c5f6c123077e2872f5db7b3459

View File

@@ -1,416 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
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="+asm +berkdb +cli +daemon dbus examples +external-signer gui nat-pmp qrcode +sqlite +system-libsecp256k1 systemtap test test-full upnp zeromq"
RESTRICT="!test? ( test )"
REQUIRED_USE="
dbus? ( gui )
qrcode? ( gui )
test-full? ( test )
"
# 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.
COMMON_DEPEND="
>=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] )
daemon? (
acct-group/bitcoin
acct-user/bitcoin
)
gui? (
>=dev-qt/qtbase-6.2:6[dbus?,gui,network,widgets]
)
nat-pmp? ( >=net-libs/libnatpmp-20230423:= )
qrcode? ( >=media-gfx/qrencode-4.1.1:= )
sqlite? ( >=dev-db/sqlite-3.38.5:= )
system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.6.0:=[ellswift,extrakeys,recovery,schnorr] )
upnp? ( >=net-libs/miniupnpc-2.2.7:= )
zeromq? ( >=net-libs/zeromq-4.3.4:= )
"
RDEPEND="
${COMMON_DEPEND}
!dev-util/bitcoin-tx
cli? ( !net-p2p/bitcoin-cli )
daemon? ( !net-p2p/bitcoind )
gui? ( !net-p2p/bitcoin-qt )
"
DEPEND="
${COMMON_DEPEND}
systemtap? ( >=dev-debug/systemtap-4.8 )
"
BDEPEND="
virtual/pkgconfig
daemon? (
acct-group/bitcoin
acct-user/bitcoin
)
gui? ( >=dev-qt/qttools-6.2:6[linguist] )
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}/28.1-qt6.patch"
"${FILESDIR}/28.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 cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli(-),-cli(-)]" ; then
efmt ewarn <<-EOF
You are enabling USE="daemon" but not USE="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
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 external-signer)
--with-utils
$(use_enable {,util-}cli)
--enable-util-tx
--${wallet}-util-wallet
--disable-util-util
$(use_with daemon)
$(use_with gui gui qt6)
$(use_with dbus qtdbus)
$(use_with system-libsecp256k1)
)
if use gui ; then
myeconfargs+=(
--with-qt-libdir="${EPREFIX}/usr/$(get_libdir)/qt6"
--with-qt-bindir="${EPREFIX}/usr/$(get_libdir)/qt6/bin:${EPREFIX}/usr/$(get_libdir)/qt6/libexec"
)
fi
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 $(usev test-full --extended) --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}"
}
src_install() {
dodoc -r doc/release-notes
use external-signer && DOCS+=( doc/external-signer.md )
use berkdb || use sqlite && DOCS+=( doc/managing-wallets.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 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"
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
}
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 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
}

View File

@@ -1,421 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
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="+asm +berkdb +cli +daemon dbus examples +external-signer gui kde +man nat-pmp qrcode +sqlite +system-libsecp256k1 systemtap test test-full upnp zeromq"
RESTRICT="!test? ( test )"
REQUIRED_USE="
dbus? ( gui )
kde? ( gui )
qrcode? ( gui )
test-full? ( test )
"
# 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] )
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.14:5
>=dev-qt/qtgui-5.15.14:5
>=dev-qt/qtnetwork-5.15.14:5
>=dev-qt/qtwidgets-5.15.14:5
dbus? ( >=dev-qt/qtdbus-5.15.14:5 )
)
nat-pmp? ( >=net-libs/libnatpmp-20230423:= )
qrcode? ( >=media-gfx/qrencode-4.1.1:= )
sqlite? ( >=dev-db/sqlite-3.38.5:= )
system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.6.0:=[ellswift,extrakeys,recovery,schnorr] )
upnp? ( >=net-libs/miniupnpc-2.2.7:= )
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.14: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}/28.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 cli && ! has_version "${CATEGORY}/${PN}[daemon,-bitcoin-cli(-),-cli(-)]" ; then
efmt ewarn <<-EOF
You are enabling USE="daemon" but not USE="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
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 {,util-}cli)
--enable-util-tx
--${wallet}-util-wallet
--disable-util-util
$(use_with daemon)
$(use_with gui gui qt5)
$(use_with dbus qtdbus)
$(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 $(usev test-full --extended) --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}"
}
src_install() {
dodoc -r doc/release-notes
use external-signer && DOCS+=( doc/external-signer.md )
use berkdb || use sqlite && DOCS+=( doc/managing-wallets.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 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 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
}

View File

@@ -1,296 +0,0 @@
From 19cd9d584f7bd7868898ae7592633e2eb255eb46 Mon Sep 17 00:00:00 2001
From: Matt Whitlock <bitcoin@mattwhitlock.name>
Date: Sun, 17 Sep 2023 10:29:27 -0400
Subject: [PATCH] support linking against system-installed leveldb and
libsecp256k1
- Abort if runtime leveldb != compiled-against leveldb.
Originally based on 22.0-fix_build_without_leveldb.patch.
---
configure.ac | 90 ++++++++++++++++++++++++++++++++++++++-
src/Makefile.am | 13 +++++-
src/Makefile.test.include | 2 +
src/dbwrapper.cpp | 27 +++++++++++-
src/dbwrapper.h | 8 ++++
src/kernel/checks.cpp | 7 +++
6 files changed, 143 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3bc6b13efc..290f289bf7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1141,6 +1141,41 @@ if test "$enable_fuzz_binary" = "yes"; then
]])])
fi
+dnl Check for libsecp256k1, only if explicitly requested
+AC_ARG_WITH([system-libsecp256k1],
+ [AS_HELP_STRING([[--with-system-libsecp256k1[=PKG]]],
+ [build using system-installed libsecp256k1 instead of bundled, passing PKG (default: libsecp256k1) to pkg-config (default is no; DANGEROUS; NOT SUPPORTED)])],
+ [AS_IF([test "x$withval" = xyes], [with_system_libsecp256k1=libsecp256k1])],
+ [with_system_libsecp256k1=no])
+AM_CONDITIONAL([EMBEDDED_LIBSECP256K1],[test "x$with_system_libsecp256k1" = xno])
+AM_COND_IF([EMBEDDED_LIBSECP256K1], [
+ libsecp256k1_CFLAGS='-I$(srcdir)/secp256k1/include'
+ libsecp256k1_LIBS='secp256k1/libsecp256k1.la'
+], [
+ saved_CPPFLAGS=$CPPFLAGS
+ saved_LIBS=$LIBS
+ PKG_CHECK_MODULES([libsecp256k1], [$with_system_libsecp256k1])
+ CPPFLAGS="$libsecp256k1_CFLAGS $CPPFLAGS"
+ LIBS="$libsecp256k1_LIBS $LIBS"
+ missing_modules=
+ AC_DEFUN([CHECK_MODULE], [
+ AC_CHECK_HEADER([secp256k1_$1.h],
+ [AC_CHECK_FUNCS([$2], [], [missing_modules="${missing_modules} $1"])],
+ [missing_modules="${missing_modules} $1"])
+ ])
+ CHECK_MODULE([ellswift], [secp256k1_ellswift_encode])
+ CHECK_MODULE([extrakeys], [secp256k1_xonly_pubkey_parse])
+ CHECK_MODULE([recovery], [secp256k1_ecdsa_recover])
+ CHECK_MODULE([schnorrsig], [secp256k1_schnorrsig_verify])
+ AS_IF([test -n "${missing_modules}"], [
+ AC_MSG_ERROR([system-installed libsecp256k1 does not support these required modules:${missing_modules}])
+ ])
+ CPPFLAGS=$saved_CPPFLAGS
+ LIBS=$saved_LIBS
+])
+AC_SUBST(libsecp256k1_CFLAGS)
+AC_SUBST(libsecp256k1_LIBS)
+
if test "$enable_wallet" != "no"; then
dnl Check for libdb_cxx only if wallet enabled
if test "$use_bdb" != "no"; then
@@ -1200,6 +1235,55 @@ if test "$build_bitcoind$bitcoin_enable_qt$use_bench$use_tests" = "nononono"; th
use_zmq=no
fi
+dnl Check for leveldb, only if explicitly requested
+AC_ARG_WITH([system-leveldb],
+ [AS_HELP_STRING([--with-system-leveldb],
+ [Build with system LevelDB (default is no; DANGEROUS; NOT SUPPORTED)])],
+ [system_leveldb=$withval],
+ [system_leveldb=no])
+AC_ARG_VAR([leveldb_CFLAGS],[C compiler flags for system-leveldb])
+AC_ARG_VAR([leveldb_LIBS],[linker flags for system-leveldb])
+AS_IF([test x$system_leveldb != xno],[
+ TEMP_CPPFLAGS="$CPPFLAGS"
+ TEMP_LIBS="$LIBS"
+ CPPFLAGS="$leveldb_CFLAGS"
+ LIBS="$leveldb_LIBS"
+ AC_SEARCH_LIBS([leveldb_open],[leveldb],[leveldb_LIBS="$LIBS"],
+ [AC_MSG_ERROR([leveldb library not found; using --with-system-leveldb is not supported anyway])])
+ AC_CHECK_HEADER([leveldb/filter_policy.h],[],
+ [AC_MSG_ERROR([LevelDB headers not found; using --with-system-leveldb is not supported anyway])])
+ AC_CHECK_HEADER([leveldb/helpers/memenv.h],[],
+ [AC_MSG_ERROR([LevelDB headers not found; using --with-system-leveldb is not supported anyway])])
+
+ AC_MSG_CHECKING([for library containing leveldb::NewMemEnv])
+ for searchlib in "" "-lmemenv" ERR; do
+ if test "x$searchlib" = "xERR"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([LevelDB's memenv helper not found; using --with-system-leveldb is not supported anyway])
+ fi
+ LIBS="$searchlib $leveldb_LIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ #include <leveldb/env.h>
+ #include <leveldb/helpers/memenv.h>
+ ],[
+ leveldb::Env *myenv = leveldb::NewMemEnv(leveldb::Env::Default());
+ delete myenv;
+ ])
+ ],[
+ AC_MSG_RESULT([$searchlib])
+ break
+ ])
+ done
+ leveldb_LIBS="$LIBS"
+ LIBS="$TEMP_LIBS"
+ CPPFLAGS="$TEMP_CPPFLAGS"
+],[
+ AC_DEFINE([EMBEDDED_LEVELDB],[1],[Define to use the bundled LevelDB sources])
+])
+AM_CONDITIONAL([EMBEDDED_LEVELDB],[test x$system_leveldb = xno])
+AC_SUBST(leveldb_CFLAGS)
+AC_SUBST(leveldb_LIBS)
+
dnl Check for libminiupnpc (optional)
if test "$use_upnp" != "no"; then
TEMP_CPPFLAGS="$CPPFLAGS"
@@ -1693,8 +1777,10 @@ CPPFLAGS="$CPPFLAGS_TEMP"
if test -n "$use_sanitizers"; then
export SECP_CFLAGS="$SECP_CFLAGS $SANITIZER_CFLAGS"
fi
-ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --disable-module-ecdh"
-AC_CONFIG_SUBDIRS([src/secp256k1])
+AM_COND_IF([EMBEDDED_LIBSECP256K1],[
+ ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --disable-module-ecdh"
+ AC_CONFIG_SUBDIRS([src/secp256k1])
+])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 1ccb5332c4..04e9d54962 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,7 +25,7 @@ check_PROGRAMS =
TESTS =
BENCHMARKS =
-BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/$(MINISKETCH_INCLUDE_DIR_INT) -I$(srcdir)/secp256k1/include -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
+BITCOIN_INCLUDES=-I$(builddir) -I$(srcdir)/$(MINISKETCH_INCLUDE_DIR_INT) $(libsecp256k1_CFLAGS) -I$(srcdir)/$(UNIVALUE_INCLUDE_DIR_INT)
LIBBITCOIN_NODE=libbitcoin_node.a
LIBBITCOIN_COMMON=libbitcoin_common.a
@@ -34,7 +34,11 @@ LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO_BASE=crypto/libbitcoin_crypto_base.la
LIBBITCOINQT=qt/libbitcoinqt.a
+if EMBEDDED_LIBSECP256K1
LIBSECP256K1=secp256k1/libsecp256k1.la
+else
+LIBSECP256K1=$(libsecp256k1_LIBS)
+endif
if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
@@ -66,8 +70,10 @@ LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_ARM_SHANI)
endif
noinst_LTLIBRARIES += $(LIBBITCOIN_CRYPTO)
+if EMBEDDED_LIBSECP256K1
$(LIBSECP256K1): $(wildcard secp256k1/src/*.h) $(wildcard secp256k1/src/*.c) $(wildcard secp256k1/include/*)
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+endif
# Make is not made aware of per-object dependencies to avoid limiting building parallelization
# But to build the less dependent modules first, we manually select their order here:
@@ -1110,8 +1116,13 @@ endif
include Makefile.minisketch.include
+if EMBEDDED_LEVELDB
include Makefile.crc32c.include
include Makefile.leveldb.include
+else
+LEVELDB_CPPFLAGS = $(leveldb_CFLAGS)
+LIBLEVELDB = $(leveldb_LIBS)
+endif
include Makefile.test_util.include
include Makefile.test_fuzz.include
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index c396cc2ebf..233f1a1c21 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -449,7 +449,9 @@ if ENABLE_BENCH
$(BENCH_BINARY) -sanity-check -priority-level=high
endif
endif
+if EMBEDDED_LIBSECP256K1
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
+endif
if ENABLE_TESTS
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp
index 479064d468..b476b42c85 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -22,7 +22,11 @@
#include <leveldb/db.h>
#include <leveldb/env.h>
#include <leveldb/filter_policy.h>
-#include <leveldb/helpers/memenv/memenv.h>
+#if EMBEDDED_LEVELDB
+# include <leveldb/helpers/memenv/memenv.h>
+#else
+# include <leveldb/helpers/memenv.h>
+#endif
#include <leveldb/iterator.h>
#include <leveldb/options.h>
#include <leveldb/slice.h>
@@ -51,6 +55,27 @@ static void HandleError(const leveldb::Status& status)
throw dbwrapper_error(errmsg);
}
+#if !EMBEDDED_LEVELDB
+#include <node/interface_ui.h>
+#include <util/translation.h>
+#include <leveldb/c.h>
+bool dbwrapper_SanityCheck()
+{
+ unsigned long header_version = (leveldb::kMajorVersion << 16) | leveldb::kMinorVersion;
+ unsigned long library_version = (leveldb_major_version() << 16) | leveldb_minor_version();
+
+ if (header_version != library_version) {
+ InitError(Untranslated(strprintf("Compiled with LevelDB %d.%d, but linked with LevelDB %d.%d (incompatible).",
+ leveldb::kMajorVersion, leveldb::kMinorVersion,
+ leveldb_major_version(), leveldb_minor_version()
+ )));
+ return false;
+ }
+
+ return true;
+}
+#endif
+
class CBitcoinLevelDBLogger : public leveldb::Logger {
public:
// This code is adapted from posix_logger.h, which is why it is using vsprintf.
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 63c2f99d2a..406d03f1ea 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -5,6 +5,10 @@
#ifndef BITCOIN_DBWRAPPER_H
#define BITCOIN_DBWRAPPER_H
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
#include <attributes.h>
#include <serialize.h>
#include <span.h>
@@ -46,6 +50,10 @@ struct DBParams {
DBOptions options{};
};
+#if !EMBEDDED_LEVELDB
+bool dbwrapper_SanityCheck();
+#endif
+
class dbwrapper_error : public std::runtime_error
{
public:
diff --git a/src/kernel/checks.cpp b/src/kernel/checks.cpp
index e4a13ee4cc..2ca51437bf 100644
--- a/src/kernel/checks.cpp
+++ b/src/kernel/checks.cpp
@@ -4,6 +4,7 @@
#include <kernel/checks.h>
+#include <dbwrapper.h>
#include <random.h>
#include <util/result.h>
#include <util/translation.h>
@@ -14,6 +15,12 @@ namespace kernel {
util::Result<void> SanityChecks(const Context&)
{
+#if !EMBEDDED_LEVELDB
+ if (!dbwrapper_SanityCheck()) {
+ return util::Error{Untranslated("Database sanity check failure. Aborting.")};
+ }
+#endif
+
if (!Random_SanityCheck()) {
return util::Error{Untranslated("OS cryptographic RNG sanity check failure. Aborting.")};
}
--
2.46.0

View File

@@ -1,288 +0,0 @@
Adapted from https://github.com/bitcoin/bitcoin/pull/24798
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4
index 7498127860..bd95aff2a8 100644
--- a/build-aux/m4/bitcoin_qt.m4
+++ b/build-aux/m4/bitcoin_qt.m4
@@ -5,7 +5,7 @@ dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
dnl Helper for cases where a qt dependency is not met.
dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit.
AC_DEFUN([BITCOIN_QT_FAIL],[
- if test "$bitcoin_qt_want_version" = "auto" && test "$bitcoin_qt_force" != "yes"; then
+ if test "$bitcoin_qt_want_version" = "auto"; then
if test "$bitcoin_enable_qt" != "no"; then
AC_MSG_WARN([$1; bitcoin-qt frontend will not be built])
fi
@@ -53,15 +53,9 @@ dnl CAUTION: Do not use this inside of a conditional.
AC_DEFUN([BITCOIN_QT_INIT],[
dnl enable qt support
AC_ARG_WITH([gui],
- [AS_HELP_STRING([--with-gui@<:@=no|qt5|auto@:>@],
+ [AS_HELP_STRING([--with-gui@<:@=no|qt5|qt6|auto@:>@],
[build bitcoin-qt GUI (default=auto)])],
- [
- bitcoin_qt_want_version=$withval
- if test "$bitcoin_qt_want_version" = "yes"; then
- bitcoin_qt_force=yes
- bitcoin_qt_want_version=auto
- fi
- ],
+ [bitcoin_qt_want_version=$withval],
[bitcoin_qt_want_version=auto])
AS_IF([test "$with_gui" = "qt5_debug"],
@@ -70,6 +64,12 @@ AC_DEFUN([BITCOIN_QT_INIT],[
[qt_lib_suffix= ]); bitcoin_qt_want_version=qt5],
[qt_lib_suffix= ])
+ AS_IF([test "$with_gui" = "qt6_debug"],
+ [AS_CASE([$host],
+ [*darwin*], [qt_lib_suffix=_debug],
+ [qt_lib_suffix= ]); bitcoin_qt_want_version=qt6],
+ [qt_lib_suffix= ])
+
AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], [])
AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], [])
AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], [])
@@ -95,6 +95,57 @@ dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
AC_DEFUN([BITCOIN_QT_CONFIGURE],[
qt_version=">= $1"
qt_lib_prefix="Qt5"
+ if test "$bitcoin_qt_want_version" = "qt6"; then
+ qt_lib_prefix="Qt6"
+ fi
+
+ if test "$use_hardening" != "no"; then
+ BITCOIN_QT_CHECK([
+ AC_MSG_CHECKING([whether -fPIE can be used with this Qt config])
+ TEMP_CPPFLAGS=$CPPFLAGS
+ TEMP_CXXFLAGS=$CXXFLAGS
+ CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
+ CXXFLAGS="$PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <QtCore/qconfig.h>
+ #ifndef QT_VERSION
+ # include <QtCore/qglobal.h>
+ #endif
+ ]],
+ [[
+ #if defined(QT_REDUCE_RELOCATIONS)
+ choke
+ #endif
+ ]])],
+ [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIE_FLAGS ],
+ [ AC_MSG_RESULT([no]); QT_PIE_FLAGS=$PIC_FLAGS]
+ )
+ CPPFLAGS=$TEMP_CPPFLAGS
+ CXXFLAGS=$TEMP_CXXFLAGS
+ ])
+ else
+ BITCOIN_QT_CHECK([
+ AC_MSG_CHECKING([whether -fPIC is needed with this Qt config])
+ TEMP_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <QtCore/qconfig.h>
+ #ifndef QT_VERSION
+ # include <QtCore/qglobal.h>
+ #endif
+ ]],
+ [[
+ #if defined(QT_REDUCE_RELOCATIONS)
+ choke
+ #endif
+ ]])],
+ [ AC_MSG_RESULT([no])],
+ [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIC_FLAGS]
+ )
+ CPPFLAGS=$TEMP_CPPFLAGS
+ ])
+ fi
+
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS])
dnl This is ugly and complicated. Yuck. Works as follows:
@@ -153,53 +204,6 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
qt_bin_path="`$PKG_CONFIG --variable=host_bins ${qt_lib_prefix}Core 2>/dev/null`"
fi
- if test "$use_hardening" != "no"; then
- BITCOIN_QT_CHECK([
- AC_MSG_CHECKING([whether -fPIE can be used with this Qt config])
- TEMP_CPPFLAGS=$CPPFLAGS
- TEMP_CXXFLAGS=$CXXFLAGS
- CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
- CXXFLAGS="$PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <QtCore/qconfig.h>
- #ifndef QT_VERSION
- # include <QtCore/qglobal.h>
- #endif
- ]],
- [[
- #if defined(QT_REDUCE_RELOCATIONS)
- choke
- #endif
- ]])],
- [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIE_FLAGS ],
- [ AC_MSG_RESULT([no]); QT_PIE_FLAGS=$PIC_FLAGS]
- )
- CPPFLAGS=$TEMP_CPPFLAGS
- CXXFLAGS=$TEMP_CXXFLAGS
- ])
- else
- BITCOIN_QT_CHECK([
- AC_MSG_CHECKING([whether -fPIC is needed with this Qt config])
- TEMP_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <QtCore/qconfig.h>
- #ifndef QT_VERSION
- # include <QtCore/qglobal.h>
- #endif
- ]],
- [[
- #if defined(QT_REDUCE_RELOCATIONS)
- choke
- #endif
- ]])],
- [ AC_MSG_RESULT([no])],
- [ AC_MSG_RESULT([yes]); QT_PIE_FLAGS=$PIC_FLAGS]
- )
- CPPFLAGS=$TEMP_CPPFLAGS
- ])
- fi
-
BITCOIN_QT_PATH_PROGS([MOC], [moc-qt5 moc5 moc], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([UIC], [uic-qt5 uic5 uic], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt5 rcc5 rcc], $qt_bin_path)
@@ -340,6 +344,36 @@ AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_LIBS], [
fi
])
+dnl Internal. Check whether Qt application can be initialized.
+dnl
+dnl _BITCOIN_QT_CHECK_APP(APPLICATION_CLASS)
+dnl ----------------------------------------
+dnl
+dnl dnl Requires: QT_INCLUDES and QT_LIBS must be populated as necessary.
+dnl Inputs: $1: QCoreApplication, QGuiApplication, or QApplication.
+AC_DEFUN([_BITCOIN_QT_CHECK_APP], [
+ AC_MSG_CHECKING([for $1 initialization])
+ TEMP_CPPFLAGS="$CPPFLAGS"
+ TEMP_CXXFLAGS="$CXXFLAGS"
+ TEMP_LIBS="$LIBS"
+ CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
+ CXXFLAGS="$QT_PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
+ LIBS="$QT_LIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <$1>
+ ]],
+ [[
+ int argc = 1;
+ const char* argv = "core";
+ $1 app(argc, const_cast<char**>(&argv));
+ ]])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no]); BITCOIN_QT_FAIL([$1 failed to initialize.])])
+ CXXFLAGS="$TEMP_CXXFLAGS"
+ LIBS="$TEMP_LIBS"
+ CPPFLAGS="$TEMP_CPPFLAGS"
+])
+
dnl Internal. Find Qt libraries using pkg-config.
dnl
dnl _BITCOIN_QT_FIND_LIBS
@@ -349,16 +383,25 @@ dnl Outputs: All necessary QT_* variables are set.
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
BITCOIN_QT_CHECK([
- PKG_CHECK_MODULES([QT_CORE], [${qt_lib_prefix}Core${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_CORE_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_CORE_LIBS $QT_LIBS"],
+ PKG_CHECK_MODULES([QT_CORE], [${qt_lib_prefix}Core${qt_lib_suffix} $qt_version], [],
[BITCOIN_QT_FAIL([${qt_lib_prefix}Core${qt_lib_suffix} $qt_version not found])])
+ QT_INCLUDES="$QT_CORE_CFLAGS $QT_INCLUDES"
+ QT_LIBS="$QT_CORE_LIBS $QT_LIBS"
+ _BITCOIN_QT_CHECK_APP([QCoreApplication])
])
BITCOIN_QT_CHECK([
- PKG_CHECK_MODULES([QT_GUI], [${qt_lib_prefix}Gui${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_GUI_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_GUI_LIBS $QT_LIBS"],
+ PKG_CHECK_MODULES([QT_GUI], [${qt_lib_prefix}Gui${qt_lib_suffix} $qt_version], [],
[BITCOIN_QT_FAIL([${qt_lib_prefix}Gui${qt_lib_suffix} $qt_version not found])])
+ QT_INCLUDES="$QT_GUI_CFLAGS $QT_INCLUDES"
+ QT_LIBS="$QT_GUI_LIBS $QT_LIBS"
+ _BITCOIN_QT_CHECK_APP([QGuiApplication])
])
BITCOIN_QT_CHECK([
- PKG_CHECK_MODULES([QT_WIDGETS], [${qt_lib_prefix}Widgets${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_WIDGETS_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_WIDGETS_LIBS $QT_LIBS"],
+ PKG_CHECK_MODULES([QT_WIDGETS], [${qt_lib_prefix}Widgets${qt_lib_suffix} $qt_version], [],
[BITCOIN_QT_FAIL([${qt_lib_prefix}Widgets${qt_lib_suffix} $qt_version not found])])
+ QT_INCLUDES="$QT_WIDGETS_CFLAGS $QT_INCLUDES"
+ QT_LIBS="$QT_WIDGETS_LIBS $QT_LIBS"
+ _BITCOIN_QT_CHECK_APP([QApplication])
])
BITCOIN_QT_CHECK([
PKG_CHECK_MODULES([QT_NETWORK], [${qt_lib_prefix}Network${qt_lib_suffix} $qt_version], [QT_INCLUDES="$QT_NETWORK_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_NETWORK_LIBS $QT_LIBS"],
@@ -368,7 +411,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
BITCOIN_QT_CHECK([
PKG_CHECK_MODULES([QT_TEST], [${qt_lib_prefix}Test${qt_lib_suffix} $qt_version], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
if test "$use_dbus" != "no"; then
- PKG_CHECK_MODULES([QT_DBUS], [${qt_lib_prefix}DBus $qt_version], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
+ PKG_CHECK_MODULES([QT_DBUS], [${qt_lib_prefix}DBus $qt_version], [QT_INCLUDES="$QT_DBUS_CFLAGS $QT_INCLUDES" QT_LIBS="$QT_LIBS $QT_DBUS_LIBS" QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
fi
])
])
diff --git a/configure.ac b/configure.ac
index 86d5e5e214..af5e7c06c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1726,9 +1726,11 @@ if test "$enable_wallet" != "no"; then
echo " with sqlite = $use_sqlite"
echo " with bdb = $use_bdb"
fi
-echo " with gui / qt = $bitcoin_enable_qt"
if test $bitcoin_enable_qt != "no"; then
+ echo " with gui / qt = $bitcoin_enable_qt, $qt_lib_prefix"
echo " with qr = $use_qr"
+else
+ echo " with gui / qt = $bitcoin_enable_qt"
fi
echo " with zmq = $use_zmq"
if test $enable_fuzz = "no"; then
diff --git a/depends/config.site.in b/depends/config.site.in
index f6bed6a9d4..c1c0a8448d 100644
--- a/depends/config.site.in
+++ b/depends/config.site.in
@@ -17,6 +17,10 @@ ac_tool_prefix="${host_alias}-"
if test -z "$with_boost"; then
with_boost="$depends_prefix"
fi
+
+if test -z "$with_qt_libdir"; then
+ with_qt_libdir="${depends_prefix}/lib"
+fi
if test -z "$with_qt_plugindir"; then
with_qt_plugindir="${depends_prefix}/plugins"
fi
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index ae3f9aa686..2aaf6baa75 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -16,7 +16,6 @@
#include <qt/guiutil.h>
#include <qt/peertablesortproxy.h>
#include <qt/platformstyle.h>
-#include <qt/walletmodel.h>
#include <rpc/client.h>
#include <rpc/server.h>
#include <util/strencodings.h>
@@ -26,6 +25,10 @@
#include <univalue.h>
+#ifdef ENABLE_WALLET
+#include <qt/walletmodel.h>
+#endif
+
#include <QAbstractButton>
#include <QAbstractItemModel>
#include <QDateTime>

View File

@@ -15,13 +15,11 @@
<flag name="daemon">Build and install bitcoind daemon</flag>
<flag name="external-signer">Include support for external wallet signer programs</flag>
<flag name="gui">Build and install Bitcoin-Qt GUI</flag>
<flag name="nat-pmp">Enable NAT-PMP port forwarding</flag>
<flag name="qrcode">Enable generation of QR Codes for receiving payments</flag>
<flag name="sqlite">Support descriptor wallets in SQLite format</flag>
<flag name="system-libsecp256k1">Link with <pkg>dev-libs/libsecp256k1</pkg> rather than embedding an internal copy</flag>
<flag name="systemtap">Enable SystemTap/DTrace tracing</flag>
<flag name="test-full">Run tests that take a long time</flag>
<flag name="upnp">Enable Universal Plug and Play</flag>
<flag name="zeromq">Report blocks and transactions via zeromq</flag>
</use>
<upstream>