Add the doc/manbuild.sh script

This script wraps the logic to build a manual page from sources.  At the
moment, it is just a very complex wrapper over sed but additional logic
will be added.

This also adds tests to make sure that the manual pages we generate are
valid.  In particular, we unit-test this new script and the script itself
ensures that no patterns are left unreplaced in the generated files.