#!/bin/bash
# Build script for Linux / macOS
# Run on the target OS to build for that platform.
#
# Usage:
#   chmod +x build.sh
#   ./build.sh          # build
#   ./build.sh --clean  # clean first
set -e

cd "$(dirname "$0")"

# Install deps if needed
pip install -r requirements.txt pyinstaller 2>/dev/null || pip3 install -r requirements.txt pyinstaller

if [ "$1" = "--clean" ]; then
    rm -rf build dist *.spec
    echo "Cleaned"
fi

python build.py "$@" || python3 build.py "$@"
