-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-release.sh
executable file
·55 lines (47 loc) · 1.89 KB
/
build-release.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
#!/bin/bash
unamestr=`uname`
SHA256='shasum -a 256'
if ! hash shasum 2> /dev/null
then
SHA256='sha256sum.exe'
fi
VERSION=`date -u +%Y%m%d`
LDFLAGS="-s -w"
GCFLAGS=""
TAGS="bloom"
BUILD_DIR="release_build"
OSES=(linux darwin windows freebsd)
# ARCHS=(amd64 386)
ARCHS=(amd64 arm64)
function build_release() {
for os in ${OSES[@]}; do
for arch in ${ARCHS[@]}; do
suffix=""
cgo_enabled=0
env CGO_ENABLED=$cgo_enabled GOOS=$os GOARCH=$arch go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -tags "$TAGS" -o shadowsocks_${os}_${arch}${suffix} github.com/ccsexyz/shadowsocks-go
tar -zcf shadowsocks-${os}-${arch}-$VERSION.tar.gz shadowsocks_${os}_${arch}${suffix}
$SHA256 shadowsocks-${os}-${arch}-$VERSION.tar.gz
done
done
# ARM
ARMS=(5 6 7)
for v in ${ARMS[@]}; do
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=$v go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -tags "$TAGS" -o shadowsocks_linux_arm${v} github.com/ccsexyz/shadowsocks-go
done
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -tags "$TAGS" -o shadowsocks_linux_arm64 github.com/ccsexyz/shadowsocks-go
tar -zcf shadowsocks-linux-arm-$VERSION.tar.gz shadowsocks_linux_arm*
$SHA256 shadowsocks-linux-arm-$VERSION.tar.gz
#MIPS32LE
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -tags "$TAGS" -o shadowsocks_linux_mipsle github.com/ccsexyz/shadowsocks-go
env CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -tags "$TAGS" -o shadowsocks_linux_mips github.com/ccsexyz/shadowsocks-go
tar -zcf shadowsocks-linux-mipsle-$VERSION.tar.gz shadowsocks_linux_mipsle
$SHA256 shadowsocks-linux-mipsle-$VERSION.tar.gz
tar -zcf shadowsocks-linux-mips-$VERSION.tar.gz shadowsocks_linux_mips
$SHA256 shadowsocks-linux-mips-$VERSION.tar.gz
}
PWD=`pwd`
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
cd $BUILD_DIR
build_release
cd $PWD