#!/bin/bash
set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_DIR"

if [ ! -d ".venv" ]; then
  python3 -m venv .venv
fi

source .venv/bin/activate

python -m pip install --upgrade pip
python -m pip install -r requirements.txt pyinstaller
python scripts/build_mac.py

echo
echo "Build finished."
echo "Output app: dist/SunnyERPApp.app"
echo "Package zip: dist/SunnyERPApp_macOS.zip"
