From 1d0cf3d9094126b0a278674fe8b758e1df967869 Mon Sep 17 00:00:00 2001 From: Matthew Patton Date: Thu, 2 Feb 2017 02:05:09 -0500 Subject: [PATCH] handle missing GOPATH and cygwin considerations --- scripts/build.sh | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 84bd7f67d..4c02cedb3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -21,44 +21,33 @@ rm -f bin/* rm -rf pkg/* mkdir -p bin/ +OLDIFS=$IFS +IFS=: +case $(uname) in + MINGW*|MSYS*) + IFS=";" + ;; +esac + # Build! echo "==> Building..." set +e -gox \ +${GOX:-$GOPATH/bin/gox} \ -os="${XC_OS}" \ -arch="${XC_ARCH}" \ -osarch="!darwin/arm !darwin/arm64" \ -ldflags "${GOLDFLAGS}" \ -output "pkg/{{.OS}}_{{.Arch}}/packer" \ . -set -e -# Move all the compiled things to the $GOPATH/bin -GOPATH=${GOPATH:-$(go env GOPATH)} -case $(uname) in - CYGWIN*) - GOPATH="$(cygpath $GOPATH)" - ;; -esac -OLDIFS=$IFS -IFS=: -case $(uname) in - MINGW*) - IFS=";" - ;; - MSYS*) - IFS=";" - ;; -esac -MAIN_GOPATH=($GOPATH) IFS=$OLDIFS +set -e # Copy our OS/Arch to the bin/ directory echo "==> Copying binaries for this platform..." -DEV_PLATFORM="./pkg/$(go env GOOS)_$(go env GOARCH)" -for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do - cp ${F} bin/ - cp ${F} ${MAIN_GOPATH}/bin/ +for F in $(find pkg/$(go env GOOS)_$(go env GOARCH) -mindepth 1 -maxdepth 1 -type f); do + cp -v ${F} bin/ + cp -v ${F} ${GOPATH}/bin/ done # Done!