From 503d72631ef1220244c578c518bdb3110026eaa6 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Fri, 18 Mar 2022 13:02:09 +0000 Subject: [PATCH] fix: Do not upx pack darwin binaries upx sometimes produces corrupt binaries for darwin. --- .github/workflows/checks-macos.yml | 4 ---- make/upx.mk | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks-macos.yml b/.github/workflows/checks-macos.yml index 1bf9c37c..86746bce 100644 --- a/.github/workflows/checks-macos.yml +++ b/.github/workflows/checks-macos.yml @@ -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 diff --git a/make/upx.mk b/make/upx.mk index 9617c63a..4a925b7b 100644 --- a/make/upx.mk +++ b/make/upx.mk @@ -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