asciidoc-helper.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. echo "==================================";
  44. echo;
  45. echo "a2x is installed, but some required docbook support files are";
  46. echo "missing. Please install docbook-xsl, docbook-xml, and";
  47. echo "libxml2-utils (Debian) or similar.";
  48. echo;
  49. echo "==================================";
  50. exit 1;
  51. fi
  52. fi