2020-11-28 23:34:20 +05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Metricator build script.
|
|
|
|
|
2021-02-19 19:27:17 +05:00
|
|
|
GO=${GO:=$(which go)}
|
|
|
|
|
2020-11-28 23:34:20 +05:00
|
|
|
source ./scripts/shell_helpers/get_git_data.sh
|
2020-11-28 23:46:24 +05:00
|
|
|
|
|
|
|
WHATTOBUILD=$1
|
|
|
|
|
|
|
|
LINKERFLAGS="\
|
|
|
|
-X go.dev.pztrn.name/metricator/internal/common.Branch=${BRANCHNAME} \
|
|
|
|
-X go.dev.pztrn.name/metricator/internal/common.Build=${BUILDID} \
|
|
|
|
-X go.dev.pztrn.name/metricator/internal/common.CommitHash=${COMMITHASH} \
|
|
|
|
-X go.dev.pztrn.name/metricator/internal/common.Version=${VERSION}"
|
|
|
|
|
|
|
|
|
2021-02-19 19:27:17 +05:00
|
|
|
echo "Using $(go version) at ${GO}"
|
|
|
|
|
2020-11-28 23:46:24 +05:00
|
|
|
cd cmd/${WHATTOBUILD}
|
|
|
|
go build -tags netgo -ldflags "${LINKERFLAGS} -w -extldflags '-static'" -o ../../._bin/${WHATTOBUILD}
|