srcpv(1) follows a running buildworld or buildkernel and shows its
progress with bsdpv(1). It reads the output of make(1) from a file,
FIFO, or stdin (-f), or snoops the terminal running the build with
watch(8) (-w). The build itself is untouched and need not be started
in any special way; the bar can be attached before, during, or after
it begins.
Progress is measured against a schedule derived from the tree rather
than a count of directories: Makefile.inc1 supplies the stages,
library lists, compat passes, and SUBDIR list for buildworld, and
config(8) plus sys/modules supply the kernel objects and modules for
each kernel in KERNCONF. Every unit is weighted by the objects it is
expected to produce, so the bar moves in proportion to the work
remaining. The schedule is cached and rebuilt when the makefiles that
shape it change.
This is the first consumer of bsdpv(1) that is neither a dialog nor a
transfer view, and the sort of utility having it in base makes easy.
Ship it in the bsdpv package alongside its dependency.