forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·37 lines (29 loc) · 808 Bytes
/
build.sh
File metadata and controls
executable file
·37 lines (29 loc) · 808 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
print_usage() {
printf "Usage: build [OPTIONS]
Build avalanchego
Options:
-r Build with race detector
"
}
race=''
while getopts 'r' flag; do
case "${flag}" in
r)
echo "Building with race detection enabled"
race='-race'
;;
*) print_usage
exit 1 ;;
esac
done
REPO_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
# Configure the build environment
source "${REPO_ROOT}"/scripts/constants.sh
# Determine the git commit hash to use for the build
source "${REPO_ROOT}"/scripts/git_commit.sh
echo "Building AvalancheGo with [$(go version)]..."
go build ${race} -o "${avalanchego_path}" \
-ldflags "-X github.com/ava-labs/avalanchego/version.GitCommit=$git_commit $static_ld_flags" \
"${REPO_ROOT}"/main