6 if type -p "$2" > /dev/null; then
13 # If a g-prefixed version of the command exists, use it preferentially.
15 cmd_pref "$1" "g$2" "$2"
18 gprefix READLINK readlink
19 cd "$(dirname "$("$READLINK" -f "$0")")/.."
21 # Allow user overrides to $MAKE. Typical usage for users who need it:
22 # MAKE=gmake ./zcutil/build.sh -j$(nproc)
23 if [[ -z "${MAKE-}" ]]; then
27 # Allow overrides to $BUILD and $HOST for porters. Most users will not need it.
28 # BUILD=i686-pc-linux-gnu ./zcutil/build.sh
29 if [[ -z "${BUILD-}" ]]; then
30 BUILD="$(./depends/config.guess)"
32 if [[ -z "${HOST-}" ]]; then
36 # Allow users to set arbitrary compile flags. Most users will not need this.
37 if [[ -z "${CONFIGURE_FLAGS-}" ]]; then
41 if [ "x$*" = 'x--help' ]
47 Show this help message and exit.
49 $0 [ --enable-lcov || --disable-tests ] [ --disable-mining ] [ --enable-proton ] [ MAKEARGS... ]
50 Build Zcash and most of its transitive dependencies from
51 source. MAKEARGS are applied to both dependencies and Zcash itself.
53 If --enable-lcov is passed, Zcash is configured to add coverage
54 instrumentation, thus enabling "make cov" to work.
55 If --disable-tests is passed instead, the Zcash tests are not built.
57 If --disable-mining is passed, Zcash is configured to not build any mining
58 code. It must be passed after the test arguments, if present.
60 If --enable-proton is passed, Zcash is configured to build the Apache Qpid Proton
61 library required for AMQP support. This library is not built by default.
62 It must be passed after the test/mining arguments, if present.
69 # If --enable-lcov is the first argument, enable lcov coverage support:
71 HARDENING_ARG='--enable-hardening'
73 if [ "x${1:-}" = 'x--enable-lcov' ]
75 LCOV_ARG='--enable-lcov'
76 HARDENING_ARG='--disable-hardening'
78 elif [ "x${1:-}" = 'x--disable-tests' ]
80 TEST_ARG='--enable-tests=no'
84 # If --disable-mining is the next argument, disable mining code:
86 if [ "x${1:-}" = 'x--disable-mining' ]
88 MINING_ARG='--enable-mining=no'
92 # If --enable-proton is the next argument, enable building Proton code:
93 PROTON_ARG='--enable-proton=no'
94 if [ "x${1:-}" = 'x--enable-proton' ]
100 eval "$MAKE" --version
104 HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1
107 # 0x03 2020-01-03, do not use '-Wno-builtin-declaration-mismatch or -Werror on GCC <v8
108 if [ "$(gcc --version|head -1 | awk '{print $4}' | cut -d"." -f1)" -lt 8 ]; then
110 CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" $CONFIGURE_FLAGS CPPFLAGS='-g' CXXFLAGS='-g'
113 CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" "$PROTON_ARG" $CONFIGURE_FLAGS CPPFLAGS='-g -Wno-builtin-declaration-mismatch -Werror' CXXFLAGS='-g'