64 lines
1.9 KiB
Bash
Executable File
64 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Cross-compile Former for Windows (amd64) from macOS/Linux
|
|
set -e
|
|
|
|
# --- Dependency checks ---
|
|
missing=()
|
|
|
|
if ! command -v go &>/dev/null; then
|
|
missing+=("go")
|
|
echo "ERROR: Go not found."
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
echo " Install: brew install go"
|
|
else
|
|
echo " Install: sudo apt install golang (or your distro's package manager)"
|
|
fi
|
|
echo " Or download from https://go.dev/dl/"
|
|
echo ""
|
|
fi
|
|
|
|
if ! command -v node &>/dev/null; then
|
|
missing+=("node")
|
|
echo "ERROR: Node.js not found."
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
echo " Install: brew install node"
|
|
else
|
|
echo " Install: sudo apt install nodejs npm (or your distro's package manager)"
|
|
fi
|
|
echo " Or download from https://nodejs.org/"
|
|
echo ""
|
|
fi
|
|
|
|
if ! command -v wails &>/dev/null && [ ! -x "$HOME/go/bin/wails" ]; then
|
|
missing+=("wails")
|
|
echo "ERROR: Wails CLI not found."
|
|
echo " Install: go install github.com/wailsapp/wails/v2/cmd/wails@latest"
|
|
echo " Docs: https://wails.io/docs/gettingstarted/installation"
|
|
echo ""
|
|
fi
|
|
|
|
if [ ${#missing[@]} -gt 0 ]; then
|
|
echo "Missing dependencies: ${missing[*]}"
|
|
echo "Install the tools listed above and re-run this script."
|
|
exit 1
|
|
fi
|
|
|
|
# --- Build ---
|
|
|
|
# Generate app icon (needs CGO on macOS for native SVG rendering)
|
|
echo "Generating app icon..."
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
SDKROOT=$(xcrun --show-sdk-path) CC=/usr/bin/clang CGO_ENABLED=1 \
|
|
go run ./cmd/genicon 2>/dev/null && echo "Icon generated." || echo "Icon generation skipped."
|
|
else
|
|
CGO_ENABLED=0 go run ./cmd/genicon 2>/dev/null && echo "Icon generated." || echo "Icon generation skipped."
|
|
fi
|
|
|
|
WAILS=$(command -v wails || echo "$HOME/go/bin/wails")
|
|
|
|
echo "Building Former for Windows (amd64)..."
|
|
CGO_ENABLED=0 "$WAILS" build -skipbindings -platform windows/amd64
|
|
|
|
echo ""
|
|
ls -lh build/bin/Former.exe 2>/dev/null && echo "Done." || echo "Build failed."
|