Improve support for OBJDIR

This copies the Gtk-Doc files required from the source tree into OBJDIR.
This commit is contained in:
Pierre Pronchery 2020-01-13 07:50:36 +01:00
parent 5ff861bfd3
commit 92da12a0c4

View File

@ -60,6 +60,48 @@ _error()
} }
#gtkdoc_mkdb
_gtkdoc_mkdb()
{
module="$1"
sourcedir="$2"
outputdir="$3"
(cd "$sourcedir" &&
$DEBUG $GTKDOC_MKDB --module="$module" \
--output-dir="$outputdir" \
--output-format="xml" --tmpl-dir="tmpl")
}
#gtkdoc_mktmpl
_gtkdoc_mktmpl()
{
module="$1"
sourcedir="$2"
outputdir="$3"
(cd "$sourcedir" &&
$DEBUG $GTKDOC_MKTMPL --module="$module" \
--output-dir="$outputdir")
}
#gtkdoc_scan
_gtkdoc_scan()
{
module="$1"
sourcedir="$2"
outputdir="$3"
(cd ".." &&
$DEBUG $GTKDOC_SCAN --module="$module" \
--source-dir="$sourcedir" \
--output-dir="$outputdir")
# --rebuild-types
}
#usage #usage
_usage() _usage()
{ {
@ -135,17 +177,16 @@ while [ $# -gt 0 ]; do
#create #create
case "$target" in case "$target" in
gtkdoc/html.stamp) gtkdoc/html.stamp)
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" output="${OBJDIR}gtkdoc/html"
$DEBUG $MKDIR -- "$output" || exit 2 $DEBUG $MKDIR -- "$output" || exit 2
driver="$MODULE-docs.xml"
if [ -n "$OBJDIR" ]; then
$DEBUG $CP -- "gtkdoc/$driver" "${OBJDIR}gtkdoc" \
|| exit 2
fi
(cd "$output" && (cd "$output" &&
$DEBUG $GTKDOC_MKHTML "$MODULE" \ $DEBUG $GTKDOC_MKHTML "$MODULE" \
"${OBJDIR}$driver") "../$driver")
#detect when gtk-doc is not available #detect when gtk-doc is not available
res=$? res=$?
if [ $res -eq 127 ]; then if [ $res -eq 127 ]; then
@ -168,23 +209,20 @@ while [ $# -gt 0 ]; do
output="${OBJDIR}gtkdoc/tmpl" output="${OBJDIR}gtkdoc/tmpl"
$DEBUG $MKDIR -- "$output" || exit 2 $DEBUG $MKDIR -- "$output" || exit 2
fi fi
(cd "${OBJDIR}gtkdoc" && _gtkdoc_mktmpl "$MODULE" "${OBJDIR}gtkdoc" "$output"
$DEBUG $GTKDOC_MKTMPL \
--module="$MODULE" \
--output-dir="$output")
;; ;;
gtkdoc/xml.stamp) gtkdoc/xml.stamp)
output="xml" output="xml"
if [ -n "$OBJDIR" ]; then if [ -n "$OBJDIR" ]; then
output="${OBJDIR}gtkdoc"
sections="gtkdoc/$MODULE-sections.txt"
$DEBUG $MKDIR -- "$output/xml" || exit 2
$DEBUG $CP -- "$sections" "$output" \
|| exit 2
_gtkdoc_scan "$MODULE" "include" "$output"
output="${OBJDIR}gtkdoc/xml" output="${OBJDIR}gtkdoc/xml"
$DEBUG $MKDIR -- "$output" || exit 2
fi fi
(cd "${OBJDIR}gtkdoc" && _gtkdoc_mkdb "$MODULE" "${OBJDIR}gtkdoc" "$output"
$DEBUG $GTKDOC_MKDB \
--module="$MODULE" \
--output-dir="$output" \
--output-format="xml" \
--tmpl-dir="tmpl")
;; ;;
gtkdoc/*.types) gtkdoc/*.types)
output="$PWD/gtkdoc" || exit 2 output="$PWD/gtkdoc" || exit 2
@ -192,11 +230,7 @@ while [ $# -gt 0 ]; do
output="${OBJDIR}gtkdoc" output="${OBJDIR}gtkdoc"
$DEBUG $MKDIR -- "$output" || exit 2 $DEBUG $MKDIR -- "$output" || exit 2
fi fi
(cd ".." && _gtkdoc_scan "$MODULE" "include" "$output"
$DEBUG $GTKDOC_SCAN \
--module="$MODULE" \
--source-dir="include" \
--output-dir="$output")
;; ;;
*) *)
_error "$target: Unknown type" _error "$target: Unknown type"