mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
version=$(git describe --always)
|
|
buildDir=dist
|
|
|
|
if [[ -z $1 ]] ; then
|
|
go build -ldflags "-X main.Version $version" \
|
|
&& nrsc syncthing gui
|
|
else
|
|
go test ./... || exit 1
|
|
|
|
rm -rf "$buildDir"
|
|
mkdir -p "$buildDir" || exit 1
|
|
|
|
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 "$buildDir/$name" \
|
|
&& cp README.md LICENSE "$name" \
|
|
&& mv syncthing "$name" \
|
|
&& tar zcf "$buildDir/$name.tar.gz" "$name" \
|
|
&& rm -r "$name"
|
|
done
|
|
done
|
|
|
|
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 "$buildDir/$name.exe" \
|
|
&& cp README.md LICENSE "$name" \
|
|
&& zip -qr "$buildDir/$name.zip" "$name" \
|
|
&& rm -r "$name"
|
|
done
|
|
done
|
|
fi
|