--- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ else GITEA_VERSION := $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') endif +EXTLDFLAGS := ${LDFLAGS} LDFLAGS := -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)) @@ -240,7 +241,7 @@ install: $(wildcard *.go) build: $(EXECUTABLE) $(EXECUTABLE): $(SOURCES) - $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ + $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-linkmode external -extldflags "$(EXTLDFLAGS)" -s -w $(LDFLAGS)' -o $@ .PHONY: release release: release-dirs release-windows release-linux release-darwin release-copy release-compress release-check