Newer version of the script upstream

This commit is contained in:
Pierre Pronchery 2014-11-12 21:36:56 +01:00
parent 2e1aae5813
commit 729521b47d

View File

@ -26,8 +26,9 @@
#variables #variables
PREFIX="/usr/local" PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh" PROGNAME="gtkdoc.sh"
#executables #executables
CP="cp"
DEBUG="_debug" DEBUG="_debug"
GTKDOC_FIXXREF="gtkdoc-fixxref" GTKDOC_FIXXREF="gtkdoc-fixxref"
GTKDOC_MKDB="gtkdoc-mkdb" GTKDOC_MKDB="gtkdoc-mkdb"
@ -39,6 +40,8 @@ MKDIR="mkdir -m 0755 -p"
RM="rm -f" RM="rm -f"
TOUCH="touch" TOUCH="touch"
[ -f "../config.sh" ] && . "../config.sh"
#functions #functions
#debug #debug
@ -52,7 +55,7 @@ _debug()
#error #error
_error() _error()
{ {
echo "gtkdoc.sh: $@" 1>&2 echo "$PROGNAME: $@" 1>&2
return 2 return 2
} }
@ -60,7 +63,7 @@ _error()
#usage #usage
_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 return 1
} }
@ -109,6 +112,7 @@ instdir="$DATADIR/gtk-doc/html"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
target="${target#$OBJDIR}"
shift shift
#clean #clean
@ -116,10 +120,10 @@ while [ $# -gt 0 ]; do
#uninstall #uninstall
if [ "$uninstall" -eq 1 ]; then if [ "$uninstall" -eq 1 ]; then
for i in gtkdoc/html/*.*; do for i in "${OBJDIR}gtkdoc/html/"*.*; do
[ -f "$i" ] || continue [ -f "$i" ] || continue
file="${i##*/}" file="${i##*/}"
$DEBUG $RM "$instdir/$MODULE/$file" || exit 2 $DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2
done done
continue continue
fi fi
@ -127,45 +131,68 @@ while [ $# -gt 0 ]; do
#create #create
case "$target" in case "$target" in
gtkdoc/html.stamp) gtkdoc/html.stamp)
$MKDIR "gtkdoc/html" && driver="../$MODULE-docs.xml"
(cd "gtkdoc/html" && 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" \ $DEBUG $GTKDOC_MKHTML "$MODULE" \
"../$MODULE-docs.xml") && "${OBJDIR}$driver") || exit 2
(cd "gtkdoc" && output="${OBJDIR}gtkdoc"
(cd "$output" &&
$DEBUG $GTKDOC_FIXXREF \ $DEBUG $GTKDOC_FIXXREF \
--module="$MODULE" \ --module="$MODULE" \
--module-dir="html" \ --module-dir="html" \
--html-dir="$instdir") --html-dir="$instdir") || exit 2
;; ;;
gtkdoc/sgml.stamp) 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 \ $DEBUG $GTKDOC_MKDB \
--module="$MODULE" \ --module="$MODULE" \
--output-dir="xml" \ --output-dir="$output" \
--output-format="xml" \ --output-format="xml" \
--tmpl-dir="tmpl") --tmpl-dir="tmpl")
;; ;;
gtkdoc/tmpl.stamp) 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 \ $DEBUG $GTKDOC_MKTMPL \
--module="$MODULE" \ --module="$MODULE" \
--output-dir="tmpl") --output-dir="$output")
;; ;;
gtkdoc/*.types) gtkdoc/*.types)
output="doc/gtkdoc" || exit 2
if [ -n "$OBJDIR" ]; then
output="${OBJDIR}gtkdoc"
$DEBUG $MKDIR -- "$output" || exit 2
fi
(cd ".." && (cd ".." &&
$DEBUG $GTKDOC_SCAN \ $DEBUG $GTKDOC_SCAN \
--module="$MODULE" \ --module="$MODULE" \
--source-dir="include" \ --source-dir="include" \
--output-dir="doc/gtkdoc") --output-dir="$output")
;; ;;
*) *)
echo "$0: $target: Unknown type" 1>&2 _error "$target: Unknown type"
exit 2 exit $?
;; ;;
esac esac
#XXX ignore errors #XXX ignore errors
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "$0: $target: Could not create documentation" 1>&2 _error "$target: Could not create documentation"
install=0 install=0
fi fi
$TOUCH "$target" $TOUCH "$target"
@ -173,7 +200,7 @@ while [ $# -gt 0 ]; do
#install #install
if [ "$install" -eq 1 ]; then if [ "$install" -eq 1 ]; then
$DEBUG $MKDIR "$instdir/$MODULE" || exit 2 $DEBUG $MKDIR "$instdir/$MODULE" || exit 2
for i in gtkdoc/html/*.*; do for i in "${OBJDIR}gtkdoc/html/"*.*; do
[ -f "$i" ] || continue [ -f "$i" ] || continue
file="${i##*/}" file="${i##*/}"
$DEBUG $INSTALL "$i" "$instdir/$MODULE/$file" \ $DEBUG $INSTALL "$i" "$instdir/$MODULE/$file" \