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>
(cherry picked from commit 6f6c0d831d)
pull/11549/head
Joe Julian 2 years ago committed by Matt Farina
parent 23ff142d8b
commit 9140924199

@ -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

Loading…
Cancel
Save