Support Apple M1 Mac (#823)

See issue https://github.com/xtaci/kcptun/issues/822

Co-authored-by: apple <apple@abc.net>
This commit is contained in:
abigt
2020-11-26 11:06:46 +08:00
committed by GitHub
co-authored by apple
parent 160b68cbc5
commit 76c4d231f2
+11
View File
@@ -67,6 +67,17 @@ tar -zcf kcptun-linux-arm$v-$VERSION.tar.gz client_linux_arm$v server_linux_arm$
$sum kcptun-linux-arm$v-$VERSION.tar.gz
done
#Apple M1 device
os=`uname` #Darwin
arch=`arch`
if [ $os == "Darwin" ] && [ $arch == "arm64" ]
then
env CGO_ENABLED=0 GOOS=darwin GOARCH=$arch go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o server_darwin_$arch github.com/xtaci/kcptun/server
env CGO_ENABLED=0 GOOS=darwin GOARCH=$arch go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o client_darwin_$arch github.com/xtaci/kcptun/client
tar -zcf kcptun-darwin-arm64-$VERSION.tar.gz client_darwin_arm64 server_darwin_arm64
$sum kcptun-darwin-arm64-$VERSION.tar.gz
fi
# ARM64
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o client_linux_arm64 github.com/xtaci/kcptun/client
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o server_linux_arm64 github.com/xtaci/kcptun/server