This commit is contained in:
2026-04-17 11:12:45 +03:00
commit f4b1ac5789
14 changed files with 656 additions and 0 deletions

41
build.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="nyxtex"
OUT_DIR="dist"
cd "$(dirname "$0")"
mkdir -p "$OUT_DIR"
VERSION="${VERSION:-$(date -u +%Y%m%d-%H%M%S)}"
LDFLAGS="-s -w"
TARGETS=(
"darwin/amd64"
"darwin/arm64"
"linux/amd64"
"linux/arm64"
"linux/386"
"windows/amd64"
"windows/arm64"
"freebsd/amd64"
)
echo "Building $APP_NAME version=$VERSION -> $OUT_DIR/"
for target in "${TARGETS[@]}"; do
goos="${target%/*}"
goarch="${target#*/}"
ext=""
if [ "$goos" = "windows" ]; then
ext=".exe"
fi
out="$OUT_DIR/${APP_NAME}-${VERSION}-${goos}-${goarch}${ext}"
echo " -> $out"
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 \
go build -trimpath -ldflags "$LDFLAGS" -o "$out" .
done
echo "Done."