From 729521b47d2feddde5957e52668d5bb567ba0adf Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 12 Nov 2014 21:36:56 +0100 Subject: [PATCH] Newer version of the script upstream --- doc/gtkdoc.sh | 65 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/doc/gtkdoc.sh b/doc/gtkdoc.sh index 34ecae5..aab0685 100755 --- a/doc/gtkdoc.sh +++ b/doc/gtkdoc.sh @@ -26,8 +26,9 @@ #variables PREFIX="/usr/local" -[ -f "../config.sh" ] && . "../config.sh" +PROGNAME="gtkdoc.sh" #executables +CP="cp" DEBUG="_debug" GTKDOC_FIXXREF="gtkdoc-fixxref" GTKDOC_MKDB="gtkdoc-mkdb" @@ -39,6 +40,8 @@ MKDIR="mkdir -m 0755 -p" RM="rm -f" TOUCH="touch" +[ -f "../config.sh" ] && . "../config.sh" + #functions #debug @@ -52,7 +55,7 @@ _debug() #error _error() { - echo "gtkdoc.sh: $@" 1>&2 + echo "$PROGNAME: $@" 1>&2 return 2 } @@ -60,7 +63,7 @@ _error() #usage _usage() { - echo "Usage: gtkdoc.sh [-c|-i|-u][-P prefix] target..." 1>&2 + echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2 return 1 } @@ -109,6 +112,7 @@ instdir="$DATADIR/gtk-doc/html" while [ $# -gt 0 ]; do target="$1" + target="${target#$OBJDIR}" shift #clean @@ -116,10 +120,10 @@ while [ $# -gt 0 ]; do #uninstall if [ "$uninstall" -eq 1 ]; then - for i in gtkdoc/html/*.*; do + for i in "${OBJDIR}gtkdoc/html/"*.*; do [ -f "$i" ] || continue file="${i##*/}" - $DEBUG $RM "$instdir/$MODULE/$file" || exit 2 + $DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2 done continue fi @@ -127,45 +131,68 @@ while [ $# -gt 0 ]; do #create case "$target" in gtkdoc/html.stamp) - $MKDIR "gtkdoc/html" && - (cd "gtkdoc/html" && + driver="../$MODULE-docs.xml" + if [ -n "$OBJDIR" ]; then + driver="gtkdoc/$MODULE-docs.xml" + $DEBUG $CP -- "$driver" "${OBJDIR}gtkdoc" \ + || exit 2 + fi + output="${OBJDIR}gtkdoc/html" + $DEBUG $MKDIR -- "$output" || exit 2 + (cd "$output" && $DEBUG $GTKDOC_MKHTML "$MODULE" \ - "../$MODULE-docs.xml") && - (cd "gtkdoc" && + "${OBJDIR}$driver") || exit 2 + output="${OBJDIR}gtkdoc" + (cd "$output" && $DEBUG $GTKDOC_FIXXREF \ --module="$MODULE" \ --module-dir="html" \ - --html-dir="$instdir") + --html-dir="$instdir") || exit 2 ;; gtkdoc/sgml.stamp) - (cd "gtkdoc" && + output="xml" + if [ -n "$OBJDIR" ]; then + output="${OBJDIR}gtkdoc/xml" + $DEBUG $MKDIR -- "$output" || exit 2 + fi + (cd "${OBJDIR}gtkdoc" && $DEBUG $GTKDOC_MKDB \ --module="$MODULE" \ - --output-dir="xml" \ + --output-dir="$output" \ --output-format="xml" \ --tmpl-dir="tmpl") ;; gtkdoc/tmpl.stamp) - (cd "gtkdoc" && + output="tmpl" + if [ -n "$OBJDIR" ]; then + output="${OBJDIR}gtkdoc/tmpl" + $DEBUG $MKDIR -- "$output" || exit 2 + fi + (cd "${OBJDIR}gtkdoc" && $DEBUG $GTKDOC_MKTMPL \ --module="$MODULE" \ - --output-dir="tmpl") + --output-dir="$output") ;; gtkdoc/*.types) + output="doc/gtkdoc" || exit 2 + if [ -n "$OBJDIR" ]; then + output="${OBJDIR}gtkdoc" + $DEBUG $MKDIR -- "$output" || exit 2 + fi (cd ".." && $DEBUG $GTKDOC_SCAN \ --module="$MODULE" \ --source-dir="include" \ - --output-dir="doc/gtkdoc") + --output-dir="$output") ;; *) - echo "$0: $target: Unknown type" 1>&2 - exit 2 + _error "$target: Unknown type" + exit $? ;; esac #XXX ignore errors if [ $? -ne 0 ]; then - echo "$0: $target: Could not create documentation" 1>&2 + _error "$target: Could not create documentation" install=0 fi $TOUCH "$target" @@ -173,7 +200,7 @@ while [ $# -gt 0 ]; do #install if [ "$install" -eq 1 ]; then $DEBUG $MKDIR "$instdir/$MODULE" || exit 2 - for i in gtkdoc/html/*.*; do + for i in "${OBJDIR}gtkdoc/html/"*.*; do [ -f "$i" ] || continue file="${i##*/}" $DEBUG $INSTALL "$i" "$instdir/$MODULE/$file" \