doc: Introduce XML catalog

This adds a nice way of loading the DTD files based on the identifier
in the DOCTYPE declaration, no matter where the DTDs are installed.
See also ‘XML catalog’ Wikipedia entry and update-xmlcatalog(8).
This commit is contained in:
Jan Tojnar 2021-02-11 06:00:45 +01:00 committed by Simon McVittie
parent 7488756a0c
commit 2ac9a348f0
3 changed files with 30 additions and 1 deletions

View File

@ -224,12 +224,22 @@ set(DOC_DATA
install(FILES ${DOC_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)
set(DBUS_DTD_DIR "${CMAKE_INSTALL_DATADIR}/xml/dbus-1" CACHE STRING "Directory for installing DTD files")
set(DBUS_XML_CATALOG_DIR "${DBUS_DTD_DIR}" CACHE STRING "Directory for installing XML catalog file")
set(EXTRA_DIST
busconfig.dtd
introspect.dtd
introspect.xsl
)
install(FILES ${EXTRA_DIST} DESTINATION ${CMAKE_INSTALL_DATADIR}/xml/dbus-1)
install(FILES ${EXTRA_DIST} DESTINATION ${DBUS_DTD_DIR})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/catalog.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/catalog.xml"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/catalog.xml" DESTINATION ${DBUS_XML_CATALOG_DIR})
endif()

View File

@ -25,6 +25,14 @@ dist_dtd_DATA = \
busconfig.dtd \
introspect.dtd
xmlcatalogdir = $(dtddir)
catalog.xml: catalog.xml.in
$(SED) "s|@DBUS_DTD_DIR@|$(dtddir)|" $< >$@
dist_xmlcatalog_DATA = \
catalog.xml
dist_doc_DATA = system-activation.txt
# uploaded and distributed, but not installed
@ -38,6 +46,7 @@ STATIC_DOCS = \
introspect.xsl
EXTRA_DIST = \
catalog.xml.in \
file-boilerplate.c \
doxygen_to_devhelp.xsl \
$(STATIC_DOCS)

10
doc/catalog.xml.in Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
<public publicId="-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" uri="@DBUS_DTD_DIR@/introspect.dtd"/>
<system systemId="http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" uri="@DBUS_DTD_DIR@/introspect.dtd"/>
<public publicId="-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" uri="@DBUS_DTD_DIR@/busconfig.dtd"/>
<system systemId="http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd" uri="@DBUS_DTD_DIR@/busconfig.dtd"/>
</catalog>