forked from zcash/zcash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·81 lines (63 loc) · 1.73 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
export LC_ALL=C
set -eu -o pipefail
set +x
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
cd "$(dirname "$("$READLINK" -f "$0")")/.."
# 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
BUILD="$(./depends/config.guess)"
fi
if [[ -z "${HOST-}" ]]; then
HOST="$BUILD"
fi
# Allow users to set arbitrary compile flags. Most users will not need this.
if [[ -z "${CONFIGURE_FLAGS-}" ]]; then
CONFIGURE_FLAGS=""
fi
if [ "x$*" = 'x--help' ]
then
cat <<EOF
Usage:
$0 --help
Show this help message and exit.
$0 [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself.
Pass flags to ./configure using the CONFIGURE_FLAGS environment variable.
For example, to enable coverage instrumentation (thus enabling "make cov"
to work), call:
CONFIGURE_FLAGS="--enable-lcov --disable-hardening" ./zcutil/build.sh
For verbose output, use:
./zcutil/build.sh V=1
EOF
exit 0
fi
set -x
eval "$MAKE" --version
as --version
HOST="$HOST" BUILD="$BUILD" "$MAKE" "$@" -C ./depends/
if [ "${BUILD_STAGE:-all}" = "depends" ]
then
exit 0
fi
./autogen.sh
CONFIG_SITE="$PWD/depends/$HOST/share/config.site" ./configure $CONFIGURE_FLAGS
"$MAKE" "$@"