nekoray_Mahdi-zarei/script/build_go.sh
parhelia512 155bfb5c69
ci: add linux/arm64 build (#510)
* feat: add linux/arm64 support

* Update build.yml

* Update pack_debian.sh

* Update build.yml

* Update build_go.sh

* Update build.yml
2025-07-11 01:41:01 -07:00

31 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
source script/env_deploy.sh
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/windows64 || true
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/windows-arm64 || true
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/linux-amd64 || true
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/linux-arm64 || true
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/macos-amd64 || true
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/macos-arm64 || true
if [ -z $DEST ]; then
echo "Please set GOOS GOARCH"
exit 1
fi
rm -rf $DEST
mkdir -p $DEST
export CGO_ENABLED=0
#### Go: updater ####
pushd core/updater
[ "$GOOS" == "darwin" ] || go build -o $DEST -trimpath -ldflags "-w -s"
popd
#### Go: core ####
pushd core/server
VERSION_SINGBOX=$(go list -m -f '{{.Version}}' github.com/sagernet/sing-box)
go build -v -o $DEST -trimpath -ldflags "-w -s -X 'github.com/sagernet/sing-box/constant.Version=${VERSION_SINGBOX}'" -tags "with_clash_api,with_gvisor,with_quic,with_wireguard,with_utls,with_ech,with_dhcp"
popd