-
Notifications
You must be signed in to change notification settings - Fork 42
/
cross_compile.sh
executable file
·76 lines (60 loc) · 1.68 KB
/
cross_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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
goVersion=`go version`
echo "Your go version is '$goVersion', We suggest using 'go1.12.1 +'"
echo ""
cd $GOPATH/src/github.com/GavinGuan24/ahri/
rm -rf releases
mkdir releases
cd ./product/version
version=`go run version.go`
cd $GOPATH/src/github.com/GavinGuan24/ahri/
# $1 os, $2 arch
function build() {
echo "[Building] OS: $1 , ARCH: $2"
cd ./product/client
CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -o ahri-client
sleep 0.01
mkdir ../../releases/client
mv ./ahri-client ../../releases/client
cp ./ahri.hosts ../../releases/client
cp ./ahri.hosts ../../releases/client
cp ./start.sh ../../releases/client
cp ./stop.sh ../../releases/client
cd $GOPATH/src/github.com/GavinGuan24/ahri/
cd ./product/server
CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -o ahri-server
sleep 0.01
mkdir ../../releases/server
mv ./ahri-server ../../releases/server
cp ./gen_rsa_keys.sh ../../releases/server
cp ./start.sh ../../releases/server
cp ./stop.sh ../../releases/server
cd $GOPATH/src/github.com/GavinGuan24/ahri/
cd ./releases
tar zcf "ahri_"$version"_"$1"_"$2".tgz" ./client ./server
rm -rf ./client ./server
cd $GOPATH/src/github.com/GavinGuan24/ahri/
echo "[OK] OS: $1 , ARCH: $2"
echo "----------------------------"
echo
}
echo "Ahri Version: $version"
echo ""
sleep 1
build windows 386
build windows amd64
build linux 386
build linux amd64
build linux arm
build linux arm64
build darwin 386
build darwin amd64
build freebsd 386
build freebsd amd64
build netbsd 386
build netbsd amd64
build openbsd 386
build openbsd amd64
tar zcf ./releases/"ahri_"$version"_src.tgz" ./core ./product ./test ./cross_compile.sh LICENSE
echo "[Finished]"
exit 0