Mandoc

From Gentoo Wiki
Jump to:navigation Jump to:search

mandoc is a suite of tools for mdoc(7) , the semantic roff macro language preferred for BSD manual pages, and man(7) , the historical presentation-based roff macro language for UNIX manuals.

Installation

USE flags

USE flags for app-text/mandoc Suite of tools compiling mdoc and man

cgi build man.cgi web plugin for viewing man pages
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
system-man set as the default man provider
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
Data provided by the Gentoo Package Database · Last update: 2026年01月04日 12:59 More information about USE flags

Before enabling the system-man USE flag, please refer to "The system-man USE flag".

Emerge

root #emerge --ask app-text/mandoc

The system-man USE flag

The system-man USE flag makes mandoc the default program for accessing man pages.

Warning
During installation, man pages are compressed using the value of the PORTAGE_COMPRESS variable, which by default is "bzip2". However, the only compression format handled by mandoc is gzip. After changing this flag and (re)installing mandoc, only man pages which are uncompressed or gzip-compressed will be readable.
Warning
PORTAGE_COMPRESS and PORTAGE_COMPRESS_EXCLUDE_SUFFIXES will not have any effect on packages installed from a binary host!

To ensure mandoc can display man pages, either set the value of PORTAGE_COMPRESS variable to gzip or pigz in /etc/portage/make.conf , as described in the following sections, or leave man pages uncompressed. Then reinstall packages containing man pages.

Compressing man pages with gzip

To compress with gzip and optionally select a compression level via PORTAGE_COMPRESS_FLAGS:

FILE /etc/portage/make.conf
PORTAGE_COMPRESS="gzip"
# Optionally set the compression level
PORTAGE_COMPRESS_FLAGS="-9"

Optional: Using pigz for higher gzip compression

app-arch/pigz is mainly known for being a parallel implementation of gzip. However, pigz offers the compression level -11, which utilizes the brotli algorithm.

To install app-arch/pigz :

root #emerge -va app-arch/pigz
FILE /etc/portage/make.conf
PORTAGE_COMPRESS="pigz"
# Optionally set the compression level. 1-9 are comparable to gzip, -11 leads to using the brotli algorithm
PORTAGE_COMPRESS_FLAGS="-11"

Requesting uncompressed man pages

To configure PORTAGE_COMPRESS_EXCLUDE_SUFFIXES to not compress man pages:

FILE /etc/portage/make.conf
# man pages suffixes, may not be exhaustive
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="[1-9] n [013]p [1357]ssl [1357]ossl 3am 3pcap 3perl 3pm [1-9]bsd"

Reinstalling packages to make their man pages usable

Packages that will need to be reinstalled include:

For a complete reinstallation of packages to be reinstalled, the following commands can be used. The first line requires app-portage/portage-utils and, if using Bash, the globstar option:

user $qfile /usr/share/man/**/*.bz2 | cut -d: -f1 | sort -u >/tmp/reinstall_packages.txt
user $for package in $(cat /tmp/reinstall_packages.txt); do emerge -1 "$package"; done

See also

man page — contains system reference documentation. It is found on most Unix-like systems.

External resources