Skip to content

Commit

Permalink
Merge pull request #4445 from hashicorp/bugfix/build-cross-compile
Browse files Browse the repository at this point in the history
Fix cross compiling with make
  • Loading branch information
mkeeler authored Jul 26, 2018
2 parents fa0d8af + 21ff0d5 commit c45e19b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build-support/functions/20-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function build_consul_post {
rm -r pkg.bin.new

DEV_PLATFORM="./pkg/bin/${extra_dir}$(go env GOOS)_$(go env GOARCH)"
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f )
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f 2>/dev/null)
do
# recreate the bin dir
rm -r bin/* 2> /dev/null
Expand Down Expand Up @@ -436,8 +436,14 @@ function build_consul_local {

echo "---> ${osarch}"


mkdir -p "${outdir}"
CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go install -ldflags "${GOLDFLAGS}" -tags "${GOTAGS}" && cp "${MAIN_GOPATH}/bin/consul" "${outdir}/consul"
GOBIN_EXTRA=""
if test "${os}" != "$(go env GOOS)" -o "${arch}" != "$(go env GOARCH)"
then
GOBIN_EXTRA="${os}_${arch}/"
fi
CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go install -ldflags "${GOLDFLAGS}" -tags "${GOTAGS}" && cp "${MAIN_GOPATH}/bin/${GOBIN_EXTRA}consul" "${outdir}/consul"
if test $? -ne 0
then
err "ERROR: Failed to build Consul for ${osarch}"
Expand Down

0 comments on commit c45e19b

Please sign in to comment.