build.sh
513 B
| 1 | #!/usr/bin/env sh |
| 2 | # Сборка бинарников Clancore Repo под Windows и Debian/Linux. |
| 3 | # Запуск: ./build.sh |
| 4 | set -eu |
| 5 | |
| 6 | cd "$(dirname "$0")" |
| 7 | DIST="dist" |
| 8 | mkdir -p "$DIST" |
| 9 | |
| 10 | build() { |
| 11 | os="$1" |
| 12 | arch="$2" |
| 13 | out="$3" |
| 14 | echo "==> $os/$arch" |
| 15 | CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" \ |
| 16 | go build -trimpath -ldflags "-s -w" -o "$DIST/$out" . |
| 17 | } |
| 18 | |
| 19 | build windows amd64 clancore-repo-windows-amd64.exe |
| 20 | build linux amd64 clancore-repo-linux-amd64 |
| 21 | |
| 22 | echo "" |
| 23 | echo "Готово:" |
| 24 | ls -lh "$DIST" |