From 213414fcd6d4462dbe769979faebb2752794b006 Mon Sep 17 00:00:00 2001 From: OldFart Date: Tue, 11 Feb 2020 09:22:01 -0500 Subject: [PATCH] updates makefile changes bash statically linked version strips linux binary to reduce size # detects if upx is installed and if so, compress to further reduce binary sizes --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 8a89fe0..7a97f95 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ NAME=go-basher OWNER=progrium BASH_DIR=.bash +BASH_STATIC_VERSION=5.0 test: go test -v @@ -14,11 +15,18 @@ deps: bash: # Don't run if you don't have to. Adds several megs to repo with every commit. rm -rf $(BASH_DIR) && mkdir -p $(BASH_DIR)/linux $(BASH_DIR)/osx - curl -Ls https://github.com/robxu9/bash-static/releases/download/4.3.30/bash-linux \ - > $(BASH_DIR)/linux/bash - curl -Ls https://github.com/robxu9/bash-static/releases/download/4.3.30/bash-osx \ + + curl -#SLk https://github.com/robxu9/bash-static/releases/download/$(BASH_STATIC_VERSION)/bash-linux \ + > $(BASH_DIR)/linux/bash && strip $(BASH_DIR)/linux/bash + + curl -#SLk https://github.com/robxu9/bash-static/releases/download/$(BASH_STATIC_VERSION)/bash-osx \ > $(BASH_DIR)/osx/bash - chmod +x $(BASH_DIR)/**/* + + chmod +x $(BASH_DIR)/*/bash + + # if upx is present, compress bash binaries + if [ `command -v upx` ]; then upx --8mib-ram --best --brute --ultra-brute -9 $(BASH_DIR)/*/bash; fi + go-bindata -tags=linux -o=bash_linux.go -prefix=$(BASH_DIR)/linux -pkg=basher $(BASH_DIR)/linux go-bindata -tags=darwin -o=bash_darwin.go -prefix=$(BASH_DIR)/osx -pkg=basher $(BASH_DIR)/osx