go-watchdog/build.sh

46 lines
1.1 KiB
Bash

#!/usr/bin/env bash
export CGO_ENABLED=0
#GOOS=windows GOARCH=amd64 go install
go tool dist list
gocmd=watchdog.go
golib=""
echo ""
echo ""
echo "Windows amd64"
GOOS=windows GOARCH=amd64 go build -o dist/windows-amd64/watchdog.exe $gocmd $golib
echo "Windows 386"
GOOS=windows GOARCH=386 go build -o dist/windows-386/watchdog.exe $gocmd $golib
echo ""
echo "Darwin (macOS) amd64"
GOOS=darwin GOARCH=amd64 go build -o dist/darwin-amd64/watchdog $gocmd $golib
echo ""
echo "Linux amd64"
GOOS=linux GOARCH=amd64 go build -o dist/linux-amd64/watchdog $gocmd $golib
echo "Linux 386"
echo ""
GOOS=linux GOARCH=386 go build -o dist/linux-386/watchdog $gocmd $golib
echo "RPi 3 B+ ARMv7"
GOOS=linux GOARCH=arm GOARM=7 go build -o dist/linux-armv7/watchdog $gocmd $golib
echo "RPi Zero ARMv5"
GOOS=linux GOARCH=arm GOARM=5 go build -o dist/linux-armv5/watchdog $gocmd $golib
my_ver=$(git describe --tags)
pushd dist
ls -d *-* | while read my_dist
do
if [ -d "$my_dist" ]; then
#tar -czvf watchdog-$my_ver-$my_dist.tar.gz $my_dist
zip -r watchdog-$my_ver-$my_dist.zip $my_dist
fi
done
popd
echo ""
echo ""