Skip to content

Commit

Permalink
build: Use snapshot variable instead of specific upx variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Dec 15, 2021
1 parent 03e08cd commit 51aab63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ builds:
mod_timestamp: '{{ .CommitTimestamp }}'
hooks:
pre: |
make GOOS={{ .Os }} GOARCH={{ .Arch }} skopeo.build
make SKIP_UPX={{ .IsSnapshot }} GOOS={{ .Os }} GOARCH={{ .Arch }} UPX_TARGET=skopeo/static/skopeo-{{ .Os }}-{{ .Arch }} upx
make IS_SNAPSHOT={{ .IsSnapshot }} GOOS={{ .Os }} GOARCH={{ .Arch }} skopeo.build
make IS_SNAPSHOT={{ .IsSnapshot }} GOOS={{ .Os }} GOARCH={{ .Arch }} UPX_TARGET=skopeo/static/skopeo-{{ .Os }}-{{ .Arch }} upx
post: |
make SKIP_UPX={{ .IsSnapshot }} GOOS={{ .Os }} GOARCH={{ .Arch }} UPX_TARGET={{ .Path }} upx
make IS_SNAPSHOT={{ .IsSnapshot }} GOOS={{ .Os }} GOARCH={{ .Arch }} UPX_TARGET={{ .Path }} upx
universal_binaries:
- replace: true
id: mindthegap
Expand Down
5 changes: 5 additions & 0 deletions make/skopeo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ skopeo.build.all:
$(MAKE) --no-print-directory GOOS=windows GOARCH=amd64 skopeo.build
$(MAKE) --no-print-directory GOOS=windows GOARCH=arm64 skopeo.build


ifeq ($(IS_SNAPSHOT),false)
.PHONY: skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe)
endif
skopeo/static/skopeo-$(GOOS)-$(GOARCH)$(if $(filter $(GOOS),windows),.exe): ; $(info $(M) Building skopeo for $(GOOS)/$(GOARCH))
mkdir -p $(dir $@)
rm -f $(REPO_ROOT)/$@
cd skopeo-static && \
CGO_ENABLED=0 go build -o $(REPO_ROOT)/$@ -tags containers_image_openpgp github.com/containers/skopeo/cmd/skopeo
4 changes: 2 additions & 2 deletions make/upx.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.PHONY: upx
ifndef SKIP_UPX
ifeq ($(IS_SNAPSHOT),false)
ifneq ($(GOOS)/$(GOARCH),windows/arm64)
upx: install-tool.upx
endif
endif
upx: UPX_REAL_TARGET := $(addsuffix $(if $(filter $(GOOS),windows),.exe),$(basename $(UPX_TARGET)))
upx: ## Pack executable using upx
upx: ; $(info $(M) packing $(UPX_REAL_TARGET))
ifndef SKIP_UPX
ifeq ($(IS_SNAPSHOT),false)
ifneq ($(GOOS)/$(GOARCH),windows/arm64)
(upx -l $(UPX_REAL_TARGET) &>/dev/null && echo $(UPX_REAL_TARGET) is already packed) || upx -9 $(UPX_REAL_TARGET)
endif
Expand Down

0 comments on commit 51aab63

Please sign in to comment.