2013-12-21 23:16:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
version=$(git describe --always)
|
2014-01-06 05:11:19 +00:00
|
|
|
buildDir=dist
|
2013-12-21 23:16:49 +00:00
|
|
|
|
2014-01-05 22:54:57 +00:00
|
|
|
if [[ -z $1 ]] ; then
|
2014-01-06 14:50:15 +00:00
|
|
|
go test ./...
|
2014-01-05 22:54:57 +00:00
|
|
|
go build -ldflags "-X main.Version $version" \
|
|
|
|
&& nrsc syncthing gui
|
|
|
|
else
|
|
|
|
go test ./... || exit 1
|
2013-12-30 15:04:51 +00:00
|
|
|
|
2014-01-06 05:11:19 +00:00
|
|
|
rm -rf "$buildDir"
|
|
|
|
mkdir -p "$buildDir" || exit 1
|
2013-12-22 22:13:51 +00:00
|
|
|
|
2014-01-05 22:54:57 +00:00
|
|
|
for goos in darwin linux freebsd ; 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" \
|
|
|
|
&& nrsc syncthing gui \
|
|
|
|
&& mkdir -p "$name" \
|
2014-01-06 05:11:19 +00:00
|
|
|
&& cp syncthing "$buildDir/$name" \
|
2014-01-05 22:54:57 +00:00
|
|
|
&& cp README.md LICENSE "$name" \
|
|
|
|
&& mv syncthing "$name" \
|
2014-01-06 05:11:19 +00:00
|
|
|
&& tar zcf "$buildDir/$name.tar.gz" "$name" \
|
2014-01-05 22:54:57 +00:00
|
|
|
&& rm -r "$name"
|
|
|
|
done
|
2014-01-01 13:18:11 +00:00
|
|
|
done
|
|
|
|
|
2014-01-05 22:54:57 +00:00
|
|
|
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" \
|
|
|
|
&& nrsc syncthing.exe gui \
|
|
|
|
&& mkdir -p "$name" \
|
2014-01-06 05:11:19 +00:00
|
|
|
&& cp syncthing.exe "$buildDir/$name.exe" \
|
2014-01-05 22:54:57 +00:00
|
|
|
&& cp README.md LICENSE "$name" \
|
2014-01-06 05:11:19 +00:00
|
|
|
&& zip -qr "$buildDir/$name.zip" "$name" \
|
2014-01-05 22:54:57 +00:00
|
|
|
&& rm -r "$name"
|
|
|
|
done
|
2013-12-21 23:16:49 +00:00
|
|
|
done
|
2014-01-05 22:54:57 +00:00
|
|
|
fi
|