syncthing/build.sh

40 lines
926 B
Bash
Raw Normal View History

2013-12-21 23:16:49 +00:00
#!/bin/bash
version=$(git describe --always)
2013-12-22 22:13:51 +00:00
go test ./... || exit 1
2013-12-30 15:04:51 +00:00
rm -rf build
2013-12-30 14:02:18 +00:00
mkdir -p build || exit 1
2013-12-22 22:13:51 +00:00
2013-12-21 23:16:49 +00:00
for goos in darwin linux freebsd ; do
for goarch in amd64 386 ; do
2013-12-22 22:13:51 +00:00
echo "$goos-$goarch"
2013-12-21 23:16:49 +00:00
export GOOS="$goos"
export GOARCH="$goarch"
2013-12-30 14:02:18 +00:00
export name="syncthing-$goos-$goarch"
2013-12-21 23:16:49 +00:00
go build -ldflags "-X main.Version $version" \
2013-12-30 14:02:18 +00:00
&& mkdir -p "$name" \
2013-12-30 15:04:51 +00:00
&& cp syncthing "build/$name" \
2013-12-30 15:11:10 +00:00
&& cp README.md LICENSE "$name" \
2013-12-30 14:02:18 +00:00
&& mv syncthing "$name" \
2014-01-01 13:18:11 +00:00
&& tar zcf "build/$name.tar.gz" "$name" \
&& rm -r "$name"
done
done
for goos in windows ; do
for goarch in amd64 386 ; do
echo "$goos-$goarch"
export GOOS="$goos"
export GOARCH="$goarch"
export name="syncthing-$goos-$goarch"
go build -ldflags "-X main.Version $version" \
&& mkdir -p "$name" \
&& cp syncthing.exe "build/$name.exe" \
&& cp README.md LICENSE "$name" \
&& zip -qr "build/$name.zip" "$name" \
&& rm -r "$name"
2013-12-21 23:16:49 +00:00
done
done