-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·66 lines (56 loc) · 1.43 KB
/
package.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
#!/usr/bin/env bash
set -e
function get_arch() {
a=$(uname -m)
case ${a} in
"x86_64" | "amd64")
echo "amd64"
;;
"i386" | "i486" | "i586")
echo "386"
;;
"aarch64" | "arm64")
echo "arm64"
;;
"armv6l" | "armv7l")
echo "arm"
;;
"s390x")
echo "s390x"
;;
*)
echo ${NIL}
;;
esac
}
function get_os() {
echo $(uname -s | awk '{print tolower($0)}')
}
function package() {
printf "============Pakcage for %s============\n" $2
local release=${1}
local osarch=(${2//_/ })
local os=${osarch[0]}
local arch=${osarch[1]}
printf "[1/2] Cross compile@%s_%s\n" ${os} ${arch}
GOOS=${os} GOARCH=${arch} gbb
printf "[2/2] Package\n"
if [ ${os} == "windows" ]; then
zip g${release}.${os}-${arch}.zip ./g.exe
shasum -a 256 g${release}.${os}-${arch}.zip >> sha256sum.txt
else
tar -czv -f g${release}.${os}-${arch}.tar.gz ./g
shasum -a 256 g${release}.${os}-${arch}.tar.gz >> sha256sum.txt
fi
}
main() {
export CGO_ENABLED="0"
export GO111MODULE="on"
export GOPROXY="https://goproxy.cn,direct"
local release="1.5.0"
for item in "darwin_amd64" "darwin_arm64" "linux_386" "linux_amd64" "linux_arm" "linux_arm64" "linux_s390x" "windows_386" "windows_amd64" "windows_arm" "windows_arm64"; do
package ${release} ${item}
done
go clean
}
main