|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Clone, build, and verify stash-bot → bin/stash-bot/src/stash. |
| 3 | +# |
| 4 | +# Stash (Morgan Houppin) is a UCI engine in C. The repo's README says: |
| 5 | +# - Source is under src/ |
| 6 | +# - Plain `make` autodetects arch flags, BUT |
| 7 | +# - `make NATIVE=yes` enables ALL available instruction sets on the host, |
| 8 | +# which matters for movegen speed (the README and upstream maintainer |
| 9 | +# explicitly call this out). |
| 10 | +# We always pass NATIVE=yes here since PerftWar runs the binary on the |
| 11 | +# same host that built it. |
| 12 | + |
| 13 | +ENGINE="stash-bot" |
| 14 | +REPO="https://github.com/mhouppin/stash-bot" |
| 15 | +ENGINE_DIR="bin/stash-bot" |
| 16 | +BINARY="$ENGINE_DIR/src/stash" |
| 17 | + |
| 18 | +# shellcheck source=_common.sh |
| 19 | +source "$(cd "$(dirname "$0")" && pwd)/_common.sh" |
| 20 | + |
| 21 | +# --- Preflight ------------------------------------------------------------- |
| 22 | +command -v gcc >/dev/null 2>&1 || command -v clang >/dev/null 2>&1 \ |
| 23 | + || die "neither gcc nor clang found" |
| 24 | +command -v make >/dev/null 2>&1 || die "make not found" |
| 25 | + |
| 26 | +# --- Clone + build --------------------------------------------------------- |
| 27 | +clone_or_keep "$ENGINE_DIR" "$REPO" |
| 28 | + |
| 29 | +HOST=$(detect_host) |
| 30 | +log "building (host=$HOST, cd src && make NATIVE=yes)" |
| 31 | +( |
| 32 | + cd "$ENGINE_DIR/src" |
| 33 | + make NATIVE=yes |
| 34 | +) |
| 35 | + |
| 36 | +[ -x "$BINARY" ] || die "expected binary at $BINARY but it's missing" |
| 37 | + |
| 38 | +out=$(verify_perft "$BINARY") || die "perft test failed" |
| 39 | + |
| 40 | +version=$(detect_version "$out") |
| 41 | +if [ -n "$version" ]; then |
| 42 | + log "UCI banner: $version" |
| 43 | + log "→ consider setting engines/$ENGINE.json's \"version\" to: $version" |
| 44 | +fi |
| 45 | +commit=$(git -C "$ENGINE_DIR" rev-parse --short HEAD 2>/dev/null || echo "") |
| 46 | +[ -n "$commit" ] && log "stash-bot commit: $commit" |
| 47 | + |
| 48 | +log "done. launch: $BINARY" |
0 commit comments