syncthing/build.sh

23 lines
509 B
Bash
Raw Normal View History

2013-12-22 00:16:49 +01:00
#!/bin/bash
version=$(git describe --always)
2013-12-22 17:13:51 -05:00
go test ./... || exit 1
2013-12-30 09:02:18 -05:00
mkdir -p build || exit 1
2013-12-22 17:13:51 -05:00
2013-12-22 00:16:49 +01:00
for goos in darwin linux freebsd ; do
for goarch in amd64 386 ; do
2013-12-22 17:13:51 -05:00
echo "$goos-$goarch"
2013-12-22 00:16:49 +01:00
export GOOS="$goos"
export GOARCH="$goarch"
2013-12-30 09:02:18 -05:00
export name="syncthing-$goos-$goarch"
2013-12-22 00:16:49 +01:00
go build -ldflags "-X main.Version $version" \
2013-12-30 09:02:18 -05:00
&& mkdir -p "$name" \
&& mv syncthing "$name" \
&& cp syncthing.ini "$name" \
&& tar zcf "$name.tar.gz" "$name" \
&& rm -r "$name" \
&& mv "$name.tar.gz" build
2013-12-22 00:16:49 +01:00
done
done