-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
executable file
·63 lines (51 loc) · 1.48 KB
/
build.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
build() {
echo "Building for $1-$2 to $3"
GOOS=$1 GOARCH=$2 go install -v std
GOOS=$1 GOARCH=$2 go build -v -o crg-scoreboard_$VERSION/$3 ./cmd/scoreboard
echo
}
ZIP=0
RELEASE=0
if [ "z$1" = "z-zip" ]; then ZIP=1; fi
if [ "z$1" = "z-release" ]; then RELEASE=1; ZIP=1; fi
VERSION=3.9.0
if [ $RELEASE -eq 0 ]; then VERSION=$VERSION-`date +%Y%m%d%H%M%S`; fi
echo Building Version $VERSION
echo
cat > server/version.go <<END
package server
const version = "$VERSION"
END
go get -u github.com/gorilla/websocket
go get -u github.com/satori/go.uuid
go get -u github.com/go-fsnotify/fsnotify
go get -u github.com/kardianos/osext
if [ $ZIP -eq 0 ]; then
mkdir -p bin
PLATFORM=$(uname -s)
EXT=""
case $PLATFORM in
CYGWIN*|MINGW32*|MSYS*)
EXT=".exe"
;;
esac
rm -f ./bin/scoreboard$EXT
go build -v -o ./bin/scoreboard$EXT ./cmd/scoreboard
else
rm -f scoreboard-*
mkdir -p release
rm -f release/scoreboard-$VERSION.zip
mkdir -p crg-scoreboard_$VERSION
cp -r html crg-scoreboard_$VERSION
cp start.html AUTHORS LICENSE crg-scoreboard_$VERSION
build "linux" "386" "scoreboard-Linux-32"
build "linux" "amd64" "scoreboard-Linux-64"
build "windows" "386" "scoreboard-Windows-32.exe"
build "windows" "amd64" "scoreboard-Windows-64.exe"
build "darwin" "386" "scoreboard-MacOS-32"
build "darwin" "amd64" "scoreboard-MacOS-64"
echo Zipping to release/crg-scoreboard_$VERSION.zip
zip -qr release/crg-scoreboard_$VERSION.zip crg-scoreboard_$VERSION
rm -rf crg-scoreboard_$VERSION
fi