Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1#!/bin/sh3set -eux5export LC_ALL=C7# Print commit and relevant CI environment to allow reproducing the job outside of CI.8git show --no-patch9print_environment() {10# Turn off -x because it messes up the output11set +x12# There are many ways to print variable names and their content. This one13# does not rely on bash.14for var in WERROR_CFLAGS MAKEFLAGS BUILD \15ECMULTWINDOW ECMULTGENKB ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \16EXPERIMENTAL ECDH RECOVERY EXTRAKEYS MUSIG SCHNORRSIG ELLSWIFT SILENTPAYMENTS \17SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS SYMBOL_CHECK \18EXAMPLES \19HOST WRAPPER_CMD \20CC CFLAGS CPPFLAGS AR NM \21UBSAN_OPTIONS ASAN_OPTIONS LSAN_OPTIONS22do23eval "isset=\${$var+x}"24if [ -n "$isset" ]; then25eval "val=\${$var}"26# shellcheck disable=SC215427printf '%s="%s" ' "$var" "$val"28fi29done30echo "$0"31set -x32}33print_environment35env >> test_env.log37# If gcc is requested, assert that it's in fact gcc (and not some symlinked Apple clang).38case "${CC:-undefined}" in39*gcc*)40$CC -v 2>&1 | grep -q "gcc version" || exit 1;41;;42esac44if [ -n "${CC+x}" ]; then45# The MSVC compiler "cl" doesn't understand "-v"46$CC -v || true47fi48if [ "$WITH_VALGRIND" = "yes" ]; then49valgrind --version50fi51if [ -n "$WRAPPER_CMD" ]; then52$WRAPPER_CMD --version53fi55./autogen.sh57./configure \58--enable-experimental="$EXPERIMENTAL" \59--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \60--with-ecmult-window="$ECMULTWINDOW" \61--with-ecmult-gen-kb="$ECMULTGENKB" \62--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \63--enable-module-ellswift="$ELLSWIFT" \64--enable-module-extrakeys="$EXTRAKEYS" \65--enable-module-schnorrsig="$SCHNORRSIG" \66--enable-module-musig="$MUSIG" \67--enable-module-silentpayments="$SILENTPAYMENTS" \68--enable-examples="$EXAMPLES" \69--enable-ctime-tests="$CTIMETESTS" \70--with-valgrind="$WITH_VALGRIND" \71--host="$HOST" $EXTRAFLAGS73# We have set "-j<n>" in MAKEFLAGS.74build_exit_code=075make > make.log 2>&1 || build_exit_code=$?76cat make.log77if [ $build_exit_code -ne 0 ]; then78case "${CC:-undefined}" in79*snapshot*)80# Ignore internal compiler errors in gcc-snapshot and clang-snapshot81grep -e "internal compiler error:" -e "PLEASE submit a bug report" make.log82exit $?83;;84*)85exit 186;;87esac88fi90# Print information about binaries so that we can see that the architecture is correct91file *tests* || true92file bench* || true93file .libs/* || true95if [ "$SYMBOL_CHECK" = "yes" ]96then97python3 --version98case "$HOST" in99*mingw*)100ls -l .libs101python3 ./tools/symbol-check.py .libs/libsecp256k1-*.dll102;;103*)104python3 ./tools/symbol-check.py .libs/libsecp256k1.so105;;106esac107fi109# This tells `make check` to wrap test invocations.110export LOG_COMPILER="$WRAPPER_CMD"112make "$BUILD"114# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool115EXEC='./libtool --mode=execute'116if [ -n "$WRAPPER_CMD" ]117then118EXEC="$EXEC $WRAPPER_CMD"119fi121if [ "$BENCH" = "yes" ]122then123{124$EXEC ./bench_ecmult125$EXEC ./bench_internal126$EXEC ./bench127} >> bench.log 2>&1128fi130if [ "$CTIMETESTS" = "yes" ]131then132if [ "$WITH_VALGRIND" = "yes" ]; then133./libtool --mode=execute valgrind --error-exitcode=42 ./ctime_tests > ctime_tests.log 2>&1134else135$EXEC ./ctime_tests > ctime_tests.log 2>&1136fi137fi139# Rebuild precomputed files (if not cross-compiling).140if [ -z "$HOST" ]141then142make clean-precomp clean-testvectors143make precomp testvectors144fi146# Check that no repo files have been modified by the build.147# (This fails for example if the precomp files need to be updated in the repo.)148git diff --exit-code
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.