Commit 5b7865f0 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

scripts: build.sh appends .exe on Windows [GH-397]

parent a9bd78a0
...@@ -20,6 +20,12 @@ cd $DIR ...@@ -20,6 +20,12 @@ cd $DIR
GIT_COMMIT=$(git rev-parse HEAD) GIT_COMMIT=$(git rev-parse HEAD)
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
# If we're building on Windows, specify an extension
EXTENSION=""
if [ "$(go env GOOS)" = "windows" ]; then
EXTENSION=".exe"
fi
# If we're building a race-enabled build, then set that up. # If we're building a race-enabled build, then set that up.
if [ ! -z $PACKER_RACE ]; then if [ ! -z $PACKER_RACE ]; then
echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}" echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}"
...@@ -35,7 +41,7 @@ go build \ ...@@ -35,7 +41,7 @@ go build \
${PACKER_RACE} \ ${PACKER_RACE} \
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ -ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
-v \ -v \
-o bin/packer . -o bin/packer${EXTENSION} .
# Go over each plugin and build it # Go over each plugin and build it
for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
...@@ -45,5 +51,5 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do ...@@ -45,5 +51,5 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
${PACKER_RACE} \ ${PACKER_RACE} \
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ -ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
-v \ -v \
-o bin/packer-${PLUGIN_NAME} ${PLUGIN} -o bin/packer-${PLUGIN_NAME}${EXTENSION} ${PLUGIN}
done done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment