8.24. mandoc 1.14.6

Build and install mandoc as the final manual page compiler, viewer, and indexer.

Input assumption: mandoc-1.14.6.tar.gz is already present in /sources from the chapter 4 source staging step.

Source URL: https://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz

Upstream build note: upstream documents the portable build as ./configure, make, make install, and then makewhatis. The configure script is not generated by GNU autotools; it reads configure.local for installation paths and feature choices, so lbi_configure is not applicable here.

Licenses:

Dependencies:

mandoc is a manual page compiler and viewer for mdoc, man, and roff documents. we need it to provide the final target man, apropos, whatis, makewhatis, and soelim commands for reading and indexing installed manual pages.

Extract and Enter the Source Tree

cd /sources
rm -rf mandoc-1.14.6
tar -xf mandoc-1.14.6.tar.gz
cd mandoc-1.14.6

Configure mandoc

cat > configure.local <<EOF
PREFIX=/system
BINDIR=/system/binaries
SBINDIR=/system/systembinaries
MANDIR=/system/documentation/man-pages
MANPATH_DEFAULT="/system/documentation/man-pages"
MANPATH_BASE="/system/documentation/man-pages"
BIN_FROM_SBIN="../binaries"
BINM_PAGER=cat
LN="ln -sf"
CC=cc
CFLAGS="-O2 $LWI_CFLAGS"
LDFLAGS="$LBI_CUSTOM_LDFLAGS"
EOF

./configure
grep '#define BINM_PAGER "cat"' config.h
BINM_PAGER is compiled into mandoc as the fallback pager. The grep check catches stale configure output before installation. At runtime, MANPAGER and PAGER still override this fallback, so set either variable to cat if your shell environment points at a pager that is not installed yet.

Build mandoc

make $LWI_MAKE_FLAGS

Install mandoc

make install
/system/systembinaries/makewhatis /system/documentation/man-pages
MANPAGER=cat man mandoc >/dev/null
This install provides man, apropos, and whatis as links to mandoc, installs soelim, and installs makewhatis in /system/systembinaries.
After this step is complete, you can remove the extracted source directory and source tarball from /sources if you do not plan to rebuild mandoc again.

Command Explanations