"Fossies" - the Fresh Open Source Software Archive

Member "libgd-2.3.2/docs/naturaldocs/run_docs.sh" (3 Mar 2021, 1571 Bytes) of package /linux/www/libgd-2.3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "run_docs.sh": 2.3.1_vs_2.3.2.

    1 #!/bin/sh
    2 
    3 set -e
    4 
    5 usage() {
    6     echo "Usage: run_docs.sh [--nonfatal]"
    7     echo "Generate the manual for gd!"
    8     if [ $# -ne 0 ] ; then
    9         printf 'ERROR: %b\n' "$*"
   10         exit 1
   11     else
   12         exit 0
   13     fi
   14 }
   15 
   16 nd() {
   17     # Figure out the name of this tool.
   18     if command -v naturaldocs ; then
   19         return
   20     elif command -v NaturalDocs ; then
   21         return
   22     else
   23         return 1
   24     fi
   25 }
   26 
   27 cd "$(dirname "$0")"
   28 
   29 if [ $# -eq 1 ] ; then
   30     case $1 in
   31     --nonfatal)
   32         if ! nd >/dev/null ; then
   33             echo "skipping doc generation -- please install naturaldoc!"
   34             exit 0
   35         fi
   36         ;;
   37     -h|--help)
   38         usage
   39         ;;
   40     *)
   41         usage "unknown option: $1"
   42         ;;
   43     esac
   44 elif [ $# -ne 0 ] ; then
   45     usage "unknown options: $*"
   46 fi
   47 
   48 # Dump the tool version info for debugging.
   49 echo "Found '$(nd)': $($(nd) -h | head -n1)"
   50 
   51 # Library version number.
   52 VERSION=$(cd ../../; perl config/getver.pl)
   53 
   54 # Clear away old docs and ensure the doc dir. is present.
   55 rm -rf html
   56 mkdir html
   57 
   58 # Create a lightly-processed copy of the source to use as input.  This
   59 # file skips all non-C code in src/ and removes the BGD_DECLARE()
   60 # macro from definitions so they don't show up in the docs.
   61 rm -rf tmp
   62 mkdir tmp
   63 perl nobgd.pl ../../src/ tmp/
   64 
   65 # Add the external docs.
   66 echo "Title: License" | cat - ../../COPYING > tmp/license.txt
   67 sed -e "s/@VERSION@/$VERSION/g" preamble.txt > tmp/preamble.txt
   68 # ^^^ hack to get the version number in the docs.
   69 
   70 # Run naturaldocs to create the manual.
   71 $(nd) --rebuild --rebuild-output --documented-only \
   72     -i tmp/ \
   73     -img images/ \
   74     -o html html  \
   75     --project project/ \
   76     -s Default libgd
   77 
   78 # And cleanup the temp files.
   79 rm -rf Data tmp