From 403b0b7dba517fcfe7c05700cc2a6c6be9c003fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Sat, 16 Apr 2022 10:03:39 +0000 Subject: [PATCH] [#868] FreeBSD support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable cgo when building on FreeBSD. Signed-off-by: 谢致邦 (XIE Zhibang) --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 15779ee382..9de7172f6a 100644 --- a/Makefile +++ b/Makefile @@ -19,9 +19,12 @@ # ----------------------------------------------------------------------------- GO ?= go +CGO_ENABLED ?= 0 GOOS ?= $(shell go env GOOS) ifeq ($(GOOS),windows) BIN_EXT := .exe +else ifeq ($(GOOS),freebsd) + CGO_ENABLED := 1 endif PACKAGE := github.com/containerd/nerdctl @@ -31,7 +34,7 @@ VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags) VERSION_TRIMMED := $(VERSION:v%=%) REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) -export GO_BUILD=GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) $(GO) build -ldflags "-s -w -X $(PACKAGE)/pkg/version.Version=$(VERSION) -X $(PACKAGE)/pkg/version.Revision=$(REVISION)" +export GO_BUILD=GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) $(GO) build -ldflags "-s -w -X $(PACKAGE)/pkg/version.Version=$(VERSION) -X $(PACKAGE)/pkg/version.Revision=$(REVISION)" ifdef VERBOSE VERBOSE_FLAG := -v