6.47. Man-DB-2.5.2

The Man-DB package contains programs for finding and viewing man pages.

Approximate build time: 0.3 SBU
Required disk space: 20 MB

6.47.1. Installation of Man-DB

LFS creates /usr/man and /usr/local/man as symlinks. Remove them from the man_db.conf file to prevent redundant results when using programs such as whatis:

sed -i -e '\%\t/usr/man%d' -e '\%\t/usr/local/man%d' src/man_db.conf.in

Prepare Man-DB for compilation:

./configure --prefix=/usr --libexecdir=/usr/lib \
    --sysconfdir=/etc --disable-setuid \
    --enable-mb-groff --with-browser=/usr/bin/lynx \
    --with-col=/usr/bin/col --with-vgrind=/usr/bin/vgrind \
    --with-grap=/usr/bin/grap

The meaning of the configure options:

--disable-setuid

This disables making the man program setuid to user man.

--enable-mb-groff

This switch tells man-db to expect the Debian multibyte patched version of groff.

--with-...

These four parameters are used to set some default programs. The col program is a part of the Util-linux-ng package, lynx is a text-based web browser (see BLFS for installation instructions), vgrind converts program sources to Groff input, and grap is useful for typesetting graphs in Groff documents. The vgrind and grap programs are not normally needed for viewing manual pages. They are not part of LFS or BLFS, but you should be able to install them yourself after finishing LFS if you wish to do so.

Compile the package:

make

This package does not come with a test suite.

Install the package:

make install

6.47.2. Non-English Manual Pages in LFS

Some packages provide non-English manual pages. They are displayed correctly only if their location and encoding matches the expectation of the "man" program. However, different Linux distributions have different policies (expressed in the choice of the man program, its configuration and patches applied to it) concerning the character encoding in which manual pages are stored in the filesystem.

E.g., Debian previously required Russian manual pages to be encoded in KOI8-R and to be placed in /usr/share/man/ru. Now, in addition, their man program (Man-DB) searches for UTF-8 encoded Russian manual pages in /usr/share/man/ru.UTF-8. On the other hand, Fedora uses UTF-8 encoded manual pages exclusively. Russian manual pages are found in /usr/share/man/ru and their man program doesn't acknowledge /usr/share/man/ru.UTF-8. Many other distributions ignore the on disk encodings completely, leaving the end user with a mix of improperly encoded manual pages for their configuration. When man processes the requtested page, it will display the contents as configured, resulting in completely unreadable text if the on disk encoding is not what is expected for that configuration.

Disagreement about the expected encoding of manual pages amongst distribution vendors, has led to confusion for upstream package maintainers. One package may contain UTF-8 manual pages, while another ships with manual pages in legacy encodings. man searches for manual pages based on the user's locale settings. Man-DB uses a built-in table (see below) to determine the on disk encoding of manual pages found for a user's locale, only if the directories found do not have an extension that describes the encoding. E.g., because of ".UTF-8" in the directory name, Man-DB knows that all manual pages residing in /usr/share/man/fr.UTF-8 are UTF-8 encoded and, according to the built-in table, expects all manual pages residing in /usr/share/man/ru to be encoded using KOI8-R.

Table 6.1. Expected character encoding of legacy 8-bit manual pages

Language (code) Encoding
Danish (da) ISO-8859-1
German (de) ISO-8859-1
English (en) ISO-8859-1
Spanish (es) ISO-8859-1
Finnish (fi) ISO-8859-1
French (fr) ISO-8859-1
Irish (ga) ISO-8859-1
Galician (gl) ISO-8859-1
Indonesian (id) ISO-8859-1
Icelandic (is) ISO-8859-1
Italian (it) ISO-8859-1
Dutch (nl) ISO-8859-1
Norwegian (no) ISO-8859-1
Portuguese (pt) ISO-8859-1
Swedish (sv) ISO-8859-1
Bulgarian (bg) CP1251
Czech (cs) ISO-8859-2
Croatian (hr) ISO-8859-2
Hungarian (hu) ISO-8859-2
Japanese (ja) EUC-JP
Korean (ko) EUC-KR
Polish (pl) ISO-8859-2
Russian (ru) KOI8-R
Slovak (sk) ISO-8859-2
Serbian (sr) ISO-8859-5
Turkish (tr) ISO-8859-9
Simplified Chinese (zh_CN) GBK
Simplified Chinese, Singapore (zh_SG) GBK
Traditional Chinese (zh_TW) BIG5
Traditional Chinese, Hong Kong (zh_HK) BIG5HKSCS

[Note]

Note

Manual pages in languages not in the list are not supported. Norwegian does not work because of the transition from no_NO to nb_NO locale, and will be fixed in the next release of Man-DB. Korean is currently non functional because of incomplete fixes in the Debian Groff patch applied in LFS.

Packages may install manual pages into an improperly named directory, depending on which distributions the author develops the package for. To assist in the conversion of the manual pages to the proper encoding for the directory in which they are installed, the convert-mans script was written. It will convert manual pages to another encoding before (or after) installation. Install the convert-mans script with the following instructions:

cat >> convert-mans << "EOF"
#!/bin/sh -e
FROM="$1"
TO="$2"
shift ; shift
while [ $# -gt 0 ]
do
        FILE="$1"
        shift
        iconv -f "$FROM" -t "$TO" "$FILE" >.tmp.iconv
        mv .tmp.iconv "$FILE"
done
EOF
install -m755 convert-mans  /usr/bin

If upstream distributes the manual pages in a legacy encoding, the manual pages can simply be copied to /usr/share/man/<language code>. For example, German manual pages can be installed with the following commands:

mkdir -p /usr/share/man/de
cp -rv man? /usr/share/man/de

If upstream distributes manual pages in UTF-8 (i.e., “for RedHat”) instead of the encoding listed in the table above, they can either be converted from UTF-8 to the encoding listed in the table above, or they can be installed directly into /usr/share/man/<language code>.UTF-8.

For example, to install French manual pages in the legacy encoding, use the following commands:

convert-mans UTF-8 ISO-8859-1 man?/*.?
mkdir -p /usr/share/man/fr
cp -rv man? /usr/share/man/fr
[Note]

Note

The French manual pages ship with ready made scripts to do the same conversion. The above instructions are used only as an example for use of the convert-mans script.

Finally, as an example installation of UTF-8 manual pages, again, the French manual pages could be installed with the following commands:

mkdir -p /usr/share/man/fr.UTF-8
cp -rv man? /usr/share/man/fr.UTF-8

6.47.3. Contents of Man-DB

Installed programs: apropos, catman, convert-mans, lexgrog, man, mandb, manpath, whatis, and zsoelim

Short Descriptions

apropos

Searches the whatis database and displays the short descriptions of system commands that contain a given string

catman

Creates or updates the pre-formatted manual pages

convert-mans

Reformats manual pages into the chosen encoding.

lexgrog

Displays one-line summary information about a given manual page

man

Formats and displays the requested manual page

mandb

Creates or updates the whatis database

manpath

Displays the contents of $MANPATH or (if $MANPATH is not set) a suitable search path based on the settings in man.conf and the user's environment

whatis

Searches the whatis database and displays the short descriptions of system commands that contain the given keyword as a separate word

zsoelim

Reads files and replaces lines of the form .so file by the contents of the mentioned file