syncthing/build.sh

47 lines
1.1 KiB
Bash
Raw Normal View History

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