]> git.saurik.com Git - apt.git/blobdiff - CMake/Documentation.cmake
This is 2016 and APT already requires use of mmap.
[apt.git] / CMake / Documentation.cmake
index 9e7135ea4a7c1568f1178aca7bfda45c6067c305..f3bbfdc6b857dbba0c16895f65c861f79ab80d4c 100644 (file)
 # 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
@@ -75,7 +103,7 @@ function(po4a_one stamp_out out full_document language deps)
         OUTPUT ${stamp}
         COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${language}
         COMMAND po4a --previous --no-backups
-                     --package-name='${PROJECT}-doc'
+                     --package-name='${PROJECT_NAME}-doc'
                      --package-version='${PACKAGE_VERSION}'
                      --msgid-bugs-address='${PACKAGE_MAIL}'
                      --translate-only ${dest}.${ext}
@@ -123,7 +151,8 @@ 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}
                 DESTINATION ${CMAKE_INSTALL_MANDIR}/${language}/man${section}
@@ -136,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)
@@ -149,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})
 
@@ -221,6 +250,7 @@ endfunction()
 function(add_docbook target)
     set(generated "")
     set(options HTML TEXT MANPAGE ALL)
+    set(oneValueArgs)
     set(multiValueArgs INSTALL DOCUMENTS LINGUAS DEPENDS)
     cmake_parse_arguments(DOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})