62 lines
1.5 KiB
Bash
Executable File
62 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build Former for macOS
|
|
set -e
|
|
|
|
# --- Dependency checks ---
|
|
missing=()
|
|
|
|
if ! command -v go &>/dev/null; then
|
|
missing+=("go")
|
|
echo "ERROR: Go not found."
|
|
echo " Install: brew install go"
|
|
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."
|
|
echo " Install: brew install node"
|
|
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 ! xcode-select -p &>/dev/null; then
|
|
missing+=("xcode-cli")
|
|
echo "ERROR: Xcode Command Line Tools not found."
|
|
echo " Install: xcode-select --install"
|
|
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 ---
|
|
pkill -f "Former.app" || true
|
|
sleep 0.5
|
|
|
|
export SDKROOT=$(xcrun --show-sdk-path)
|
|
export CC=/usr/bin/clang
|
|
export CGO_ENABLED=1
|
|
|
|
WAILS=$(command -v wails || echo "$HOME/go/bin/wails")
|
|
|
|
# Generate app icon from Former.svg
|
|
echo "Generating app icon..."
|
|
go run ./cmd/genicon 2>/dev/null && echo "Icon generated." || echo "Icon generation skipped."
|
|
|
|
"$WAILS" build -skipbindings
|
|
|
|
open build/bin/Former.app
|