Preparing for 2.0, improved dist command.

Packing binaries and files in a more sane manner, which should make
distributing releases easier moving forward. Will likely replace the
NAS_VERSION variable with something more dynamic moving forward.
This commit is contained in:
Gabriel Simmer 2020-04-06 23:56:57 +01:00
parent cdf8c9a598
commit 10779b8000
No known key found for this signature in database
GPG key ID: 33BA4D83B160A0A9

View file

@ -1,18 +1,22 @@
.DEFAULT_GOAL := build .DEFAULT_GOAL := build
NAS_VERSION := 2.0.0
build: make_build_dir:
go build mkdir -p build/{bin,assets,tars}
pi: build: make_build_dir
env GOOS=linux GOARCH=arm GOARM=5 go build -o nas-arm go build -o build/bin/nas
small: pi: make_build_dir
go build -ldflags="-s -w" env GOOS=linux GOARCH=arm GOARM=5 go build -o build/bin/nas-arm
upx --brute nas -9 --no-progress
small_pi: small: make_build_dir
env GOOS=linux GOARCH=arm GOARM=5 go build -o nas-arm -ldflags="-s -w" go build -o build/bin/nas -ldflags="-s -w"
upx --brute nas-arm -9 --no-progress upx --brute build/bin/nas -9 --no-progress
small_pi: make_build_dir
env GOOS=linux GOARCH=arm GOARM=5 go build -o build/bin/nas-arm -ldflags="-s -w"
upx --brute build/bin/nas-arm -9 --no-progress
run: run:
go run webserver.go go run webserver.go
@ -20,9 +24,10 @@ run:
test: test:
go test ./... -cover go test ./... -cover
dist: clean small small_pi dist: clean make_build_dir small small_pi
mkdir build cp -r assets/* build/assets
mv nas* build tar -czf build/tars/nas-$(NAS_VERSION)-arm.tar.gz build/assets build/bin/nas-arm README.md LICENSE
tar -czf build/tars/nas-$(NAS_VERSION)-x86.tar.gz build/assets build/bin/nas README.md LICENSE
clean: clean:
rm -rf build rm -rf build