ldb: make ldb a top level library for Samba 4.0
[ira/wip.git] / lib / ldb / docs / builddocs.sh
1 #!/bin/sh
2 # build ldb docs
3 # tridge@samba.org August 2006
4
5 XSLTPROC="$1"
6 SRCDIR="$2"
7
8 if [ -z "$XSLTPROC" ] || [ ! -x "$XSLTPROC" ]; then
9     echo "xsltproc not installed"
10     exit 0
11 fi
12
13 MANXSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
14 HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"
15
16 mkdir -p man
17
18 for f in $SRCDIR/man/*.xml; do
19     base=`basename $f .xml`
20     out=man/"`basename $base`"
21     if [ ! -f "$out" ] || [ "$f" -nt "$out" ]; then
22         echo Processing manpage $f
23         $XSLTPROC --nonet -o "$out" "$MANXSL" $f
24         ret=$?
25         if [ "$ret" = "4" ]; then
26             echo "ignoring stylesheet error 4 for $MANXSL"
27             exit 0
28         fi
29         if [ "$ret" != "0" ]; then
30             echo "xsltproc failed with error $ret"
31             exit $ret
32         fi
33     fi
34 done
35
36 for f in $SRCDIR/man/*.xml; do
37     base=`basename $f .xml`
38     out=man/"`basename $base`".html
39     if [ ! -f "$out" ] || [ "$f" -nt "$out" ]; then
40         echo Processing html $f
41         $XSLTPROC --nonet -o "$out" "$HTMLXSL" $f
42         ret=$?
43         if [ "$ret" = "4" ]; then
44             echo "ignoring stylesheet error 4 for $HTMLXSL"
45             exit 0
46         fi
47         if [ "$ret" != "0" ]; then
48             echo "xsltproc failed with error $ret"
49             exit $ret
50         fi
51     fi
52 done