@@ -8,6 +8,124 @@ export LC_ALL=C.UTF-8
8
8
9
9
set -ex
10
10
11
+ if [ " $CI_OS_NAME " == " macos" ]; then
12
+ top -l 1 -s 0 | awk ' /PhysMem/ {print}'
13
+ echo " Number of CPUs: $( sysctl -n hw.logicalcpu) "
14
+ else
15
+ free -m -h
16
+ echo " Number of CPUs \(nproc\):" \$\( nproc\)
17
+ lscpu | grep Endian
18
+ fi
19
+ echo " Free disk space:"
20
+ df -h
21
+
22
+ if [ " $RUN_FUZZ_TESTS " = " true" ]; then
23
+ export DIR_FUZZ_IN=${DIR_QA_ASSETS} /fuzz_seed_corpus/
24
+ if [ ! -d " $DIR_FUZZ_IN " ]; then
25
+ git clone --depth=1 https://github.com/bitcoin-core/qa-assets " ${DIR_QA_ASSETS} "
26
+ fi
27
+ elif [ " $RUN_UNIT_TESTS " = " true" ] || [ " $RUN_UNIT_TESTS_SEQUENTIAL " = " true" ]; then
28
+ export DIR_UNIT_TEST_DATA=${DIR_QA_ASSETS} /unit_test_data/
29
+ if [ ! -d " $DIR_UNIT_TEST_DATA " ]; then
30
+ mkdir -p " $DIR_UNIT_TEST_DATA "
31
+ curl --location --fail https://github.com/bitcoin-core/qa-assets/raw/main/unit_test_data/script_assets_test.json -o " ${DIR_UNIT_TEST_DATA} /script_assets_test.json"
32
+ fi
33
+ fi
34
+
35
+ mkdir -p " ${BASE_SCRATCH_DIR} /sanitizer-output/"
36
+
37
+ if [ " $USE_BUSY_BOX " = " true" ]; then
38
+ echo " Setup to use BusyBox utils"
39
+ # tar excluded for now because it requires passing in the exact archive type in ./depends (fixed in later BusyBox version)
40
+ # ar excluded for now because it does not recognize the -q option in ./depends (unknown if fixed)
41
+ for util in $( busybox --list | grep -v " ^ar$" | grep -v " ^tar$" ) ; do ln -s " $( command -v busybox) " " ${BINS_SCRATCH_DIR} /$util " ; done
42
+ # Print BusyBox version
43
+ patch --help
44
+ fi
45
+
46
+ # Make sure default datadir does not exist and is never read by creating a dummy file
47
+ if [ " $CI_OS_NAME " == " macos" ]; then
48
+ echo > " ${HOME} /Library/Application Support/Bitcoin"
49
+ else
50
+ echo > " ${HOME} /.bitcoin"
51
+ fi
52
+
53
+ if [ -z " $NO_DEPENDS " ]; then
54
+ if [[ $CI_IMAGE_NAME_TAG == * centos* ]]; then
55
+ # CentOS has problems building the depends if the config shell is not explicitly set
56
+ # (i.e. for libevent a Makefile with an empty SHELL variable is generated, leading to
57
+ # an error as the first command is executed)
58
+ SHELL_OPTS=" LC_ALL=en_US.UTF-8 CONFIG_SHELL=/bin/dash"
59
+ else
60
+ SHELL_OPTS=" CONFIG_SHELL="
61
+ fi
62
+ bash -c " $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS LOG=1"
63
+ fi
64
+ if [ " $DOWNLOAD_PREVIOUS_RELEASES " = " true" ]; then
65
+ test/get_previous_releases.py -b -t " $PREVIOUS_RELEASES_DIR "
66
+ fi
67
+
68
+ BITCOIN_CONFIG_ALL=" --enable-suppress-external-warnings --disable-dependency-tracking"
69
+ if [ -z " $NO_DEPENDS " ]; then
70
+ BITCOIN_CONFIG_ALL=" ${BITCOIN_CONFIG_ALL} CONFIG_SITE=$DEPENDS_DIR /$HOST /share/config.site"
71
+ fi
72
+ if [ -z " $NO_WERROR " ]; then
73
+ BITCOIN_CONFIG_ALL=" ${BITCOIN_CONFIG_ALL} --enable-werror"
74
+ fi
75
+
76
+ ccache --zero-stats --max-size=" ${CCACHE_SIZE} "
77
+ PRINT_CCACHE_STATISTICS=" ccache --version | head -n 1 && ccache --show-stats"
78
+
79
+ if [ -n " $ANDROID_TOOLS_URL " ]; then
80
+ make distclean || true
81
+ ./autogen.sh
82
+ bash -c " ./configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG " || ( (cat config.log) && false)
83
+ make " ${MAKEJOBS} " && cd src/qt && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk
84
+ bash -c " ${PRINT_CCACHE_STATISTICS} "
85
+ exit 0
86
+ fi
87
+
88
+ BITCOIN_CONFIG_ALL=" ${BITCOIN_CONFIG_ALL} --enable-external-signer --prefix=$BASE_OUTDIR "
89
+
90
+ if [ -n " $CONFIG_SHELL " ]; then
91
+ " $CONFIG_SHELL " -c " ./autogen.sh"
92
+ else
93
+ ./autogen.sh
94
+ fi
95
+
96
+ mkdir -p " ${BASE_BUILD_DIR} "
97
+ cd " ${BASE_BUILD_DIR} "
98
+
99
+ bash -c " ${BASE_ROOT_DIR} /configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG " || ( (cat config.log) && false)
100
+
101
+ make distdir VERSION=" $HOST "
102
+
103
+ cd " ${BASE_BUILD_DIR} /bitcoin-$HOST "
104
+
105
+ bash -c " ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG " || ( (cat config.log) && false)
106
+
107
+ set -o errtrace
108
+ trap ' bash -c "cat ${BASE_SCRATCH_DIR}/sanitizer-output/* 2> /dev/null"' ERR
109
+
110
+ if [[ ${USE_MEMORY_SANITIZER} == " true" ]]; then
111
+ # MemorySanitizer (MSAN) does not support tracking memory initialization done by
112
+ # using the Linux getrandom syscall. Avoid using getrandom by undefining
113
+ # HAVE_SYS_GETRANDOM. See https://github.com/google/sanitizers/issues/852 for
114
+ # details.
115
+ grep -v HAVE_SYS_GETRANDOM src/config/bitcoin-config.h > src/config/bitcoin-config.h.tmp && mv src/config/bitcoin-config.h.tmp src/config/bitcoin-config.h
116
+ fi
117
+
118
+ if [[ " ${RUN_TIDY} " == " true" ]]; then
119
+ MAYBE_BEAR=" bear --config src/.bear-tidy-config"
120
+ MAYBE_TOKEN=" --"
121
+ fi
122
+
123
+ bash -c " ${MAYBE_BEAR} ${MAYBE_TOKEN} make $MAKEJOBS $GOAL " || ( echo " Build failure. Verbose build follows." && make " $GOAL " V=1 ; false )
124
+
125
+ bash -c " ${PRINT_CCACHE_STATISTICS} "
126
+ du -sh " ${DEPENDS_DIR} " /* /
127
+ du -sh " ${PREVIOUS_RELEASES_DIR} "
128
+
11
129
if [[ $HOST = * -mingw32 ]]; then
12
130
# Generate all binaries, so that they can be wrapped
13
131
make " $MAKEJOBS " -C src/secp256k1 VERBOSE=1
0 commit comments