2016-11-10 22:10:53 -08:00
|
|
|
#!/usr/bin/env bash
|
2015-11-24 11:23:36 -08:00
|
|
|
|
2016-04-18 11:15:34 -07:00
|
|
|
set -eu -o pipefail
|
|
|
|
|
2017-10-28 17:10:09 -07:00
|
|
|
function cmd_pref() {
|
|
|
|
if type -p "$2" > /dev/null; then
|
|
|
|
eval "$1=$2"
|
|
|
|
else
|
|
|
|
eval "$1=$3"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# If a g-prefixed version of the command exists, use it preferentially.
|
|
|
|
function gprefix() {
|
|
|
|
cmd_pref "$1" "g$2" "$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
gprefix READLINK readlink
|
2017-10-29 05:22:55 -07:00
|
|
|
cd "$(dirname "$("$READLINK" -f "$0")")/.."
|
2017-10-28 17:10:09 -07:00
|
|
|
|
2016-11-10 22:10:53 -08:00
|
|
|
# Allow user overrides to $MAKE. Typical usage for users who need it:
|
|
|
|
# MAKE=gmake ./zcutil/build.sh -j$(nproc)
|
|
|
|
if [[ -z "${MAKE-}" ]]; then
|
|
|
|
MAKE=make
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Allow overrides to $BUILD and $HOST for porters. Most users will not need it.
|
|
|
|
# BUILD=i686-pc-linux-gnu ./zcutil/build.sh
|
|
|
|
if [[ -z "${BUILD-}" ]]; then
|
2017-10-29 05:22:55 -07:00
|
|
|
BUILD="$(./depends/config.guess)"
|
2016-11-10 22:10:53 -08:00
|
|
|
fi
|
|
|
|
if [[ -z "${HOST-}" ]]; then
|
2017-10-29 05:22:55 -07:00
|
|
|
HOST="$BUILD"
|
2016-11-10 22:10:53 -08:00
|
|
|
fi
|
|
|
|
|
2018-07-06 04:33:24 -07:00
|
|
|
# Allow users to set arbitrary compile flags. Most users will not need this.
|
2017-03-09 18:39:18 -08:00
|
|
|
if [[ -z "${CONFIGURE_FLAGS-}" ]]; then
|
|
|
|
CONFIGURE_FLAGS=""
|
|
|
|
fi
|
|
|
|
|
2016-04-18 11:15:34 -07:00
|
|
|
if [ "x$*" = 'x--help' ]
|
|
|
|
then
|
|
|
|
cat <<EOF
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
$0 --help
|
|
|
|
Show this help message and exit.
|
|
|
|
|
2019-11-12 02:07:08 -08:00
|
|
|
$0 [ --enable-proton ] [ MAKEARGS... ]
|
2016-04-18 11:15:34 -07:00
|
|
|
Build Zcash and most of its transitive dependencies from
|
2016-11-06 12:35:55 -08:00
|
|
|
source. MAKEARGS are applied to both dependencies and Zcash itself.
|
|
|
|
|
2019-11-12 02:07:08 -08:00
|
|
|
Pass flags to ./configure using the CONFIGURE_FLAGS environment variable.
|
|
|
|
For example, to enable coverage instrumentation (thus enabling "make cov"
|
|
|
|
to work), call:
|
2016-11-06 11:40:34 -08:00
|
|
|
|
2019-11-12 02:07:08 -08:00
|
|
|
CONFIGURE_FLAGS="--enable-lcov --disable-hardening" ./zcutil/build.sh
|
2017-03-18 05:47:24 -07:00
|
|
|
|
2017-05-10 08:54:58 -07:00
|
|
|
If --enable-proton is passed, Zcash is configured to build the Apache Qpid Proton
|
|
|
|
library required for AMQP support. This library is not built by default.
|
2019-11-12 02:33:28 -08:00
|
|
|
|
|
|
|
For verbose output, use:
|
|
|
|
./zcutil/build.sh V=1
|
2016-04-18 11:15:34 -07:00
|
|
|
EOF
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
2015-11-24 11:23:36 -08:00
|
|
|
|
2017-05-10 08:54:58 -07:00
|
|
|
# If --enable-proton is the next argument, enable building Proton code:
|
2019-11-12 02:11:08 -08:00
|
|
|
PROTON_ARG=''
|
2017-05-10 08:54:58 -07:00
|
|
|
if [ "x${1:-}" = 'x--enable-proton' ]
|
2017-03-25 09:03:22 -07:00
|
|
|
then
|
2019-11-12 02:11:08 -08:00
|
|
|
PROTON_ARG='--enable-proton'
|
2017-03-25 09:03:22 -07:00
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2017-05-11 22:02:00 -07:00
|
|
|
eval "$MAKE" --version
|
|
|
|
as --version
|
2017-05-31 00:38:02 -07:00
|
|
|
ld -v
|
2017-05-11 22:02:00 -07:00
|
|
|
|
2019-11-12 02:33:28 -08:00
|
|
|
HOST="$HOST" BUILD="$BUILD" WITH_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/
|
2015-11-24 11:23:36 -08:00
|
|
|
./autogen.sh
|
2020-01-31 05:38:08 -08:00
|
|
|
CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure "$PROTON_ARG" $CONFIGURE_FLAGS
|
2019-11-12 02:33:28 -08:00
|
|
|
"$MAKE" "$@"
|