Simplify Go cross-compile settings

We only want to force CGO_ENABLED when cross-compiling for arm;
it is on by default for native linux compilation and off by default
for darwin cross-compilation.
This commit is contained in:
Bryan Boreham
2020-12-30 12:00:46 +00:00
parent 27561dcccf
commit d8d86b0a64

View File

@@ -23,13 +23,9 @@ BUILD_IN_CONTAINER=true
GO_ENV=GOGC=off
GO_BUILD_TAGS='netgo unsafe'
GO_BUILD_FLAGS=-mod vendor -ldflags "-extldflags \"-static\" -X main.version=$(SCOPE_VERSION) -s -w" -tags $(GO_BUILD_TAGS)
GOOS=$(shell go tool dist env | grep GOOS | sed -e 's/GOOS="\(.*\)"/\1/')
ifeq ($(GOOS),linux)
GO_ENV+=CGO_ENABLED=1
endif
ifeq ($(GOARCH),arm)
GO_ENV+=CGO_ENABLED=1
ARM_CC=CC=/usr/bin/arm-linux-gnueabihf-gcc
endif