#!/bin/bash


set -e
set -x


cd "$(dirname "$0")/.."
mkdir -p dist
REQS=$(mktemp)
uv export --no-dev --no-header --no-emit-project --no-hashes > "$REQS"
uv build --wheel --out-dir dist
WHEEL=$(ls dist/eris-*.whl 2>/dev/null | head -1)
if [ -z "$WHEEL" ]; then
    echo "No wheel found in dist/" >&2
    exit 1
fi
uv run shiv \
  -e "eris.__main__:entry_point" \
  -o dist/eris \
  --compile-pyc \
  --reproducible \
  --no-deps \
  -r "$REQS" \
  "$WHEEL"
rm -f "$REQS" "$WHEEL"
