Streamline build script

This commit is contained in:
Jakob Borg 2014-02-01 10:10:07 +01:00
parent 5980952495
commit e6078f9449

View File

@ -23,54 +23,27 @@ elif [[ $1 == "all" ]] ; then
rm -rf "$buildDir" rm -rf "$buildDir"
mkdir -p "$buildDir" || exit 1 mkdir -p "$buildDir" || exit 1
for goos in darwin linux freebsd ; do export GOARM=7
for goarch in amd64 386 ; do for os in darwin-amd64 linux-386 linux-amd64 linux-arm freebsd-386 freebsd-amd64 windows-386 windows-amd64 ; do
echo "$goos-$goarch" echo "$os"
export GOOS="$goos" export name="syncthing-$os"
export GOARCH="$goarch" export GOOS=${os%-*}
export name="syncthing-$goos-$goarch" export GOARCH=${os#*-}
go build -ldflags "-X main.Version $version" \ go build -ldflags "-X main.Version $version"
&& mkdir -p "$name" \ mkdir -p "$name"
&& cp syncthing "$buildDir/$name" \ cp README.md LICENSE "$name"
&& cp README.md LICENSE "$name" \ case $GOOS in
&& mv syncthing "$name" \ windows)
&& tar zcf "$buildDir/$name.tar.gz" "$name" \ cp syncthing.exe "$buildDir/$name.exe"
&& rm -r "$name" mv syncthing.exe "$name"
done zip -qr "$buildDir/$name.zip" "$name"
done ;;
*)
for goos in linux ; do cp syncthing "$buildDir/$name"
for goarm in 5 6 7 ; do mv syncthing "$name"
for goarch in arm ; do tar zcf "$buildDir/$name.tar.gz" "$name"
echo "$goos-${goarch}v$goarm" ;;
export GOARM="$goarm" esac
export GOOS="$goos" rm -r "$name"
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
done done
fi fi