Skip to content

Commit

Permalink
enable support for Apple M1
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Apr 1, 2021
1 parent 07ad03f commit 9a5b31b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ for os in ${OSES[@]}; do
$sum kcptun-${os}-386-$VERSION.tar.gz
done

#Apple M1 device
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o server_darwin_arm64 github.com/xtaci/kcptun/server
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -mod=vendor -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" -o client_darwin_arm64 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

# ARM
ARMS=(5 6 7)
for v in ${ARMS[@]}; do
Expand All @@ -67,17 +73,6 @@ 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
Expand Down

2 comments on commit 9a5b31b

@michaelzx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何时发布?🙂

@xtaci
Copy link
Owner Author

@xtaci xtaci commented on 9a5b31b Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何时发布?🙂

done

Please sign in to comment.