From 17ad9087482d70dbf74116c0c57dbf0d1db13485 Mon Sep 17 00:00:00 2001 From: Sebastien Blot Date: Mon, 5 Sep 2022 09:14:15 +0200 Subject: [PATCH] use proper flags to ensure an actual static binary when building a static release --- Makefile | 2 +- cmd/crowdsec-cli/Makefile | 2 +- cmd/crowdsec/Makefile | 2 +- plugins/notifications/dummy/Makefile | 2 +- plugins/notifications/email/Makefile | 2 +- plugins/notifications/http/Makefile | 2 +- plugins/notifications/slack/Makefile | 2 +- plugins/notifications/splunk/Makefile | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d295ee068..21452c9ce 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ LD_OPTS_VARS= \ -X 'github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)' export LD_OPTS=-ldflags "-s -w $(LD_OPTS_VARS)" -export LD_OPTS_STATIC=-ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'" +export LD_OPTS_STATIC=-ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'" -tags netgo,osusergo,sqlite_omit_load_extension GOCMD=go GOTEST=$(GOCMD) test diff --git a/cmd/crowdsec-cli/Makefile b/cmd/crowdsec-cli/Makefile index b8f2753d3..133bb8872 100644 --- a/cmd/crowdsec-cli/Makefile +++ b/cmd/crowdsec-cli/Makefile @@ -27,7 +27,7 @@ build-bincover: clean $(GOTEST) . -tags testrunmain -coverpkg=$(go list github.com/crowdsecurity/crowdsec/... | grep -v -e 'pkg/database' -e 'plugins/notifications' -e 'pkg/protobufs' -e 'pkg/cwversions' -e 'pkg/cstest' -e 'pkg/models') -covermode=atomic $(LD_OPTS) -c -o $(BINARY_NAME_COVER) static: clean - @$(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + @$(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a .PHONY: install install: install-conf install-bin diff --git a/cmd/crowdsec/Makefile b/cmd/crowdsec/Makefile index 4284db57c..0703303de 100644 --- a/cmd/crowdsec/Makefile +++ b/cmd/crowdsec/Makefile @@ -32,7 +32,7 @@ build-bincover: clean $(GOTEST) . -tags testrunmain -coverpkg=$(go list github.com/crowdsecurity/crowdsec/... | grep -v -e 'pkg/database' -e 'plugins/notifications' -e 'pkg/protobufs' -e 'pkg/cwversions' -e 'pkg/cstest' -e 'pkg/models') -covermode=atomic $(LD_OPTS) -c -o $(CROWDSEC_BIN_COVER) static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(CROWDSEC_BIN) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(CROWDSEC_BIN) -a test: $(GOTEST) $(LD_OPTS) -v ./... diff --git a/plugins/notifications/dummy/Makefile b/plugins/notifications/dummy/Makefile index 71035f3a9..1fe03d0d7 100644 --- a/plugins/notifications/dummy/Makefile +++ b/plugins/notifications/dummy/Makefile @@ -20,4 +20,4 @@ build: clean @$(GOBUILD) $(LD_OPTS) -o $(BINARY_NAME) static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a diff --git a/plugins/notifications/email/Makefile b/plugins/notifications/email/Makefile index 17cef999b..f3e2909c3 100644 --- a/plugins/notifications/email/Makefile +++ b/plugins/notifications/email/Makefile @@ -20,4 +20,4 @@ build: clean @$(GOBUILD) $(LD_OPTS) -o $(BINARY_NAME) static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a diff --git a/plugins/notifications/http/Makefile b/plugins/notifications/http/Makefile index ad3bea252..95263cb39 100644 --- a/plugins/notifications/http/Makefile +++ b/plugins/notifications/http/Makefile @@ -20,4 +20,4 @@ build: clean $(GOBUILD) $(LD_OPTS) -o $(BINARY_NAME) static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a diff --git a/plugins/notifications/slack/Makefile b/plugins/notifications/slack/Makefile index a101a235a..73c6c7287 100644 --- a/plugins/notifications/slack/Makefile +++ b/plugins/notifications/slack/Makefile @@ -20,4 +20,4 @@ clean: static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a diff --git a/plugins/notifications/splunk/Makefile b/plugins/notifications/splunk/Makefile index bd99de357..3938921ae 100644 --- a/plugins/notifications/splunk/Makefile +++ b/plugins/notifications/splunk/Makefile @@ -21,4 +21,4 @@ clean: @$(RM) $(BINARY_NAME) $(WIN_IGNORE_ERR) static: clean - $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a -tags netgo + $(GOBUILD) $(LD_OPTS_STATIC) -o $(BINARY_NAME) -a