CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads
[xz/debian.git] / build-aux / manconv.sh
blob0f5ee0954699982372645a7e2b362a89dfc36bbe
1 #!/bin/sh
2 # SPDX-License-Identifier: 0BSD
4 ###############################################################################
6 # Wrapper for GNU groff to convert man pages to a few formats
8 # Usage: manconv.sh FORMAT [PAPER_SIZE] < in.1 > out.suffix
10 # FORMAT can be ascii, utf8, ps, or pdf. PAPER_SIZE can be anything that
11 # groff accepts, e.g. a4 or letter. See groff_font(5). PAPER_SIZE defaults
12 # to a4 and is used only when FORMAT is ps (PostScript) or pdf.
14 # Multiple man pages can be given at once e.g. to create a single PDF file
15 # with continuous page numbering.
17 ###############################################################################
19 # Author: Lasse Collin
21 ###############################################################################
23 FORMAT=$1
24 PAPER=${2-a4}
26 # Make PostScript and PDF output more readable:
27 # - Use 11 pt font instead of the default 10 pt.
28 # - Use larger paragraph spacing than the default 0.4v (man(7) only).
29 FONT=11
30 PD=0.8
32 SED_PD="
33 /^\\.TH /s/\$/\\
34 .PD $PD/
35 s/^\\.PD\$/.PD $PD/"
37 case $FORMAT in
38 ascii)
39 groff -t -mandoc -Tascii -P-c | col -bx
41 utf8)
42 groff -t -mandoc -Tutf8 -P-c | col -bx
44 ps)
45 sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
46 -rC1 -rS$FONT -Tps -P-p$PAPER
48 pdf)
49 sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
50 -rC1 -rS$FONT -Tps -P-p$PAPER | ps2pdf - -
53 echo 'Invalid arguments' >&2
54 exit 1
56 esac