diff --git a/build.sh b/build.sh index f41b6059c..95eb41851 100755 --- a/build.sh +++ b/build.sh @@ -23,54 +23,27 @@ elif [[ $1 == "all" ]] ; then 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" \ - && 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 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" \ - && 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 - - 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" \ - && mkdir -p "$name" \ - && cp syncthing.exe "$buildDir/$name.exe" \ - && cp README.md LICENSE "$name" \ - && mv syncthing.exe "$name" \ - && zip -qr "$buildDir/$name.zip" "$name" \ - && rm -r "$name" - done + 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" done fi