From e15af5a5449837118acd8a2e0e814785e316fb2c Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 29 Jun 2024 12:41:05 +1200 Subject: [PATCH] makefile: add targets for release dist builds --- .gitignore | 6 +++++- Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 5ac979c..243c999 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ testdata/ -liblcl* +liblcl-*.zip +liblcl.so +liblcl.dll yvbolt yvbolt.exe +yvbolt.linux64.tar.xz +yvbolt.win64.zip \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..286e5e4 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +SHELL:=/bin/bash + +SOURCES=$(find . -name '*.go' -type f) + +liblcl-2.2.3.zip: + wget 'https://github.com/ying32/govcl/releases/download/v2.2.3/liblcl-2.2.3.zip' + +liblcl.so: liblcl-2.2.3.zip + echo "154b4e4a1d5137a2ffe51cb4d0bf152dd997c12616ae30862775c0e4f0928e88 liblcl-2.2.3.zip" | sha256sum -c + unzip -j liblcl-2.2.3.zip linux64-gtk2/liblcl.so -d . + touch liblcl.so + +liblcl.dll: liblcl-2.2.3.zip + echo "154b4e4a1d5137a2ffe51cb4d0bf152dd997c12616ae30862775c0e4f0928e88 liblcl-2.2.3.zip" | sha256sum -c + unzip -j liblcl-2.2.3.zip win64/liblcl.dll -d . + touch liblcl.dll + +yvbolt: $(SOURCES) + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -trimpath -ldflags '-s -w' + chmod 755 yvbolt + upx --best yvbolt + +yvbolt.exe: $(SOURCES) + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags '-s -w' + upx --best yvbolt.exe + +yvbolt.linux64.tar.xz: yvbolt liblcl.so + XZ_OPT='--best' tar caf yvbolt.linux64.tar.xz --owner=0 --group=0 yvbolt liblcl.so + +yvbolt.win64.zip: yvbolt.exe liblcl.dll + zip -0 yvbolt.win64.zip yvbolt.exe liblcl.dll + +.PHONY: dist +dist: yvbolt.linux64.tar.xz yvbolt.win64.zip + +.PHONY: clean +clean: + rm -f yvbolt.exe yvbolt yvbolt.linux64.tar.xz yvbolt.win64.zip + +.PHONY: clean-all +clean-all: clean + rm -f liblcl-2.2.3.zip liblcl.so liblcl.dll