@@ -34,6 +34,13 @@ ARCH ?= amd64
34
34
BENCH_OUTPUT ?= stdout
35
35
EXTENSIONS ?= sync,search,scrub,metrics,lint,ui,mgmt,userprefs,apikey
36
36
UI_DEPENDENCIES := search,mgmt,userprefs,apikey
37
+ # freebsd/arm64 not supported for pie builds
38
+ BUILDMODE_FLAGS := -buildmode=pie
39
+ ifeq ($(OS ) ,freebsd)
40
+ ifeq ($(ARCH),arm64)
41
+ BUILDMODE_FLAGS=
42
+ endif
43
+ endif
37
44
comma: = ,
38
45
space := $(null ) #
39
46
hyphen:= -
@@ -77,30 +84,30 @@ build-metadata: $(if $(findstring ui,$(BUILD_LABELS)), ui)
77
84
.PHONY : binary-minimal
78
85
binary-minimal : BUILD_LABELS=minimal # tag doesn't exist, but we need it to overwrite default value and indicate that we have no extension in build-metadata
79
86
binary-minimal : modcheck build-metadata
80
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) -minimal -buildmode=pie -tags containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
87
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) -minimal $( BUILDMODE_FLAGS ) -tags containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
81
88
82
89
.PHONY : binary
83
90
binary : $(if $(findstring ui,$(BUILD_LABELS ) ) , ui)
84
91
binary : modcheck create-name build-metadata
85
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) -buildmode=pie -tags $(BUILD_LABELS ) ,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
92
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) $( BUILDMODE_FLAGS ) -tags $(BUILD_LABELS ) ,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
86
93
87
94
.PHONY : binary-debug
88
95
binary-debug : $(if $(findstring ui,$(BUILD_LABELS ) ) , ui)
89
96
binary-debug : modcheck swagger create-name build-metadata
90
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) -debug -buildmode=pie -tags $(BUILD_LABELS ) ,debug,containers_image_openpgp -v -gcflags all=' -N -l' -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} " ./cmd/zot
97
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-$(OS ) -$(ARCH ) -debug $( BUILDMODE_FLAGS ) -tags $(BUILD_LABELS ) ,debug,containers_image_openpgp -v -gcflags all=' -N -l' -ldflags " -X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} " ./cmd/zot
91
98
92
99
.PHONY : cli
93
100
cli : modcheck create-name build-metadata
94
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zli-$(OS ) -$(ARCH ) -buildmode=pie -tags $(BUILD_LABELS ) ,search,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zli
101
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zli-$(OS ) -$(ARCH ) $( BUILDMODE_FLAGS ) -tags $(BUILD_LABELS ) ,search,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zli
95
102
96
103
.PHONY : bench
97
104
bench : modcheck create-name build-metadata
98
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zb-$(OS ) -$(ARCH ) -buildmode=pie -tags $(BUILD_LABELS ) ,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
105
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zb-$(OS ) -$(ARCH ) $( BUILDMODE_FLAGS ) -tags $(BUILD_LABELS ) ,containers_image_openpgp -v -trimpath -ldflags " -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$( extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
99
106
100
107
.PHONY : exporter-minimal
101
108
exporter-minimal : BUILD_LABELS=minimal # tag doesn't exist, but we need it to overwrite default value and indicate that we have no extension in build-metadata
102
109
exporter-minimal : modcheck build-metadata
103
- env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zxp-$(OS ) -$(ARCH ) -buildmode=pie -tags containers_image_openpgp -v -trimpath ./cmd/zxp
110
+ env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zxp-$(OS ) -$(ARCH ) $( BUILDMODE_FLAGS ) -tags containers_image_openpgp -v -trimpath ./cmd/zxp
104
111
105
112
.PHONY : test
106
113
test : $(if $(findstring ui,$(BUILD_LABELS ) ) , ui)
0 commit comments