2015-07-20 03:11:06 -07:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
set nullglob
|
|
|
|
|
|
|
|
echo Get dependencies
|
|
|
|
go get -d
|
|
|
|
|
|
|
|
rm -rf relaysrv-*-*
|
|
|
|
|
|
|
|
build() {
|
|
|
|
export GOOS="$1"
|
|
|
|
export GOARCH="$2"
|
|
|
|
target="relaysrv-$GOOS-$GOARCH"
|
2015-08-20 03:33:11 -07:00
|
|
|
go build -i -v -ldflags -w
|
2015-07-20 03:11:06 -07:00
|
|
|
mkdir "$target"
|
|
|
|
if [ -f relaysrv ] ; then
|
|
|
|
mv relaysrv "$target"
|
2015-08-20 03:33:11 -07:00
|
|
|
tar zcvf "$target.tar.gz" "$target"
|
|
|
|
rm -r "$target"
|
2015-07-20 03:11:06 -07:00
|
|
|
fi
|
|
|
|
if [ -f relaysrv.exe ] ; then
|
2015-08-20 03:33:11 -07:00
|
|
|
mv relaysrv.exe "$target"
|
2015-07-20 03:11:06 -07:00
|
|
|
zip -r "$target.zip" "$target"
|
2015-08-20 03:33:11 -07:00
|
|
|
rm -r "$target"
|
2015-07-20 03:11:06 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
for goos in linux darwin windows freebsd openbsd netbsd solaris ; do
|
|
|
|
build "$goos" amd64
|
|
|
|
done
|
|
|
|
for goos in linux windows freebsd openbsd netbsd ; do
|
|
|
|
build "$goos" 386
|
|
|
|
done
|
|
|
|
build linux arm
|
|
|
|
|
|
|
|
# Hack used because we run as root under Docker
|
|
|
|
if [[ ${CHOWN_USER:-} != "" ]] ; then
|
|
|
|
chown -R $CHOWN_USER .
|
|
|
|
fi
|