buildscripts: compress release binaries.

Fix update command as well to show compressed files in updates.
master
Harshavardhana 9 years ago
parent a90faf5996
commit 41cba3a457
  1. 4
      Makefile
  2. 38
      buildscripts/build.sh
  3. 7
      update-main.go

@ -138,10 +138,10 @@ dockerimage: checkdocker verifiers $(UI_ASSETS)
@rm minio.dockerimage @rm minio.dockerimage
release: verifiers release: verifiers
@MINIO_RELEASE=RELEASE GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh @MINIO_RELEASE=RELEASE ./buildscripts/build.sh
experimental: verifiers experimental: verifiers
@MINIO_RELEASE=EXPERIMENTAL GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh @MINIO_RELEASE=EXPERIMENTAL ./buildscripts/build.sh
clean: clean:
@echo "Cleaning up all the generated files:" @echo "Cleaning up all the generated files:"

@ -24,6 +24,12 @@ _init() {
# List of supported architectures # List of supported architectures
SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64' SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64'
## System binaries
CP="/bin/cp"
SHASUM="/usr/bin/shasum"
GZIP="/usr/bin/gzip"
ZIP="/usr/bin/zip"
} }
go_build() { go_build() {
@ -33,7 +39,37 @@ go_build() {
package=$(go list -f '{{.ImportPath}}') package=$(go list -f '{{.ImportPath}}')
echo -n "-->" echo -n "-->"
printf "%15s:%s\n" "${osarch}" "${package}" printf "%15s:%s\n" "${osarch}" "${package}"
GO15VENDOREXPERIMENT=1 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_str/$os-$arch/$(basename $package).$release_tag
# Release binary name
release_bin="$release_str/$os-$arch/$(basename $package).$release_tag"
# Release binary downloadable name
release_real_bin="$release_str/$os-$arch/$(basename $package)"
# Release shasum name
release_shasum="$release_str/$os-$arch/$(basename $package).shasum"
# Release zip file.
release_real_zip="$release_str/$os-$arch/$(basename $package).zip"
release_real_gz="$release_str/$os-$arch/$(basename $package).gz"
# Go build to build the binary.
GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_bin
# Create copy
$CP -p $release_bin $release_real_bin
# Calculate shasum
$SHASUM $release_bin > $release_shasum
# Create a compressed file.
if [ $os == "windows" ]; then
$ZIP -r $release_real_zip $release_real_bin
elif [ $os == "darwin" ]; then
$ZIP -r $release_real_zip $release_real_bin
elif [ $os == "linux" ]; then
$GZIP -c $release_real_bin > $release_real_gz
else
echo "$os operating system is not supported."
exit 1
fi
} }
main() { main() {

@ -172,11 +172,12 @@ func getReleaseUpdate(updateURL string) {
} }
var downloadURL string var downloadURL string
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
downloadURL = newUpdateURLPrefix + "/minio.exe" downloadURL = newUpdateURLPrefix + "/minio.zip"
} else { } else {
downloadURL = newUpdateURLPrefix + "/minio" downloadURL = newUpdateURLPrefix + "/minio.gz"
} }
updateMsg := updateMessage{ updateMsg := updateMessage{
Download: downloadURL, Download: downloadURL,
Version: minioVersion, Version: minioVersion,

Loading…
Cancel
Save