asciidoc-helper.sh 1.9 KB

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