Instead of maintaining rote instructions for building BerkeleyDB in doc/build-{unix,openbsd}.md, reference a script that does the same thing and can be called from unanticipated contexts, e.g. Docker builds.
The script was written with portability in mind, though I haven't tested it on openbsd.
I wasn't sure if we wanted to create a separate directory for this sort of thing (e.g. contrib/install) so I just stuck it in contrib/; happy to move it around if anyone has another preference.