forked from zhaojh329/rttys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·50 lines (36 loc) · 888 Bytes
/
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
#!/bin/sh
VersionPath="github.com/zhaojh329/rttys/version"
GitCommit=$(git log --pretty=format:"%h" -1)
BuildTime=$(date +%FT%T%z)
generate() {
local os="$1"
local arch="$2"
local dir="rttys-$os-$arch"
local bin="rttys"
mkdir output/$dir
cp rttys.conf output/$dir
cp output/rttys.crt output/rttys.key output/$dir
[ "$os" = "windows" ] && {
bin="rttys.exe"
}
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -ldflags="-s -w -X $VersionPath.gitCommit=$GitCommit -X $VersionPath.buildTime=$BuildTime" -o output/$dir/$bin
cd output
if [ "$os" = "windows" ];
then
zip -r $dir.zip $dir
else
tar zcvf $dir.tar.gz $dir
fi
cd ..
}
rm -rf output
mkdir output
TARGET=output ./generate-CA.sh rttys
generate linux amd64
generate linux 386
generate windows amd64
generate windows 386
generate darwin amd64
generate darwin 386
generate freebsd amd64
generate freebsd 386