diff --git a/gen/build.sh b/gen/build.sh index 223a1193..26897307 100755 --- a/gen/build.sh +++ b/gen/build.sh @@ -4,6 +4,8 @@ # This script is used to build a binary for the current platform. Cgo is # disabled to make sure the binary is statically linked. Appropriate flags are # given to the go compiler to strip the binary. Current git tag is passed to -# the compiler to be used as the version in the binary. +# the compiler by default to be used as the version in the binary. -CGO_ENABLED=0 go build -ldflags="-s -w -X main.gVersion=$(git describe --tags)" "$@" +[ -z $version ] && version=$(git describe --tags) + +CGO_ENABLED=0 go build -ldflags="-s -w -X main.gVersion=$version" "$@" diff --git a/gen/xbuild.sh b/gen/xbuild.sh index 296dbd61..002f5ec7 100755 --- a/gen/xbuild.sh +++ b/gen/xbuild.sh @@ -4,13 +4,13 @@ # This script is used to build binaries for all supported platforms. Cgo is # disabled to make sure binaries are statically linked. Appropriate flags are # given to the go compiler to strip binaries. Current git tag is passed to the -# compiler to be used as the version in binaries. These are then compressed in -# an archive form (`.zip` for windows and `.tar.gz` for the rest) within a -# folder named `dist`. +# compiler by default to be used as the version in binaries. These are then +# compressed in an archive form (`.zip` for windows and `.tar.gz` for the rest) +# within a folder named `dist`. set -o verbose -version=$(git describe --tags) +[ -z $version ] && version=$(git describe --tags) mkdir -p dist