Skip to content

Commit

Permalink
fix: Do not upx pack darwin binaries
Browse files Browse the repository at this point in the history
upx sometimes produces corrupt binaries for darwin.
  • Loading branch information
jimmidyson committed Mar 18, 2022
1 parent 42d5d42 commit 503d726
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/checks-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ jobs:
- name: Run binary
run: |
./dist/mindthegap_darwin_amd64/mindthegap
- name: Check if universal binary is upx packed
run: |
upx -l ./dist/mindthegap_darwin_amd64/mindthegap
4 changes: 4 additions & 0 deletions make/upx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ upx: UPX_REAL_TARGET := $(addsuffix $(if $(filter $(GOOS),windows),.exe),$(basen
ifneq ($(IS_SNAPSHOT),true)
ifeq ($(GOOS)/$(GOARCH),windows/arm64)
upx: ; $(info $(M) skipping packing $(UPX_REAL_TARGET) - $(GOOS)/$(GOARCH) is not yet supported by upx)
else ifeq ($(GOOS),darwin)
upx: ; $(info $(M) skipping packing $(UPX_REAL_TARGET) - upx produces corrupt binaries for $(GOOS))
else
upx: install-tool.upx
upx: ## Pack executable using upx
upx: ; $(info $(M) packing $(UPX_REAL_TARGET))
(upx -l $(UPX_REAL_TARGET) &>/dev/null && echo $(UPX_REAL_TARGET) is already packed) || upx -9 $(UPX_REAL_TARGET)
# Double check file is successfully compressed - seen errors with macos binaries
upx -t $(UPX_REAL_TARGET) &>/dev/null || (echo $(UPX_REAL_TARGET) is broken after upx compression && exit 1)
endif
endif

0 comments on commit 503d726

Please sign in to comment.