Files
BFM-decomp/decomp-architect/corpus/tools/P9/bootstrap.sh
T
Drew T 827295e241 tools+docs(phase-33.5): task 13.5 — the tools audit + the two dictionaries: tools/tool_census.py (two agreeing enumerations of 327 tool files; docstring/SETUP row/consumers/class derived from the tree; the authored half in config/tool_dictionary.tsv — phase · portability · the NEED each tool answers · what · adapts · verdict — with coverage asserted both ways) → docs/tool-index.md (need-keyed, KEEP-GEN, Reference-index row, wiki + how-to pointers), the kit's tools/MANIFEST.md regenerated (header states live 293 + superseded 28 = 321 rows), and the two verbatim corpora in-tree (Drew, confirmed S91): decomp-architect/corpus/tools/<phase>/ (302 copies + 28 superseded pointers + INDEX) and corpus/cookbook/ (the cookbook, its symptom index, the codegen map, a front page stating what transfers per compiler) — sha1-equal to their sources by tool_census --check in tools-health, regenerated by make kit-corpus; kit_lint exempts the corpus dirs (verbatim evidence) but syntax-checks them; G66 (consult the tool dictionary first) + G67 (translate an inherited idiom through its pass) + two memory seeds (34 at install); SETUP Step 6 installs docs/knowledge-corpus.md and checks the manifest against its own stated total; the ops-setup dictionary rows; the intake's Phase 7 cites G66/G67 and Phase 10 + Part C name the raw-cast → declared-symbol step; templates/layout-contract.md (the five-tool probe, a draft for the split). The review under Drew's criterion: 93 no-consumer tools (one Opus agent's draft, verified: 0 defects, every successor live, 0 live consumers, 0 collisions; four one-off verdicts overturned to STILL-NEEDED) → 34 retired by git mv to tools/sunset/ (28 superseded, 6 one-offs; README review table; SETUP rows moved; Archive-index group). Run 4 (fresh throwaway, the final kit): stopped on my Step-6 check (321 vs the live 293) → both sides derived → resumed → PASS 10/10, manifest 56 == 56, 4 commits, guardrails held (the one foreign path was the timeline regenerated by the detached tools-health). tools-health OK; doc_links --strict rc 0; audit_public OK over 6,842 paths; the purge probe PASSED (Phase 34's gate open). decision-log "P33.5 S91" + accelerators "P33.5 S91" banked; log + checkpoint (NEXT = task 14, xHigh, fresh session)
2026-09-07 22:09:15 -06:00

60 lines
2.6 KiB
Bash

#!/usr/bin/env bash
# tools/bootstrap.sh — fresh-clone setup for BFM-decomp (P33 B3). Idempotent; never sudo.
#
# What a build needs, in order (docs/SETUP.md §4):
# 1. apt packages (§4.5) — only CHECKED here: the missing ones are printed as one install line.
# 2. the Python venv (§4.6) — created from requirements-python.txt (pinned; pycparser < 3.0).
# 3. the four submodules — maspsx (a build input), asm-differ, m2c, decomp-permuter.
# 4. the two vintage cc1s (§4.7) — the tracked old-gcc 0.17 tarballs, sha256-verified, each
# extracted into its OWN subdir (they are flat and share file names).
# 5. `make check-env` — the preflight; its exit status is this script's.
# Then: stage your redump dump under disks/ and run `make disc-extract && make extract-all && make check-all`.
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO"
say() { printf 'bootstrap: %s\n' "$*"; }
# 1) apt packages — presence only (dpkg); print the install line, never run it.
PKGS="bchunk binutils-mipsel-linux-gnu bsdmainutils clang-format coreutils curl gcc-mipsel-linux-gnu git libelf-dev make ninja-build p7zip-full python3-pip python3-venv unzip wget"
if command -v dpkg >/dev/null 2>&1; then
missing=()
for p in $PKGS; do dpkg -s "$p" >/dev/null 2>&1 || missing+=("$p"); done
if ((${#missing[@]})); then
say "MISSING apt packages (${#missing[@]}) — run this, then re-run bootstrap:"
printf ' sudo apt-get install -y %s\n' "${missing[*]}"
else
say "apt packages: all present"
fi
else
say "no dpkg on this system — install the equivalents of: $PKGS"
fi
# 2) the venv (Python >= 3.12; pinned requirements)
if [ ! -x .venv/bin/python ]; then
say "creating .venv"
python3 -m venv .venv
fi
say "installing pinned Python requirements (no-op when satisfied)"
.venv/bin/pip install -q -r requirements-python.txt
# 3) submodules (no-op when populated)
say "submodules: git submodule update --init"
git submodule update --init
# 4) the vintage compilers: verify the tracked tarballs, extract each into its own dir once
say "cc1 tarballs: sha256sum --check tools/bin/CHECKSUMS.sha256"
( cd tools/bin && sha256sum --check --quiet CHECKSUMS.sha256 )
for v in psx cdk; do
if [ ! -x "tools/bin/gcc-2.7.2-$v/cc1" ]; then
say "extracting tools/bin/gcc-2.7.2-$v.tar.gz -> tools/bin/gcc-2.7.2-$v/"
mkdir -p "tools/bin/gcc-2.7.2-$v"
tar xzf "tools/bin/gcc-2.7.2-$v.tar.gz" -C "tools/bin/gcc-2.7.2-$v"
else
say "cc1 present: tools/bin/gcc-2.7.2-$v/cc1"
fi
done
# 5) the preflight (its exit status is ours)
say "make check-env"
make --no-print-directory check-env