-
Notifications
You must be signed in to change notification settings - Fork 42
/
build.sh
executable file
·33 lines (25 loc) · 1.12 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
#!/bin/bash
set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
cd ".."
DIR="$PWD"
echo "== Installing dependencies =="
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/kevinburke/go-bindata/v4/...@latest
go mod download
echo "== Checking dependencies =="
go mod verify
set -e
echo "== Compiling =="
export IMPORTPATH="github.com/lbryio/chainquery"
mkdir -p "$DIR/bin"
go generate -v
export VERSIONSHORT="${TRAVIS_COMMIT:-"$(git describe --tags --always --dirty)"}"
export VERSIONLONG="${TRAVIS_COMMIT:-"$(git describe --tags --always --dirty --long)"}"
export COMMITMSG="$(echo ${TRAVIS_COMMIT_MESSAGE:-"$(git show -s --format=%s)"} | tr -d '"' | head -n 1)"
CGO_ENABLED=0 go build -v -o "./bin/chainquery" -asmflags -trimpath="$DIR" -ldflags "-X ${IMPORTPATH}/meta.version=${VERSIONSHORT} -X ${IMPORTPATH}/meta.versionLong=${VERSIONLONG} -X \"${IMPORTPATH}/meta.commitMsg=${COMMITMSG}\""
echo "== Done building linux version $("$DIR/bin/chainquery" version) =="
echo "$(git describe --tags --always --dirty)" > ./bin/chainquery.txt
chmod +x ./bin/chainquery
exit 0