xsl: also hardcode "en" in gentext.template to get another big speedup
[gtk-doc.git] / gtkdoc-mkpdf.in
bloba3087f3dbb3447b1880b83badb378a68335c9b64
1 #!/bin/sh
4 usage="\
5 Usage: gtkdoc-mkpdf [--path=SEARCH_PATH] [--imgdir=DIR] MODULE DRIVER_FILE [BACKEND_OPTIONS...]"
7 #echo "args $0\n";
9 cleanexit() {
10 rm -f $module.fo
11 exit $1
14 # parse options, ignore unknown options for future extensions
16 searchpath=
17 uninstalled=no
18 imgdirs=
19 while true; do
20 case "X$1" in
21 X--version) echo "@VERSION@"; exit 0;;
22 X--help) echo "$usage"; exit 0;;
23 X--uninstalled) uninstalled=yes; shift;;
24 X--path=*) searchpath=`echo $1 | sed s/.*=//`; shift;;
25 X--imgdir=*) imgdirs="$imgdirs -I `echo $1 | sed s/.*=//`"; shift;;
26 X--*) shift;;
27 X*) break;;
28 esac
29 done
31 if test $# -lt 2; then
32 echo "${usage}" 1>&2
33 exit 1
36 module=$1
37 shift
38 document=$1
39 shift
41 if test $uninstalled = yes; then
42 # this does not work from buiddir!=srcdir
43 # we could try this
44 # MAKE_SCRDIR=$(abs_srcdir) MAKE_BUILDDIR=$(abs_builddir) gtkdoc-mkpdf ...
45 gtkdocdir=`dirname $0`
46 #echo "uninstalled, gtkdocdir=$gtkdocdir"
47 else
48 # the first two are needed to resolve datadir
49 prefix=@prefix@
50 datarootdir=@datarootdir@
51 gtkdocdir=@datadir@/gtk-doc/data
54 if head -n 1 $document | grep "<?xml" > /dev/null; then
55 is_xml=true
56 path_option='--path'
57 else
58 is_xml=false
59 path_option='--directory'
62 # we could do "$path_option $PWD "
63 # to avoid needing rewriting entities that are copied from the header
64 # into docs under xml
65 if test "X$searchpath" = "X"; then
66 path_arg=
67 else
68 path_arg="$path_option $searchpath"
71 if $is_xml; then
72 if test -n "@DBLATEX@"; then
73 # extra options to consider
74 # -I FIG_PATH
75 # -V is useful for debugging
76 # -T db2latex : different style
77 # -d : keep transient files (for debugging)
78 # xsltproc is already called with --xinclude
79 # does not work: --xslt-opts "$path_arg --nonet $@"
80 #echo "calling: @DBLATEX@ -o $module.pdf $imgdirs $document"
81 @DBLATEX@ -o $module.pdf $imgdirs $document
82 else
83 if test -n "@FOP@"; then
84 @XSLTPROC@ $path_arg --nonet --xinclude \
85 --stringparam gtkdoc.bookname $module \
86 --stringparam gtkdoc.version "@VERSION@" \
87 "$@" -o $module.fo $gtkdocdir/gtk-doc-fo.xsl $document || cleanexit $?
88 # fop dies too easily :(
89 # @FOP@ $module.fo $module.pdf
92 else
93 # not very good output
94 # also for xxx-docs.sgml it will produce xxx-docs.pdf
95 docbook2pdf -e no-valid $document
98 echo "timestamp" > pdf.stamp
99 cleanexit 0