Browse Source

CMake: Discover docbook stylesheet in other locations

Distributions seem to install this stuff all over the place, so
let's add a common list of paths we know about.
tags/devuan/2.0.1+devuan1
Julian Andres Klode 4 years ago
parent
commit
9fb81c6e54
4 changed files with 34 additions and 6 deletions
  1. +31
    -3
      CMake/Documentation.cmake
  2. +1
    -1
      doc/docbook-html-style.xsl.cmake.in
  3. +1
    -1
      doc/docbook-text-style.xsl.cmake.in
  4. +1
    -1
      doc/manpage-style.xsl.cmake.in

+ 31
- 3
CMake/Documentation.cmake View File

@@ -24,6 +24,34 @@
# SOFTWARE.


find_path(DOCBOOK_XSL manpages/docbook.xsl
# Debian
/usr/share/xml/docbook/stylesheet/docbook-xsl
/usr/share/xml/docbook/stylesheet/nwalsh
# OpenSUSE
/usr/share/xml/docbook/stylesheet/nwalsh/current
# Arch
/usr/share/xml/docbook/xsl-stylesheets
# Fedora
/usr/share/sgml/docbook/xsl-stylesheets
# Fink
${CMAKE_INSTALL_PREFIX}/share/xml/xsl/docbook-xsl
# FreeBSD
${CMAKE_INSTALL_PREFIX}/share/xsl/docbook/
NO_DEFAULT_PATH)

if(NOT DOCBOOK_XSL)
message(FATAL_ERROR "Could not find docbook xsl")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docbook-text-style.xsl.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/docbook-text-style.xsl)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/docbook-html-style.xsl)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/manpage-style.xsl)


# Split up a string of the form DOCUMENT[.DOCUMENT][.LANGUAGE][.SECTION].EXTENSION
#
# There might be up to two parts in the document name. The language must be
@@ -123,7 +151,7 @@ function(xsltproc_one)
else()
set(manpage_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.${section}")
endif()
set(manpage_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl")
set(manpage_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/manpage-style.xsl")
set(manpage_params)

install(FILES ${manpage_output}
@@ -137,7 +165,7 @@ function(xsltproc_one)
set(html_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.html")
endif()
set(html_params --stringparam base.dir ${html_output})
set(html_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl")
set(html_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/docbook-html-style.xsl")
install(DIRECTORY ${html_output}
DESTINATION ${DOC_INSTALL}
OPTIONAL)
@@ -150,7 +178,7 @@ function(xsltproc_one)
set(text_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.text")
endif()
set(text_params --stringparam base.dir ${text_output})
set(text_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/docbook-text-style.xsl")
set(text_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/docbook-text-style.xsl")

file(RELATIVE_PATH text_output_relative ${CMAKE_CURRENT_BINARY_DIR} ${text_output})



doc/docbook-html-style.xsl → doc/docbook-html-style.xsl.cmake.in View File

@@ -2,7 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- Import our base stylesheet -->
<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml-1_1/chunk.xsl" />
<xsl:import href="@DOCBOOK_XSL@/xhtml-1_1/chunk.xsl" />

<!-- Since we use xsltproc (not saxon), add a workaround to ensure UTF-8 -->
<xsl:template xmlns="http://www.w3.org/1999/xhtml" name="head.content.generator">

doc/docbook-text-style.xsl → doc/docbook-text-style.xsl.cmake.in View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml-1_1/docbook.xsl" />
<xsl:import href="@DOCBOOK_XSL@/xhtml-1_1/docbook.xsl" />

<!-- Parameters for optimal text output. -->
<xsl:param name="callout.graphics" select="0"/>

doc/manpage-style.xsl → doc/manpage-style.xsl.cmake.in View File

@@ -2,7 +2,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl" />
<xsl:import href="@DOCBOOK_XSL@/manpages/docbook.xsl" />

<xsl:param name="man.output.encoding" select="'UTF-8'" />


Loading…
Cancel
Save