From a9c450c5a33a3e410377e1fde21c45e2db6bf51c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 22 Aug 2017 18:29:20 +0200 Subject: fix build: Build Windows executable with correct name Windows executable filenames must end in ".exe" because the operating system can't execute them otherwise. This fixes #73 --- build-release.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'build-release.sh') diff --git a/build-release.sh b/build-release.sh index 5e5b2cbec0be..0109cace73f2 100755 --- a/build-release.sh +++ b/build-release.sh @@ -5,10 +5,21 @@ readonly GIT_HASH="$(git rev-parse --short HEAD)" readonly LDFLAGS="-X main.gitHash=${GIT_HASH} -w -s" readonly VERSION="1.1.0-${GIT_HASH}" +function binary-name() { + local os="${1}" + local target="${2}" + if [ "${os}" = "windows" ]; then + echo -n "${target}/kontemplate.exe" + else + echo -n "${target}/kontemplate" + fi +} + function build-for() { local os="${1}" local arch="${2}" local target="release/${os}/${arch}" + local bin=$(binary-name "${os}" "${target}") echo "Building kontemplate for ${os}-${arch} in ${target}" @@ -16,7 +27,7 @@ function build-for() { env GOOS="${os}" GOARCH="${arch}" go build \ -ldflags "${LDFLAGS}" \ - -o "${target}/kontemplate" \ + -o "${bin}" \ -tags netgo } -- cgit 1.4.1