#!/bin/sh
# Host-safe entry point for the pinned RVBox build toolchain.
set -eu

repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
target=${1:-build}
shift || true

case $target in
    build|verify) ;;
    *)
        printf '%s\n' 'usage: scripts/build [build|verify]' >&2
        exit 2
        ;;
esac
[ "$#" -eq 0 ] || {
    printf '%s\n' 'scripts/build does not accept additional arguments' >&2
    exit 2
}

cd "$repo_root"
exec docker compose -f deploy/compose.yaml run --rm toolchain make "$target"
