asciidoc-helper.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.
  50. Alternatively, to build without manpages, use the --disable-asciidoc
  51. argument when calling configure.
  52. ==================================
  53. EOF
  54. exit 1;
  55. fi
  56. fi