2013-12-21 23:16:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-02-01 19:23:02 +00:00
|
|
|
export COPYFILE_DISABLE=true
|
|
|
|
|
2013-12-21 23:16:49 +00:00
|
|
|
version=$(git describe --always)
|
2014-01-06 05:11:19 +00:00
|
|
|
buildDir=dist
|
2013-12-21 23:16:49 +00:00
|
|
|
|
2014-01-09 20:22:05 +00:00
|
|
|
if [[ $fast != yes ]] ; then
|
2014-01-09 22:00:23 +00:00
|
|
|
go get -d
|
2014-01-06 14:50:15 +00:00
|
|
|
go test ./...
|
2014-01-09 20:22:05 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $1 ]] ; then
|
2014-01-20 22:01:38 +00:00
|
|
|
go build -ldflags "-X main.Version $version"
|
|
|
|
elif [[ $1 == "embed" ]] ; then
|
2014-01-26 14:02:06 +00:00
|
|
|
embedder auto gui > auto/gui.files.go \
|
2014-01-23 12:13:15 +00:00
|
|
|
&& go build -ldflags "-X main.Version $version"
|
2014-01-07 10:52:42 +00:00
|
|
|
elif [[ $1 == "tar" ]] ; then
|
|
|
|
go build -ldflags "-X main.Version $version" \
|
|
|
|
&& mkdir syncthing-dist \
|
|
|
|
&& cp syncthing README.md LICENSE syncthing-dist \
|
|
|
|
&& tar zcvf syncthing-dist.tar.gz syncthing-dist \
|
|
|
|
&& rm -rf syncthing-dist
|
2014-01-09 20:22:05 +00:00
|
|
|
elif [[ $1 == "all" ]] ; then
|
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-02-01 09:10:07 +00:00
|
|
|
export GOARM=7
|
|
|
|
for os in darwin-amd64 linux-386 linux-amd64 linux-arm freebsd-386 freebsd-amd64 windows-386 windows-amd64 ; do
|
|
|
|
echo "$os"
|
|
|
|
export name="syncthing-$os"
|
|
|
|
export GOOS=${os%-*}
|
|
|
|
export GOARCH=${os#*-}
|
|
|
|
go build -ldflags "-X main.Version $version"
|
|
|
|
mkdir -p "$name"
|
|
|
|
cp README.md LICENSE "$name"
|
|
|
|
case $GOOS in
|
|
|
|
windows)
|
|
|
|
cp syncthing.exe "$buildDir/$name.exe"
|
|
|
|
mv syncthing.exe "$name"
|
|
|
|
zip -qr "$buildDir/$name.zip" "$name"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cp syncthing "$buildDir/$name"
|
|
|
|
mv syncthing "$name"
|
|
|
|
tar zcf "$buildDir/$name.tar.gz" "$name"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
rm -r "$name"
|
2013-12-21 23:16:49 +00:00
|
|
|
done
|
2014-01-05 22:54:57 +00:00
|
|
|
fi
|