-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·37 lines (29 loc) · 1000 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
#!/bin/bash
GOARCH=amd64
macBuildName=tw_darwin_${GOARCH}
winBuildName=tw_windows_${GOARCH}
linuxBuildName=tw_linux_${GOARCH}
# clear build/
rm -rf tw_build
mkdir tw_build
build() {
# Build
GOOS=darwin GOARCH=${GOARCH} go build -o $macBuildName translate.go
GOOS=linux GOARCH=${GOARCH} go build -o $linuxBuildName translate.go
GOOS=windows GOARCH=${GOARCH} go build -o $winBuildName.exe translate.go
# Compress
if [ -x "$(command -v upx)" ]; then
upx $macBuildName
upx $linuxBuildName
upx $winBuildName.exe
fi
# Move
mv -f $macBuildName tw_build/$macBuildName
mv -f $linuxBuildName tw_build/$linuxBuildName
mv -f $winBuildName.exe tw_build/$winBuildName.exe
# gzip
tar -cvf tw_build/${macBuildName}.tar tw_build/${macBuildName} && gzip tw_build/${macBuildName}.tar
tar -cvf tw_build/${linuxBuildName}.tar tw_build/${linuxBuildName} && gzip tw_build/${linuxBuildName}.tar
zip -j tw_build/${winBuildName}.zip tw_build/${winBuildName}.exe
}
build