-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdist.sh
More file actions
executable file
·29 lines (23 loc) · 792 Bytes
/
dist.sh
File metadata and controls
executable file
·29 lines (23 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# build binary distributions for linux/amd64 and darwin/amd64
export GOPATH=$(godep path):$GOPATH
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
mkdir -p $DIR/dist
os=$(go env GOOS)
arch=$(go env GOARCH)
version=$(cat $DIR/util/binary_version.go | grep "const BINARY_VERSION" | awk '{print $NF}' | sed 's/"//g')
goversion=$(go version | awk '{print $3}')
echo "... running tests"
./test.sh || exit 1
for os in linux darwin; do
echo "... building v$version for $os/$arch"
BUILD=$(mktemp -d -t nsq)
TARGET="nsq-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 make || exit 1
make DESTDIR=$BUILD/$TARGET PREFIX= install
pushd $BUILD
tar czvf $TARGET.tar.gz $TARGET
mv $TARGET.tar.gz $DIR/dist
popd
make clean
done