-
Notifications
You must be signed in to change notification settings - Fork 45
/
compile.sh
executable file
·57 lines (40 loc) · 1.55 KB
/
compile.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
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR
if [ -z "$GOPATH" ];then
echo "GOPATH is not set, please set first"
exit 1
fi
export PATH=$PATH:$GOPATH/bin
echo "build tonghse in "$DIR" with GOPATH:" $GOPATH
echo "get go-bindata..."
go get -u github.com/jteeuwen/go-bindata/...
echo "get go-bindata done..."
echo "bindata:translate all res to bindata.go ..."
./vendor/bin/go-bindata -prefix "res/" res/...
echo "bindata:translate done ..."
echo "download vendor..."
go get ./...
echo "download vendor done..."
mkdir -p bin/
echo "#########################################################"
echo "compile for windows-386..."
GOOS=windows GOARCH=386 go build -o ./bin/tongshe.exe -v .
#################
#echo "compile for linux-386..."
#GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -o ./bin/tongshe.linux.386 -v .
#
#echo "compile for linux-amd64..."
#GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/tongshe.linux.amd64 -v .
#################
echo "#########################################################"
echo "compile for darwin-amd64..."
GOOS=darwin GOARCH=amd64 go build -o ./bin/tongshe.darwin.amd64 -v .
echo "compile done"
echo "the binary files is in "$DIR/bin/