gh-ost/build.sh

38 lines
771 B
Bash
Raw Permalink Normal View History

2016-03-23 11:39:24 +00:00
#!/bin/bash
#
#
2016-08-12 11:04:17 +00:00
2016-10-27 11:53:51 +00:00
RELEASE_VERSION=$(cat RELEASE_VERSION)
2016-03-23 11:39:24 +00:00
2016-08-12 11:04:17 +00:00
function build {
osname=$1
osshort=$2
GOOS=$3
GOARCH=$4
echo "Building ${osname} binary"
export GOOS
export GOARCH
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
if [ $? -ne 0 ]; then
echo "Build failed for ${osname}"
exit 1
fi
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
}
2016-05-16 09:09:17 +00:00
buildpath=/tmp/gh-ost
target=gh-ost
2016-03-23 11:39:24 +00:00
timestamp=$(date "+%Y%m%d%H%M%S")
2016-05-17 09:51:21 +00:00
ldflags="-X main.AppVersion=${RELEASE_VERSION}"
2016-08-12 11:04:17 +00:00
export GO15VENDOREXPERIMENT=1
2016-03-23 11:39:24 +00:00
2016-08-12 11:04:17 +00:00
mkdir -p ${buildpath}
build macOS osx darwin amd64
build GNU/Linux linux linux amd64
2016-03-23 11:39:24 +00:00
echo "Binaries found in:"
2016-05-16 09:09:17 +00:00
ls -1 $buildpath/gh-ost-binary*${timestamp}.tar.gz