Updated Swedish translation
[gtk-doc.git] / gtkdoc-mkman.in
blobb6e91a5855dba17d714e6abd96bc46b621916e0a
1 #!/bin/sh
4 usage() {
5 cat <<EOF
6 gtkdoc-mkman version @VERSION@ - generate documentation in man format
8 --verbose Print extra output while processing
9 --path=SEARCH_PATH Extra source directories
10 MODULE Name of the doc module being parsed
11 DRIVER_FILE File containing the toplevel DocBook file.
12 --version Print the version of this program
13 --help Print this help
14 EOF
17 # parse options, ignore unknown options for future extensions
19 verbose=0
20 searchpath=
21 uninstalled=no
22 while true; do
23 case "X$1" in
24 X--version) echo "@VERSION@"; exit 0;;
25 X--help) usage; exit 0;;
26 X--uninstalled) uninstalled=yes; shift;;
27 X--verbose) verbose="1"; shift;;
28 X--path=*) searchpath=`echo $1 | sed s/.*=//`; shift;;
29 X--*) shift;;
30 X*) break;;
31 esac
32 done
34 if test $# -ne 2; then
35 usage 1>&2
36 exit 1
39 module=$1
40 shift
41 document=$1
42 shift
44 quiet="1"
45 if test $verbose = "1"; then
46 quiet="0"
49 if test $uninstalled = yes; then
50 # this does not work from buiddir!=srcdir
51 gtkdocdir=`dirname $0`
52 #echo "uninstalled, gtkdocdir=$gtkdocdir"
53 else
54 # the first two are needed to resolve datadir
55 prefix=@prefix@
56 datarootdir=@datarootdir@
57 gtkdocdir=@datadir@/gtk-doc/data
60 if head -n 1 $document | grep "<?xml" > /dev/null; then
61 is_xml=true
62 path_option='--path'
63 else
64 is_xml=false
65 path_option='--directory'
68 # we could do "$path_option $PWD "
69 # to avoid needing rewriting entities that are copied from the header
70 # into docs under xml
71 if test "X$searchpath" = "X"; then
72 path_arg=
73 else
74 path_arg="$path_option $searchpath"
77 # would it make sens to create man pages only for certain refentries
78 # e.g. for tools
79 if $is_xml; then
80 # see http://bugzilla.gnome.org/show_bug.cgi?id=467488
81 @XSLTPROC@ $path_arg --nonet --xinclude \
82 --stringparam gtkdoc.bookname $module \
83 --stringparam gtkdoc.version "@VERSION@" \
84 --stringparam chunk.quietly $quiet \
85 --stringparam chunker.output.quiet $quiet \
86 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \
87 $document || exit $?
88 else
89 for i in `cd sgml;ls *.sgml`; do
90 j=`echo $i | sed 's/.sgml/.man/'`
91 echo ": converting " $i $j
92 docbook-to-man sgml/$i > man/$j 2> man/$j.log
93 done