Subject: [PATCH] Re: bug#33497: Our CMake package has no documentation

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 25 Nov 2018 01:54:55 -0500

Maxim Cournoyer <[email-masked]> writes:

> Hello,
>
> Our CMake package lacks any documentation (manpage or other). Patch to
> follow.
>
> Maxim

Here's the patch to be merged in core-updates (or core-updates-next).

>From 07625983cd901c94e4ac25b157035c95e33a115e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <[email-masked]>
Date: Sun, 25 Nov 2018 01:39:54 -0500
Subject: [PATCH] gnu: cmake: Generate the documentation.

This fixes https://bugs.gnu.org/33497.

* gnu/packages/cmake.scm (gnu): Use the (gnu package python) and
(gnu packages texinfo) modules.
(cmake)[configure]: Add arguments to configure so that manual pages, info and
HTML documentation is generated.
[move-html-doc]: New phase.
[native-inputs]: Add the native inputs required for building the
documentation.
[outputs]: Add a "doc" output.
---
 gnu/packages/cmake.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 5abf08755..36e887c51 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -38,7 +38,9 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages file)
   #:use-module (gnu packages libevent)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xml))
 
 (define-public cmake
@@ -136,7 +138,21 @@
                 "--mandir=share/man"
                 ,(string-append
                   "--docdir=share/doc/cmake-"
-                  (version-major+minor version)))))))))
+                  (version-major+minor version))
+                "--sphinx-man"
+                "--sphinx-html"
+                "--sphinx-info"))))
+         (add-after 'install 'move-html-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (doc (assoc-ref outputs "doc"))
+                   (html (string-append "/share/doc/cmake-"
+                                        ,(version-major+minor version)
+                                        "/html")))
+               (copy-recursively (string-append out html)
+                                 (string-append doc html))
+               (delete-file-recursively (string-append out html))
+               #t))))))
     (inputs
      `(("bzip2" ,bzip2)
        ("curl" ,curl)
@@ -147,6 +163,10 @@
        ("ncurses" ,ncurses) ; required for ccmake
        ("rhash" ,rhash)
        ("zlib" ,zlib)))
+    (native-inputs
+     `(("python-sphinx" ,python-sphinx)
+       ("texinfo" ,texinfo)))
+    (outputs '("out" "doc"))
     (native-search-paths
      (list (search-path-specification
             (variable "CMAKE_PREFIX_PATH")
-- 
2.19.0