From ff5a5a405cbcb53362260e03a62c70d8e2142226 Mon Sep 17 00:00:00 2001 From: Joe Julian Date: Wed, 5 Oct 2022 16:03:44 -0700 Subject: [PATCH] Allow CGO_ENABLED to be overridden for build On Mac OS they have some custom dns c library that uses some configuration files other than resolv.conf to configure dns lookups. The standard go library does not handle these custom configuration files which causes dns lookups to fail for some mac users. This allows the downstream pacakgers to override CGO_ENABLED to build binaries that use the custom dns library. Signed-off-by: Joe Julian Signed-off-by: Kyle L Frisbie --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d42234a29..d61ac1507 100644 --- a/Makefile +++ b/Makefile @@ -18,12 +18,13 @@ ACCEPTANCE_DIR:=../acceptance-testing ACCEPTANCE_RUN_TESTS=. # go option -PKG := ./... -TAGS := -TESTS := . -TESTFLAGS := -LDFLAGS := -w -s -GOFLAGS := +PKG := ./... +TAGS := +TESTS := . +TESTFLAGS := +LDFLAGS := -w -s +GOFLAGS := +CGO_ENABLED ?= 0 # Rebuild the binary if any of these files change SRC := $(shell find . -type f -name '*.go' -print) go.mod go.sum @@ -77,7 +78,7 @@ all: build build: $(BINDIR)/$(BINNAME) $(BINDIR)/$(BINNAME): $(SRC) - GO111MODULE=on CGO_ENABLED=0 go build $(GOFLAGS) -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)'/$(BINNAME) ./cmd/helm + GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) go build $(GOFLAGS) -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)'/$(BINNAME) ./cmd/helm # ------------------------------------------------------------------------------ # install