From 4d6b8ab5f22b6d3ba0119b7ed5ac2a2509ca4068 Mon Sep 17 00:00:00 2001 From: Jared Jacobson Date: Mon, 13 Sep 2021 11:02:03 +1000 Subject: [PATCH] Revert build script changes --- build.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f1f06e676..8196fc653 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,22 @@ # Put installed packages into ./bin export GOBIN=$PWD/`dirname $0`/bin -export FLAGS="" + +if [ -d ".git" ] +then + export BUILD=`git rev-parse --short HEAD || ""` + export BRANCH=`(git symbolic-ref --short HEAD | tr -d \/ ) || ""` + if [ "$BRANCH" = master ] + then + export BRANCH="" + fi + + export FLAGS="-X github.com/matrix-org/dendrite/internal.branch=$BRANCH -X github.com/matrix-org/dendrite/internal.build=$BUILD" +else + export FLAGS="" +fi + +mkdir -p bin CGO_ENABLED=1 go build -trimpath -ldflags "$FLAGS" -v -o "bin/" ./cmd/...