syncthing/build.sh

83 lines
2.0 KiB
Bash
Raw Normal View History

2013-12-22 00:16:49 +01:00
#!/bin/bash
version=$(git describe --always)
2014-01-06 06:11:19 +01:00
buildDir=dist
2013-12-22 00:16:49 +01:00
if [[ $1 == "-f" ]] ; then
fast=yes
shift
fi
if [[ $fast != yes ]] ; then
go get
2014-01-06 15:50:15 +01:00
go test ./...
fi
if [[ -z $1 ]] ; then
2014-01-05 23:54:57 +01:00
go build -ldflags "-X main.Version $version" \
&& nrsc syncthing gui
elif [[ $1 == "tar" ]] ; then
go build -ldflags "-X main.Version $version" \
&& nrsc syncthing gui \
&& mkdir syncthing-dist \
&& cp syncthing README.md LICENSE syncthing-dist \
&& tar zcvf syncthing-dist.tar.gz syncthing-dist \
&& rm -rf syncthing-dist
elif [[ $1 == "all" ]] ; then
2014-01-06 06:11:19 +01:00
rm -rf "$buildDir"
mkdir -p "$buildDir" || 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" \
2014-01-07 17:07:46 +01:00
&& cp syncthing "$buildDir/$name" \
2014-01-05 23:54:57 +01:00
&& cp README.md LICENSE "$name" \
&& mv syncthing "$name" \
2014-01-06 06:11:19 +01:00
&& tar zcf "$buildDir/$name.tar.gz" "$name" \
2014-01-05 23:54:57 +01:00
&& rm -r "$name"
done
2014-01-01 14:18:11 +01:00
done
2014-01-09 21:17:41 +01:00
for goos in linux ; do
for goarm in 5 6 7 ; do
for goarch in arm ; do
echo "$goos-${goarch}v$goarm"
export GOARM="$goarm"
export GOOS="$goos"
export GOARCH="$goarch"
export name="syncthing-$goos-${goarch}v$goarm"
go build -ldflags "-X main.Version $version" \
&& nrsc syncthing gui \
&& mkdir -p "$name" \
&& cp syncthing "$buildDir/$name" \
&& cp README.md LICENSE "$name" \
&& mv syncthing "$name" \
&& tar zcf "$buildDir/$name.tar.gz" "$name" \
&& rm -r "$name"
done
done
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" \
2014-01-07 12:14:50 +01:00
&& mv syncthing.exe "$buildDir/$name.exe" \
2014-01-05 23:54:57 +01:00
&& cp README.md LICENSE "$name" \
2014-01-06 06:11:19 +01:00
&& zip -qr "$buildDir/$name.zip" "$name" \
2014-01-05 23:54:57 +01:00
&& rm -r "$name"
done
2013-12-22 00:16:49 +01:00
done
2014-01-05 23:54:57 +01:00
fi