#!/usr/bin/env bash
# Clone ORCA/C as an on-disk reference. It's an on-machine compiler — we only
# need the source to study codegen choices, not to build.

set -euo pipefail
source "$(dirname "$0")/common.sh"

ORCA_DIR="$TOOLS_DIR/orca-c"
ORCA_URL="https://github.com/byteworksinc/ORCA-C.git"

if [ -d "$ORCA_DIR/.git" ]; then
    log "orca-c already cloned; pulling latest"
    git -C "$ORCA_DIR" pull --ff-only
else
    log "cloning ORCA/C reference source"
    git clone --depth=1 "$ORCA_URL" "$ORCA_DIR"
fi

log "orca-c reference at $ORCA_DIR"
