#!/usr/bin/env bash # Build every supported platform and an aggregate ZIP. Run from any directory. set -euo pipefail cd "$(dirname "$0")/.." export PATH="/usr/local/go/bin:$PATH" command -v go >/dev/null version=${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)} mkdir -p dist platforms=(linux-amd64 linux-386 linux-arm linux-armv7 linux-arm64 windows-amd64 windows-386 windows-arm64 termux-armv7 termux-arm64) for target in "${platforms[@]}"; do os=${target%%-*}; arch=${target#*-}; goos=$os; goarch=$arch; arm=7 [[ $os != termux ]] || goos=linux case $arch in arm) arm=6;; armv7) goarch=arm;; esac dest="dist/wswg-$target" mkdir -p "$dest" ext=; [[ $os != windows ]] || ext=.exe echo "Building $target" CGO_ENABLED=0 GOOS=$goos GOARCH=$goarch GOARM=$arm go build -trimpath -buildvcs=false -ldflags="-s -w -X main.version=$version" -o "$dest/wswg$ext" . cp README.md LICENSE THIRD_PARTY.md "$dest/" done if [[ ${SKIP_BUNDLE:-0} != 1 ]]; then python3 scripts/bundle.py; fi if [[ ${SKIP_BUNDLE:-0} != 1 ]]; then python3 scripts/check-builds.py; fi python3 scripts/archive.py