From 58e0fcf8e86601fed86ece175b0e8f25f02f23d6 Mon Sep 17 00:00:00 2001 From: myfreeweb Date: Sat, 31 May 2014 00:05:06 +0400 Subject: [PATCH] fix freebsd build --- scripts/build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 10eaabd44b..8e9b7b10ff 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -26,14 +26,21 @@ if [ "$(go env GOOS)" = "windows" ]; then GOPATHSINGLE=${GOPATH%%;*} fi +if [ "$(go env GOOS)" = "freebsd" ]; then + export CC="clang" + export CGO_LDFLAGS="$CGO_LDFLAGS -extld clang" # Workaround for https://code.google.com/p/go/issues/detail?id=6845 +fi + # Install dependencies echo "--> Installing dependencies to speed up builds..." -go get ./... +go get \ + -ldflags "${CGO_LDFLAGS}" \ + ./... # Build! echo "--> Building..." go build \ - -ldflags "-X main.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ + -ldflags "${CGO_LDFLAGS} -X main.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \ -v \ -o bin/consul${EXTENSION} cp bin/consul${EXTENSION} ${GOPATHSINGLE}/bin