From 3b83b53b6cb2be5d258ef09d62f5e8a3a8464327 Mon Sep 17 00:00:00 2001 From: Joel Cooklin Date: Tue, 14 Feb 2017 09:42:02 -0800 Subject: [PATCH] Enables cgo for freebsd builds --- scripts/build_snap.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/build_snap.sh b/scripts/build_snap.sh index 9e257abe6..2414ef287 100755 --- a/scripts/build_snap.sh +++ b/scripts/build_snap.sh @@ -35,13 +35,18 @@ go_build=(go build -ldflags "-w -X main.gitversion=${git_version}") _info "snap build version: ${git_version}" _info "git commit: $(git log --pretty=format:"%H" -1)" -# Disable CGO for builds. -export CGO_ENABLED=0 - # rebuild binaries: export GOOS=${GOOS:-$(go env GOOS)} export GOARCH=${GOARCH:-$(go env GOARCH)} +# Disable CGO for builds (except freebsd) +if [[ "${GOOS}" == "freebsd" ]]; then + _info "CGO enabled for freebsd" + export CGO_ENABLED=1 +else + export CGO_ENABLED=0 +fi + if [[ "${GOARCH}" == "amd64" ]]; then build_path="${__proj_dir}/build/${GOOS}/x86_64" else