design: update
[gtk-doc.git] / gtkdoc-mkman.in
blobbc85d50a203e3702440b4a7b30b508435f3b0ae5
1 #!/bin/sh
4 usage="\
5 Usage: gtkdoc-mkman [--path=SEARCH_PATH] MODULE DRIVER_FILE"
7 # parse options, ignore unknown options for future extensions
9 searchpath=
10 uninstalled=no
11 while true; do
12 case "X$1" in
13 X--version) echo "@VERSION@"; exit 0;;
14 X--help) echo "$usage"; exit 0;;
15 X--uninstalled) uninstalled=yes; shift;;
16 X--path=*) searchpath=`echo $1 | sed s/.*=//`; shift;;
17 X--*) shift;;
18 X*) break;;
19 esac
20 done
22 if test $# -ne 2; then
23 echo "${usage}" 1>&2
24 exit 1
27 module=$1
28 shift
29 document=$1
30 shift
32 if test $uninstalled = yes; then
33 # this does not work from buiddir!=srcdir
34 gtkdocdir=`dirname $0`
35 #echo "uninstalled, gtkdocdir=$gtkdocdir"
36 else
37 # the first two are needed to resolve datadir
38 prefix=@prefix@
39 datarootdir=@datarootdir@
40 gtkdocdir=@datadir@/gtk-doc/data
43 if head -n 1 $document | grep "<?xml" > /dev/null; then
44 is_xml=true
45 path_option='--path'
46 else
47 is_xml=false
48 path_option='--directory'
51 # we could do "$path_option $PWD "
52 # to avoid needing rewriting entities that are copied from the header
53 # into docs under xml
54 if test "X$searchpath" = "X"; then
55 path_arg=
56 else
57 path_arg="$path_option $searchpath"
60 # would it make sens to create man pages only for certain refentries
61 # e.g. for tools
62 if $is_xml; then
63 # see http://bugzilla.gnome.org/show_bug.cgi?id=467488
64 @XSLTPROC@ $path_arg --nonet --xinclude \
65 --stringparam gtkdoc.bookname $module
66 --stringparam gtkdoc.version"@VERSION@" \
67 manpages/docbook.xsl $document || exit $?
68 else
69 for i in `cd sgml;ls *.sgml`; do
70 j=`echo $i | sed 's/.sgml/.man/'`
71 echo ": converting " $i $j
72 docbook-to-man sgml/$i > man/$j 2> man/$j.log
73 done