handle missing GOPATH and cygwin considerations

pull/4494/head
Matthew Patton 9 years ago committed by Matthew Patton
parent 049e1bbf73
commit 1d0cf3d909

@ -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!

Loading…
Cancel
Save