1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-11 08:19:18 +00:00

Add System Status Dashboard

This commit is contained in:
Tw93
2025-11-21 17:58:31 +08:00
parent b9760573bc
commit 45d31e880c
13 changed files with 2152 additions and 7 deletions

44
scripts/build-status.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# Build Universal Binary for status-go
# Supports both Apple Silicon and Intel Macs
set -euo pipefail
cd "$(dirname "$0")/.."
if ! command -v go > /dev/null 2>&1; then
echo "Error: Go not installed"
echo "Install: brew install go"
exit 1
fi
echo "Building status-go for multiple architectures..."
VERSION=$(git describe --tags --always --dirty 2> /dev/null || echo "dev")
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
LDFLAGS="-s -w -X main.Version=$VERSION -X main.BuildTime=$BUILD_TIME"
echo " Version: $VERSION"
echo " Build time: $BUILD_TIME"
echo ""
echo " → Building for arm64..."
GOARCH=arm64 go build -ldflags="$LDFLAGS" -trimpath -o bin/status-go-arm64 ./cmd/status
echo " → Building for amd64..."
GOARCH=amd64 go build -ldflags="$LDFLAGS" -trimpath -o bin/status-go-amd64 ./cmd/status
echo " → Creating Universal Binary..."
lipo -create bin/status-go-arm64 bin/status-go-amd64 -output bin/status-go
rm bin/status-go-arm64 bin/status-go-amd64
echo ""
echo "✓ Build complete!"
echo ""
file bin/status-go
size_bytes=$(stat -f%z bin/status-go 2> /dev/null || echo 0)
size_mb=$((size_bytes / 1024 / 1024))
printf "Size: %d MB (%d bytes)\n" "$size_mb" "$size_bytes"
echo ""
echo "Binary supports: arm64 (Apple Silicon) + x86_64 (Intel)"