fold in last changes file
[tor.git] / doc / asciidoc-helper.sh
blobdd420f7c4f6fe4145f97087eeed55ee1a683384e
1 #!/bin/sh
3 # Copyright (c) The Tor Project, Inc.
4 # See LICENSE for licensing information
5 # Run this to generate .html.in or .1.in files from asciidoc files.
6 # Arguments:
7 # html|man asciidocpath outputfile
9 set -e
11 if [ $# != 3 ]; then
12 exit 1;
15 output=$3
17 if [ "$1" = "html" ]; then
18 input=${output%%.html.in}.1.txt
19 base=${output%%.html.in}
21 if [ "$2" != none ]; then
22 "$2" -d manpage -o $output $input;
23 else
24 echo "==================================";
25 echo;
26 echo "You need asciidoc installed to be able to build the manpage.";
27 echo "To build without manpages, use the --disable-asciidoc argument";
28 echo "when calling configure.";
29 echo;
30 echo "==================================";
31 exit 1;
33 elif [ "$1" = "man" ]; then
34 input=${output%%.1.in}.1.txt
35 base=${output%%.1.in}
37 if test "$2" = none; then
38 echo "==================================";
39 echo;
40 echo "You need asciidoc installed to be able to build the manpage.";
41 echo "To build without manpages, use the --disable-asciidoc argument";
42 echo "when calling configure.";
43 echo;
44 echo "==================================";
45 exit 1;
47 if "$2" -f manpage $input; then
48 mv $base.1 $output;
49 else
50 cat<<EOF
51 ==================================
52 You need a working asciidoc installed to be able to build the manpage.
54 a2x is installed, but for some reason it isn't working. Sometimes
55 This happens because required docbook support files are missing.
56 Please install docbook-xsl, docbook-xml, and libxml2-utils (Debian) or
57 similar. If you use homebrew on Mac OS X, install the docbook formula
58 and add "export XML_CATALOG_FILES=/usr/local/etc/xml/catalog" to your
59 .bashrc
61 Alternatively, to build without manpages, use the --disable-asciidoc
62 argument when calling configure.
63 ==================================
64 EOF
65 exit 1;