use proper flags to ensure an actual static binary when building a static release

This commit is contained in:
Sebastien Blot 2022-09-05 09:14:15 +02:00
parent c4652d60a7
commit 17ad908748
No known key found for this signature in database
GPG key ID: DFC2902F40449F6A
8 changed files with 8 additions and 8 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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