Files
opencloud/.make/release.mk
T
Ralf Haferkamp 26f3e23b79 dev: Enable VIPS in local docker builds
As libvips is not available as a static library we can no longer
create a statically linked ocis binary for the docker images when
libvips is enabled.
We also need to make sure that the base images used for building
ocis needs to match the image where ocis is installed when creating
a shared binary.
2024-10-17 14:05:27 +02:00

132 lines
3.4 KiB
Makefile

.PHONY: changelog
changelog: $(CALENS) ## generate changelog
$(CALENS) -i ../changelog -t ../changelog/CHANGELOG.tmpl >| ../CHANGELOG.md
.PHONY: release
release: release-dirs release-linux release-darwin release-copy release-check
.PHONY: release-dirs
release-dirs:
@mkdir -p $(DIST)/binaries $(DIST)/release
# docker specific packaging flags
DOCKER_LDFLAGS += -X "$(OCIS_REPO)/ocis-pkg/config/defaults.BaseDataPathType=path" -X "$(OCIS_REPO)/ocis-pkg/config/defaults.BaseDataPathValue=/var/lib/ocis"
DOCKER_LDFLAGS += -X "$(OCIS_REPO)/ocis-pkg/config/defaults.BaseConfigPathType=path" -X "$(OCIS_REPO)/ocis-pkg/config/defaults.BaseConfigPathValue=/etc/ocis"
# We can't link statically when vips is enabled but we still
# prefer static linking where possible
ifndef ENABLE_VIPS
DOCKER_LDFLAGS += -extldflags "-static"
endif
release-linux-docker-amd64: release-dirs
GOOS=linux \
GOARCH=amd64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '$(LDFLAGS) $(DOCKER_LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-linux-amd64' \
./cmd/$(NAME)
release-linux-docker-arm: release-dirs
GOOS=linux \
GOARCH=arm \
go build \
-tags 'netgo,$(TAGS)' \
-trimpath \
-ldflags '$(LDFLAGS) $(DOCKER_LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-linux-arm' \
./cmd/$(NAME)
@# https://github.com/golang/go/issues/50405
@# -buildmode=pie not easily doable for arm
release-linux-docker-arm64: release-dirs
GOOS=linux \
GOARCH=arm64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '$(LDFLAGS) $(DOCKER_LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-linux-arm64' \
./cmd/$(NAME)
.PHONY: release-linux
release-linux: release-dirs
GOOS=linux \
GOARCH=amd64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '-extldflags "-static" $(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-linux-amd64' \
./cmd/$(NAME)
GOOS=linux \
GOARCH=386 \
go build \
-tags 'netgo,$(TAGS)' \
-trimpath \
-ldflags '-extldflags "-static" $(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-linux-386' \
./cmd/$(NAME)
GOOS=linux \
GOARCH=arm64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '-extldflags "-static" $(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-linux-arm64' \
./cmd/$(NAME)
GOOS=linux \
GOARCH=arm \
go build \
-tags 'netgo,$(TAGS)' \
-trimpath \
-ldflags '-extldflags "-static" $(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-linux-arm' \
./cmd/$(NAME)
@# https://github.com/golang/go/issues/50405
@# -buildmode=pie not easily doable for arm
.PHONY: release-darwin
release-darwin: release-dirs
GOOS=darwin \
GOARCH=amd64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '$(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-darwin-amd64' \
./cmd/$(NAME)
GOOS=darwin \
GOARCH=arm64 \
go build \
-tags 'netgo,$(TAGS)' \
-buildmode=pie \
-trimpath \
-ldflags '$(LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-$(OUTPUT)-darwin-arm64' \
./cmd/$(NAME)
.PHONY: release-copy
release-copy:
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
.PHONY: release-check
release-check:
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
.PHONY: release-finish
release-finish: release-copy release-check