docs: clean up a bit and support `NaturalDocs`
Some installs use `NaturalDocs` instead of `naturaldocs`, so add support for either form.master
parent
c9a4a85f38
commit
e6bf7714d7
13
bootstrap.sh
13
bootstrap.sh
|
@ -2,24 +2,19 @@
|
|||
# $Id$
|
||||
# Small shell script to build gd from source
|
||||
|
||||
v() { echo "$@"; "$@"; }
|
||||
|
||||
# Generate the manual (unless naturaldocs isn't installed). Source
|
||||
# dists should include the docs so that end users don't need to
|
||||
# install naturaldocs. At the same time, we tolerate it being missing
|
||||
# so that random hackers don't need it just to build the code.
|
||||
if which naturaldocs >/dev/null 2>&1 ; then
|
||||
echo "Generation user docs:"
|
||||
(cd docs/naturaldocs; bash run_docs.sh)
|
||||
else
|
||||
echo "Can't find naturaldocs; not generating user manual."
|
||||
fi
|
||||
|
||||
v docs/naturaldocs/run_docs.sh --nonfatal
|
||||
|
||||
if echo "${OSTYPE:-$(uname)}" | grep -q '^darwin' ; then
|
||||
echo "Having trouble on OS X? Try: brew install autoconf libtool automake gettext apple-gcc42 pkg-config cmake"
|
||||
fi
|
||||
|
||||
echo "autoreconf -f -i"
|
||||
if ! autoreconf -f -i ; then
|
||||
if ! v autoreconf -f -i ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,18 +1,61 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "Usage: run_docs.sh [--nonfatal]"
|
||||
echo "Generate the manual for gd!"
|
||||
if [ $# -ne 0 ] ; then
|
||||
printf 'ERROR: %b\n' "$*"
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
nd() {
|
||||
# Figure out the name of this tool.
|
||||
if which naturaldocs 2>/dev/null ; then
|
||||
return
|
||||
elif which NaturalDocs 2>/dev/null ; then
|
||||
return
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ $# -eq 1 ] ; then
|
||||
case $1 in
|
||||
--nonfatal)
|
||||
if ! nd >/dev/null ; then
|
||||
echo "skipping doc generation -- please install naturaldoc!"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
usage "unknown option: $1"
|
||||
;;
|
||||
esac
|
||||
elif [ $# -ne 0 ] ; then
|
||||
usage "unknown options: $*"
|
||||
fi
|
||||
|
||||
# Version number
|
||||
VERSION=`(cd ../../; perl config/getver.pl)`
|
||||
|
||||
# Clear away old docs and ensure the doc dir. is present.
|
||||
[ -d html ] && rm -rf html
|
||||
rm -rf html
|
||||
mkdir html
|
||||
|
||||
# Create a lightly-processed copy of the source to use as input. This
|
||||
# file skips all non-C code in src/ and removes the BGD_DECLARE()
|
||||
# macro from definitions so they don't show up in the docs.
|
||||
[ -d tmp ] && rm -rf tmp
|
||||
rm -rf tmp
|
||||
mkdir tmp
|
||||
perl nobgd.pl ../../src/ tmp/
|
||||
|
||||
|
@ -22,7 +65,7 @@ sed -e "s/@VERSION@/$VERSION/g" preamble.txt > tmp/preamble.txt
|
|||
# ^^^ hack to get the version number in the docs.
|
||||
|
||||
# Run naturaldocs to create the manual.
|
||||
naturaldocs --rebuild --rebuild-output --documented-only \
|
||||
$(nd) --rebuild --rebuild-output --documented-only \
|
||||
-i tmp/ \
|
||||
-o html html \
|
||||
--project project/
|
||||
|
|
Loading…
Reference in New Issue