mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
cf5faf73c9
This includes a commit to fix building LLVM 17 on riscv64, see https://git.savannah.gnu.org/cgit/guix.git/commit/?id=4e26331a5ee87928a16888c36d51e270f0f10f90. Followup to discussion in https://github.com/bitcoin/bitcoin/pull/28880#issuecomment-1843313196. If you don't have riscv64 hardware, this can be tested with the following: ```bash guix time-machine --commit=d5ca4d4fd713a9f7e17e074a1e37dda99bbb09fc -- build --target=riscv64-linux-gnu llvm .... riscv64-linux-gnu-ld: CMakeFiles/dsymutil.dir/dsymutil.cpp.o: undefined reference to symbol '__atomic_fetch_and_1@@LIBATOMIC_1.0' riscv64-linux-gnu-ld: /gnu/store/i4ga0pnr1b74bir2bjyp8mcrrbsvk7d3-gcc-cross-riscv64-linux-gnu-11.3.0-lib/riscv64-linux-gnu/lib/libatomic.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status guix time-machine --commit=dc4842797bfdc5f9f3f5f725bf189c2b68bd6b5a -- build --target=riscv64-linux-gnu llvm .... grafting '/gnu/store/7y0j0y8jaz4mjx2nz0y42wdnxxjp6id6-llvm-17.0.6-opt-viewer' -> '/gnu/store/8xvahrrjscbprh6cjj0qp5bm9mm78wwa-llvm-17.0.6-opt-viewer'... grafting '/gnu/store/bjhw648bz7ijd2p9hgzzdbw1q8hpagk8-llvm-17.0.6' -> '/gnu/store/x50qi8i2ywgpx6azv4k55ms0w5xjxxg5-llvm-17.0.6'... successfully built /gnu/store/q9xvk8gzzvb4dxfzf6yi5164zd0d1vj2-llvm-17.0.6.drv ```
82 lines
2.2 KiB
Bash
82 lines
2.2 KiB
Bash
#!/usr/bin/env bash
|
|
export LC_ALL=C
|
|
set -e -o pipefail
|
|
|
|
# shellcheck source=contrib/shell/realpath.bash
|
|
source contrib/shell/realpath.bash
|
|
|
|
# shellcheck source=contrib/shell/git-utils.bash
|
|
source contrib/shell/git-utils.bash
|
|
|
|
################
|
|
# Required non-builtin commands should be invocable
|
|
################
|
|
|
|
check_tools() {
|
|
for cmd in "$@"; do
|
|
if ! command -v "$cmd" > /dev/null 2>&1; then
|
|
echo "ERR: This script requires that '$cmd' is installed and available in your \$PATH"
|
|
exit 1
|
|
fi
|
|
done
|
|
}
|
|
|
|
check_tools cat env readlink dirname basename git
|
|
|
|
################
|
|
# We should be at the top directory of the repository
|
|
################
|
|
|
|
same_dir() {
|
|
local resolved1 resolved2
|
|
resolved1="$(bash_realpath "${1}")"
|
|
resolved2="$(bash_realpath "${2}")"
|
|
[ "$resolved1" = "$resolved2" ]
|
|
}
|
|
|
|
if ! same_dir "${PWD}" "$(git_root)"; then
|
|
cat << EOF
|
|
ERR: This script must be invoked from the top level of the git repository
|
|
|
|
Hint: This may look something like:
|
|
env FOO=BAR ./contrib/guix/guix-<blah>
|
|
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
################
|
|
# Execute "$@" in a pinned, possibly older version of Guix, for reproducibility
|
|
# across time.
|
|
time-machine() {
|
|
# shellcheck disable=SC2086
|
|
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
|
|
--commit=dc4842797bfdc5f9f3f5f725bf189c2b68bd6b5a \
|
|
--cores="$JOBS" \
|
|
--keep-failed \
|
|
--fallback \
|
|
${SUBSTITUTE_URLS:+--substitute-urls="$SUBSTITUTE_URLS"} \
|
|
${ADDITIONAL_GUIX_COMMON_FLAGS} ${ADDITIONAL_GUIX_TIMEMACHINE_FLAGS} \
|
|
-- "$@"
|
|
}
|
|
|
|
|
|
################
|
|
# Set common variables
|
|
################
|
|
|
|
VERSION="${FORCE_VERSION:-$(git_head_version)}"
|
|
DISTNAME="${DISTNAME:-bitcoin-${VERSION}}"
|
|
|
|
version_base_prefix="${PWD}/guix-build-"
|
|
VERSION_BASE="${version_base_prefix}${VERSION}" # TOP
|
|
|
|
DISTSRC_BASE="${DISTSRC_BASE:-${VERSION_BASE}}"
|
|
|
|
OUTDIR_BASE="${OUTDIR_BASE:-${VERSION_BASE}/output}"
|
|
|
|
var_base_basename="var"
|
|
VAR_BASE="${VAR_BASE:-${VERSION_BASE}/${var_base_basename}}"
|
|
|
|
profiles_base_basename="profiles"
|
|
PROFILES_BASE="${PROFILES_BASE:-${VAR_BASE}/${profiles_base_basename}}"
|