|
@@ -32,38 +32,34 @@ BUILD_CMD = "build"
|
|
|
GOOS ?= $(shell go env GOOS)
|
|
|
GOARCH ?= $(shell go env GOARCH)
|
|
|
|
|
|
-#Golang version info
|
|
|
+# Golang version info
|
|
|
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
|
|
|
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
|
|
|
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
|
|
|
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 17
|
|
|
GO_VERSION_VALIDATION_ERR_MSG = Golang version ($(BUILD_GOVERSION)) is not supported, please use least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)
|
|
|
-#Current versioning information from env
|
|
|
-BUILD_VERSION?="$(shell git describe --tags `git rev-list --tags --max-count=1`)"
|
|
|
-BUILD_GOVERSION="$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')"
|
|
|
-BUILD_CODENAME=$(shell cat RELEASE.json | jq -r .CodeName)
|
|
|
-BUILD_TIMESTAMP=$(shell date +%F"_"%T)
|
|
|
-BUILD_TAG?="$(shell git rev-parse HEAD)"
|
|
|
+
|
|
|
+# Current versioning information from env
|
|
|
+BUILD_VERSION ?= "$(shell git describe --tags `git rev-list --tags --max-count=1`)"
|
|
|
+BUILD_GOVERSION = "$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')"
|
|
|
+BUILD_CODENAME = $(shell cat RELEASE.json | jq -r .CodeName)
|
|
|
+BUILD_TIMESTAMP = $(shell date +%F"_"%T)
|
|
|
+BUILD_TAG ?= "$(shell git rev-parse HEAD)"
|
|
|
DEFAULT_CONFIGDIR ?= "/etc/crowdsec"
|
|
|
DEFAULT_DATADIR ?= "/var/lib/crowdsec/data"
|
|
|
|
|
|
-export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
|
|
|
+LD_OPTS_VARS= \
|
|
|
+-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.System=$(SYSTEM) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION) \
|
|
|
-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)"
|
|
|
+-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)
|
|
|
|
|
|
-export LD_OPTS_STATIC=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \
|
|
|
--X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR) \
|
|
|
--extldflags '-static'"
|
|
|
+export LD_OPTS=-ldflags "-s -w $(LD_OPTS_VARS)"
|
|
|
+export LD_OPTS_STATIC=-ldflags "-s -w $(LD_OPTS_VARS) -extldflags '-static'"
|
|
|
|
|
|
RELDIR = crowdsec-$(BUILD_VERSION)
|
|
|
|