about summary refs log tree commit diff
path: root/build-release.sh
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-08-22T16·29+0200
committerVincent Ambo <tazjin@gmail.com>2017-08-22T16·41+0200
commita9c450c5a33a3e410377e1fde21c45e2db6bf51c (patch)
tree32f5406666444f9286689c3211bad9fb87eb6ced /build-release.sh
parent93425b951ce5afc1fed1a78232493002f8472dea (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
Diffstat (limited to 'build-release.sh')
-rwxr-xr-xbuild-release.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/build-release.sh b/build-release.sh
index 5e5b2cbec0..0109cace73 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
 }