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 <me@joejulian.name>
pull/11414/head
Joe Julian 2 years ago
parent 95140c96d6
commit 6f6c0d831d
No known key found for this signature in database
GPG Key ID: FAB12BE0575D999B

@ -18,12 +18,13 @@ ACCEPTANCE_DIR:=../acceptance-testing
ACCEPTANCE_RUN_TESTS=. ACCEPTANCE_RUN_TESTS=.
# go option # go option
PKG := ./... PKG := ./...
TAGS := TAGS :=
TESTS := . TESTS := .
TESTFLAGS := TESTFLAGS :=
LDFLAGS := -w -s LDFLAGS := -w -s
GOFLAGS := GOFLAGS :=
CGO_ENABLED ?= 0
# Rebuild the binary if any of these files change # Rebuild the binary if any of these files change
SRC := $(shell find . -type f -name '*.go' -print) go.mod go.sum SRC := $(shell find . -type f -name '*.go' -print) go.mod go.sum
@ -77,7 +78,7 @@ all: build
build: $(BINDIR)/$(BINNAME) build: $(BINDIR)/$(BINNAME)
$(BINDIR)/$(BINNAME): $(SRC) $(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 # install

Loading…
Cancel
Save