diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-08-22T16·29+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-08-22T16·41+0200 |
commit | a9c450c5a33a3e410377e1fde21c45e2db6bf51c (patch) | |
tree | 32f5406666444f9286689c3211bad9fb87eb6ced | |
parent | 93425b951ce5afc1fed1a78232493002f8472dea (diff) |
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
-rwxr-xr-x | build-release.sh | 13 |
1 files changed, 12 insertions, 1 deletions
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 } |