Merge updates from master

This commit is contained in:
Repository mirror & CI
2024-09-02 05:18:54 +00:00
12 changed files with 799 additions and 410 deletions
+1
View File
@@ -5,4 +5,5 @@ DIST bitcoin-core-26.1.tar.gz 12822211 BLAKE2B 9093133f025a47cc93cc02056c2588be0
DIST bitcoin-core-26.2.tar.gz 12889171 BLAKE2B 9a0d5ed49eb4e14e9bd4c88fb5665536a82ad054c8a6756bed7eeff15be1fb15bca280e73ecd97a2a09d5a4bc9ae6c400f815a83e62959eac26a22d0803a2282 SHA512 4069a903423d58e29a49c638274f0916d6b8e6e8761b987e570a230ecb3b5f6ceaa499b1d6e3dd52bc16f2c3c229ad31ab2ce1d0c91e61d85a65fdc477b0e3ba
DIST bitcoin-core-27.0.tar.gz 13087956 BLAKE2B f625eaa2ce98cd8ed771f97d5a7e66733e94523d2ddda99cd858777bfb88a6e7eafae71e10fbf1ddadfcf629f2e3f790fb48c39f0e016d3fb22f1da7e7c93614 SHA512 0833fbd654570bc3e50efbe4da1f0bcab7744b92becc76d0dfea39a551325bd1b64ae746f7d9824d9e93fc53c95bc5eb5977869f0af04e26bd8ccb992d4c6e7c
DIST bitcoin-core-27.1.tar.gz 13146683 BLAKE2B 9df45ca67565aa1f1cb851e86302ab5e7edbc573642cbd66585910cbd20ecbe8b3a89f7441fc7f299bb3ff32cf687a617f7449cd1a4164e9ac78637501f619da SHA512 b3c2f90b125705401dbf1318db44be586f3609473a9aa3b7330d6c7f48bf5b31951f822e494ae607ebb96e5ffb62b909bea51be14fd91ed71ea62324d2736862
DIST bitcoin-core-28.0_rc1.tar.gz 12588747 BLAKE2B dc1900ad2dd58c504092127d60db83e22cea67cbb693f6d827b9284e4ddaed9c447a0107fcbc7109dd98a465b239aee46b10496c40f40301d5e02d02b16d86a3 SHA512 6d123330d8b3f4f50b21f84463c754d8bf179b0298f1004ef3249655213fb37855665de6eb3b2e226c3127e0e83bdb93a4ee0992d300f37025c5f033dbb1891e
DIST bitcoin-core-miniupnpc-2.2.8-compat.patch 1130 BLAKE2B 4b1e8eaf4c7f13e9317fa4f69f6c2bce5f1663d8e4731bfe5ca5b4622fcd140e6532acdae544259727a59050b7f3f7bd7dab6f7f23dccebef4caf8fdef0f0c83 SHA512 ec0890d90a5ec3555b2e5477ead75ea5874c57aa3312dc64df5688224f51569f3f7c59593ed2f4336b283fff71c87b5d4fd786ab3cfecbb6407ef143b5018ba5
@@ -0,0 +1,423 @@
# Copyright 1999-2024 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-leveldb +system-libsecp256k1 systemtap test test-full upnp zeromq"
RESTRICT="!test? ( test )"
REQUIRED_USE="
dbus? ( gui )
kde? ( gui )
qrcode? ( gui )
system-leveldb? ( || ( daemon 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-leveldb? ( virtual/bitcoin-leveldb )
system-libsecp256k1? ( >=dev-libs/libsecp256k1-0.4.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/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
! 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 {,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-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 $(usev test-full --extended) --jobs="$(get_makeopts_jobs)" --timeout-factor="${TIMEOUT_FACTOR:-15}"
}
src_install() {
DOCS+=( doc/release-notes/*.md )
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
}
@@ -0,0 +1,296 @@
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
+1
View File
@@ -23,6 +23,7 @@
<flag name="system-leveldb">Link with <pkg>virtual/bitcoin-leveldb</pkg> rather than embedding an internal copy</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>
+1
View File
@@ -1,3 +1,4 @@
DIST bc-6.5.0.tar.xz 461380 BLAKE2B e4aa633162d03fc5723e967ba81f985ab1b16e47b3c9a3ca1c32e9a717db682ce88cc6ba453d5e9b09539dcb8ddbb258b7b7dbdd2e27279355e3c35028d56130 SHA512 1cb03038d828a0b10734c29931777add8b22f194c507b8ff538ec1aa52a2a97a4ac2733d72cdb0710fdc6937807074e929f7918c56aaf5be8fbe908ea7c5a401
DIST bc-6.7.5.tar.xz 468572 BLAKE2B 3942cfbbc2b8a307bc24b9f7c3e037bce374bd17332b236a8c76ccacef1177e36669b7f61944a5c5791b0a436dec171991cfc821526865a816fba91e65aa1f04 SHA512 5f689fd20801ea7ede725ae5dc4e8744bdf2d72424bffef99c53193a950f4bd83b6eb4c5a07556576d0b3f5b6cd7f9fc7cbcb41d27891f488bb2e97a186f76a4
DIST bc-7.0.0.tar.xz 474468 BLAKE2B 2905f96639558a7f1203a0f63207f26b5e4cb75a91c4b848a4ef7f0313dfaa698499f948eb7ecdbc5eb3fcd0bd3ecf8c2f005256e48a58615fa8b69ec19932ae SHA512 ef89525eea8773dddb7efd3dd33f589de287ac807b772480e884bd666f29b2b0b362c999029cc6d82733f830195ca3f6fd867f15190fbcbf807ddbc4b24abb65
DIST bc-7.0.1.tar.xz 474272 BLAKE2B ed83854828a917c5e5cdfcb46d2b0a2769f937c45cb454533ad42c3037331fcf4a668acaffb11acde733f587270d121ed3f6677f50b751de25835bd9b267f63a SHA512 376ef1b4a72a64ee114ee5a835ea36ad4f26fdd06662df2db387e645c7ab86b49b019461928e891455daeae9afddb496959c4b2aebeafb1b37051c379c62a888
+77
View File
@@ -0,0 +1,77 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit edo
MY_P="bc-${PV}"
DESCRIPTION="Implementation of POSIX bc with GNU extensions"
HOMEPAGE="
https://git.gavinhoward.com/gavin/bc/
https://github.com/gavinhoward/bc/
"
SRC_URI="
https://github.com/gavinhoward/bc/releases/download/${PV}/${MY_P}.tar.xz
"
S=${WORKDIR}/${MY_P}
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
IUSE="libedit readline"
DEPEND="
!readline? (
libedit? ( dev-libs/libedit:= )
)
readline? (
sys-libs/readline:=
sys-libs/ncurses:=
)
"
RDEPEND="
${DEPEND}
"
src_configure() {
local myconf=(
# GNU and BSD bc's have slightly different behavior. This bc can act
# like both, changing at runtime with environment variables, but it
# needs defaults, which can be set at compile time. This option sets all
# of the defaults to match the GNU bc/dc since it's common on Linux.
-pGNU
# A lot of test results are generated first by a bc compatible with the
# GNU bc. If there is no GNU bc installed, then those tests should be
# skipped. That's what this option does. Without it, we would have a
# dependency cycle. Those tests are super long, anyway.
-G
# Disables the automatic stripping of binaries.
-T
# Enables installing all locales, which is important for packages.
-l
# Disables some "problematic" tests that need specific options on Linux
# to not trigger the OOM killer because malloc() lies.
-P
)
if use readline ; then
myconf+=( -r )
elif use libedit ; then
myconf+=( -e )
fi
local -x EXECSUFFIX="-gh"
local -x PREFIX="${EPREFIX}/usr"
edo ./configure.sh "${myconf[@]}"
}
src_test() {
# This is to fix a bug encountered on Arch. It is to ensure we don't get
# segfaults on `make check` when the error messages change because the error
# messages are passed to printf(); they have format specifiers. With these
# env vars, the internal error messages are used, instead of the installed
# locales, which might be different since the new locale files are not
# installed yet. (It is impossible to use uninstalled locales because of the
# poor design of POSIX locales.)
env LANG=C LC_ALL=C emake check
}
-3
View File
@@ -1,6 +1,3 @@
DIST mold-2.1.0.tar.gz 9278811 BLAKE2B b31e13f92177553adf5069cf35c8c75c7bc28f0af4d1726cdc0c6abc1c9d3baaa5be512c3a8fb9bc3c3110096a79e1c6751c701171769595a2234fc1fa8c441a SHA512 f1c98d349b35b4042109d71f7db6eb8d7d089dc3241735bbd7b5402d513dcc85ca17904828779e5fc8234650fa9fb97f47c3a2f3e89cc2fb3cb9e9110439e5a2
DIST mold-2.30.0.tar.gz 9957539 BLAKE2B f45924598029dabfb2c02298e1f89aae848cd64e2e87dd80f500de323517db92e62df798feee8a2cd81cb930eff0640c2b9957808a4080f0027884015994ce64 SHA512 7cfba4f0fb332799ad267d3eafb8e2f0057af4484467b3e3fbaf8044220163a2c7e26cd1786510f250844c8b57e30c15167c8dd9688af1773abc580c5605abf3
DIST mold-2.31.0.tar.gz 10031469 BLAKE2B 338f516efcb430c8393fb0d6861b913fa1dd0095226e3d13018255da4f0b4affa168928b1e5cfbd0b5a4efcf840612675f04579f0c1d3c0e2b3c6815d6bef4c0 SHA512 343c62d8c67b74988f762c46999d2d866b2e9a0c69d2b910b12384ea5abc620b30468cd1b1bacfe41474d1c97c8ce2e49d55ca70479691238fb73d83d9adc683
DIST mold-2.32.0.tar.gz 10005686 BLAKE2B a277a29498f4d6b33da49ba038ce5ef1c4a1bd3ac84ea994a2aae5d36139a2ee773e08e1a3ff0a7382da4d2319ce994575e3ed1e5be8e5f7a161045aaf4e2d58 SHA512 66cd95ec65b31749ead7604f921eebd9f8e7faad82f6aa2cd7a179e4f4cb2bd78584ec5a8de000fbd4c37bbbfeb878e40a4e93ca909d1be557d73117e4b38f4b
DIST mold-2.32.1.tar.gz 10010384 BLAKE2B b020d57df25d91fac9b6ef994e9f7f73b6736d18a73be3caebe03a851a1db1986abe395b5481a1e30e01f38362c3705cb5903251b7201c0003c745dee37a5148 SHA512 d38b12faf81ba8015fc0cdb52944ac94366877c3033871a92610087e036d75b3d072baf9bbf107a9029495521e067fb36c0809b5138f90976492547b39c33085
DIST mold-2.33.0.tar.gz 10061838 BLAKE2B 65c460035f3bdbc101120a27e30b70982d549a4222cf4beb1b7228c0c961afd3eb8928cacde5be20734a80a80765eb60e6d961bd5cb001ecaef1aba1152730b9 SHA512 67c41ae33f8a229f32aabf32ffb8bcb261eff047dedd189b8751e5de43ef12a2dbd05f45632c8baeac2ceff99c40256256d7d5c790cc12e4fecf1dc3cfebeb11
@@ -1,76 +0,0 @@
https://github.com/rui314/mold/issues/1244
https://github.com/rui314/mold/commit/002d619b11f38438514f4714f9eb89e8015ba1b6
https://github.com/rui314/mold/commit/14952546a489c23236f50adc5ef9c8ada4f4e31a
From 002d619b11f38438514f4714f9eb89e8015ba1b6 Mon Sep 17 00:00:00 2001
From: Rui Ueyama <ruiu@cs.stanford.edu>
Date: Thu, 25 Apr 2024 16:58:09 +0900
Subject: [PATCH] Attempt to fix a test failure
I believe some version of objcopy corrupts an object file when
renaming a section. In this change, I use sed instead of objcopy
as a workaround.
Fixes https://github.com/rui314/mold/issues/1244
---
test/elf/exception-multiple-ehframe.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
index ca1d1a1c0..a9b360b09 100755
--- a/test/elf/exception-multiple-ehframe.sh
+++ b/test/elf/exception-multiple-ehframe.sh
@@ -28,9 +28,9 @@ int bar() {
}
EOF
-$OBJCOPY --rename-section .eh_frame=.eh_frame2 $t/a.o
+sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
./mold -r -o $t/c.o $t/a.o $t/b.o
-$OBJCOPY --rename-section .eh_frame2=.eh_frame $t/c.o
+sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
cat <<EOF | $CXX -o $t/d.o -c -xc++ -
#include <stdio.h>
@@ -44,5 +44,4 @@ int main() {
EOF
$CXX -B. -o $t/exe1 $t/d.o $t/c.o
-$QEMU $t/exe1
$QEMU $t/exe1 | grep -q '^1 3$'
From 14952546a489c23236f50adc5ef9c8ada4f4e31a Mon Sep 17 00:00:00 2001
From: Rui Ueyama <ruiu@cs.stanford.edu>
Date: Sun, 28 Apr 2024 13:04:43 +0900
Subject: [PATCH] Do not edit binary files with sed
Fixes https://github.com/rui314/mold/issues/1244
---
test/elf/exception-multiple-ehframe.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
index a9b360b09..8cc31624a 100755
--- a/test/elf/exception-multiple-ehframe.sh
+++ b/test/elf/exception-multiple-ehframe.sh
@@ -3,6 +3,8 @@
nm mold | grep -q '__tsan_init' && skip
+which perl > /dev/null || skip
+
[ $MACHINE = m68k ] && skip
[ $MACHINE = sh4 ] && skip
@@ -28,9 +30,9 @@ int bar() {
}
EOF
-sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
+perl -i -0777 -pe 's/\.eh_frame/.EH_FRAME/g' $t/a.o
./mold -r -o $t/c.o $t/a.o $t/b.o
-sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
+perl -i -0777 -pe 's/\.EH_FRAME/.eh_frame/g' $t/c.o
cat <<EOF | $CXX -o $t/d.o -c -xc++ -
#include <stdio.h>
@@ -1,31 +0,0 @@
https://github.com/rui314/mold/pull/1246
From ec0a9d09ddff8b1796ff1822d5381442cd28acb1 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Tue, 30 Apr 2024 07:54:40 +0100
Subject: [PATCH] test: use `command -v`, not non-portable `which`
`which` isn't in POSIX and several Linux distributions are trying to
remove it from their base system, see e.g. https://lwn.net/Articles/874049/.
Just use `command -v` which is POSIX.
Signed-off-by: Sam James <sam@gentoo.org>
---
test/elf/exception-multiple-ehframe.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
index 8cc31624a..1b9f434a4 100755
--- a/test/elf/exception-multiple-ehframe.sh
+++ b/test/elf/exception-multiple-ehframe.sh
@@ -3,7 +3,7 @@
nm mold | grep -q '__tsan_init' && skip
-which perl > /dev/null || skip
+command -v perl > /dev/null || skip
[ $MACHINE = m68k ] && skip
[ $MACHINE = sh4 ] && skip
-103
View File
@@ -1,103 +0,0 @@
# Copyright 2021-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake toolchain-funcs
DESCRIPTION="A Modern Linker"
HOMEPAGE="https://github.com/rui314/mold"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/rui314/mold.git"
inherit git-r3
else
SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
fi
# mold (MIT)
# - xxhash (BSD-2)
LICENSE="MIT BSD-2"
SLOT="0"
RDEPEND="
app-arch/zstd:=
>=dev-cpp/tbb-2021.7.0-r1:=
dev-libs/blake3:=
sys-libs/zlib
!kernel_Darwin? (
>=dev-libs/mimalloc-2:=
)
"
DEPEND="${RDEPEND}"
PATCHES=(
"${FILESDIR}"/${P}-gcc14.patch
"${FILESDIR}"/${PN}-2.30.0-which-hunt.patch
)
pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then
if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
die "${PN} needs at least gcc 10"
elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
die "${PN} needs at least clang 12"
fi
fi
}
src_prepare() {
cmake_src_prepare
# Needs unpackaged dwarfdump
rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh || die
# Heavy tests, need qemu
rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
# Sandbox sadness
rm test/elf/run.sh || die
sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
test/elf/mold-wrapper{,2}.sh || die
# static-pie tests require glibc built with static-pie support
if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
rm test/elf/{,ifunc-}static-pie.sh || die
fi
}
src_configure() {
local mycmakeargs=(
-DMOLD_ENABLE_QEMU_TESTS=OFF
-DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.
-DMOLD_USE_MIMALLOC=$(usex !kernel_Darwin)
-DMOLD_USE_SYSTEM_MIMALLOC=ON
-DMOLD_USE_SYSTEM_TBB=ON
)
cmake_src_configure
}
src_install() {
dobin "${BUILD_DIR}"/${PN}
# https://bugs.gentoo.org/872773
insinto /usr/$(get_libdir)/mold
doins "${BUILD_DIR}"/${PN}-wrapper.so
dodoc docs/{design,execstack}.md
doman docs/${PN}.1
dosym ${PN} /usr/bin/ld.${PN}
dosym ${PN} /usr/bin/ld64.${PN}
dosym -r /usr/bin/${PN} /usr/libexec/${PN}/ld
}
src_test() {
export TEST_CC="$(tc-getCC)" \
TEST_GCC="$(tc-getCC)" \
TEST_CXX="$(tc-getCXX)" \
TEST_GXX="$(tc-getCXX)"
cmake_src_test
}
-98
View File
@@ -1,98 +0,0 @@
# Copyright 2021-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake toolchain-funcs
DESCRIPTION="A Modern Linker"
HOMEPAGE="https://github.com/rui314/mold"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/rui314/mold.git"
inherit git-r3
else
SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
fi
# mold (MIT)
# - xxhash (BSD-2)
LICENSE="MIT BSD-2"
SLOT="0"
RDEPEND="
app-arch/zstd:=
>=dev-cpp/tbb-2021.7.0-r1:=
dev-libs/blake3:=
sys-libs/zlib
!kernel_Darwin? (
>=dev-libs/mimalloc-2:=
)
"
DEPEND="${RDEPEND}"
pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then
if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
die "${PN} needs at least gcc 10"
elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
die "${PN} needs at least clang 12"
fi
fi
}
src_prepare() {
cmake_src_prepare
# Needs unpackaged dwarfdump
rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh || die
# Heavy tests, need qemu
rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
# Sandbox sadness
rm test/elf/run.sh || die
sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
test/elf/mold-wrapper{,2}.sh || die
# static-pie tests require glibc built with static-pie support
if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
rm test/elf/{,ifunc-}static-pie.sh || die
fi
}
src_configure() {
local mycmakeargs=(
-DMOLD_ENABLE_QEMU_TESTS=OFF
-DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.
-DMOLD_USE_MIMALLOC=$(usex !kernel_Darwin)
-DMOLD_USE_SYSTEM_MIMALLOC=ON
-DMOLD_USE_SYSTEM_TBB=ON
)
cmake_src_configure
}
src_install() {
dobin "${BUILD_DIR}"/${PN}
# https://bugs.gentoo.org/872773
insinto /usr/$(get_libdir)/mold
doins "${BUILD_DIR}"/${PN}-wrapper.so
dodoc docs/{design,execstack}.md
doman docs/${PN}.1
dosym ${PN} /usr/bin/ld.${PN}
dosym ${PN} /usr/bin/ld64.${PN}
dosym -r /usr/bin/${PN} /usr/libexec/${PN}/ld
}
src_test() {
export TEST_CC="$(tc-getCC)" \
TEST_GCC="$(tc-getCC)" \
TEST_CXX="$(tc-getCXX)" \
TEST_GXX="$(tc-getCXX)"
cmake_src_test
}
-99
View File
@@ -1,99 +0,0 @@
# Copyright 2021-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake toolchain-funcs
DESCRIPTION="A Modern Linker"
HOMEPAGE="https://github.com/rui314/mold"
if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/rui314/mold.git"
inherit git-r3
else
SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
fi
# mold (MIT)
# - xxhash (BSD-2)
# - siphash ( MIT CC0-1.0 )
LICENSE="MIT BSD-2 CC0-1.0"
SLOT="0"
RDEPEND="
app-arch/zstd:=
>=dev-cpp/tbb-2021.7.0-r1:=
dev-libs/blake3:=
sys-libs/zlib
!kernel_Darwin? (
>=dev-libs/mimalloc-2:=
)
"
DEPEND="${RDEPEND}"
pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then
if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
die "${PN} needs at least gcc 10"
elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
die "${PN} needs at least clang 12"
fi
fi
}
src_prepare() {
cmake_src_prepare
# Needs unpackaged dwarfdump
rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh || die
# Heavy tests, need qemu
rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
# Sandbox sadness
rm test/elf/run.sh || die
sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
test/elf/mold-wrapper{,2}.sh || die
# static-pie tests require glibc built with static-pie support
if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
rm test/elf/{,ifunc-}static-pie.sh || die
fi
}
src_configure() {
local mycmakeargs=(
-DMOLD_ENABLE_QEMU_TESTS=OFF
-DMOLD_LTO=OFF # Should be up to the user to decide this with CXXFLAGS.
-DMOLD_USE_MIMALLOC=$(usex !kernel_Darwin)
-DMOLD_USE_SYSTEM_MIMALLOC=ON
-DMOLD_USE_SYSTEM_TBB=ON
)
cmake_src_configure
}
src_install() {
dobin "${BUILD_DIR}"/${PN}
# https://bugs.gentoo.org/872773
insinto /usr/$(get_libdir)/mold
doins "${BUILD_DIR}"/${PN}-wrapper.so
dodoc docs/{design,execstack}.md
doman docs/${PN}.1
dosym ${PN} /usr/bin/ld.${PN}
dosym ${PN} /usr/bin/ld64.${PN}
dosym -r /usr/bin/${PN} /usr/libexec/${PN}/ld
}
src_test() {
export TEST_CC="$(tc-getCC)" \
TEST_GCC="$(tc-getCC)" \
TEST_CXX="$(tc-getCXX)" \
TEST_GXX="$(tc-getCXX)"
cmake_src_test
}