Created
February 10, 2026 12:56
-
-
Save gourytch/8e2b4ca07202e12eb9f3a6ff351c6af4 to your computer and use it in GitHub Desktop.
GOST v3 cross-compiling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| : ${GOOS:=linux} | |
| : ${GOARCH:=amd64} | |
| : ${EXE:=./gost-${GOOS}-${GOARCH}} | |
| PAIR="${GOOS}/${GOARCH}" | |
| if ! go tool dist list | grep -q "${PAIR}" | |
| then | |
| echo "unsupported pair: ${PAIR}" | |
| exit 1 | |
| fi | |
| echo "=== BUILD FOR: ${PAIR}" | |
| echo "=== UPDATE SOURCES ===" | |
| test -d gost || git clone https://github.com/go-gost/gost ./gost | |
| cd ./gost | |
| git pull | |
| echo "=== UPDATE MODULES ===" | |
| GOOS=${GOOS} GOARCH=${GOARCH} go mod tidy -v | |
| echo "=== BUILD ${EXE} ===" | |
| GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o ${EXE} \ | |
| -ldflags "-w -s -X main.version=stripped -buildid= -extldflags=static" \ | |
| -buildvcs=false -a -installsuffix cgo -trimpath \ | |
| ./cmd/gost | |
| file ${EXE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment