unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33497: Our CMake package has no documentation
@ 2018-11-25  6:49 Maxim Cournoyer
  2018-11-25  6:54 ` bug#33497: [PATCH] " Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2018-11-25  6:49 UTC (permalink / raw)
  To: 33497

Hello,

Our CMake package lacks any documentation (manpage or other). Patch to
follow.

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33497: [PATCH] Re: bug#33497: Our CMake package has no documentation
  2018-11-25  6:49 bug#33497: Our CMake package has no documentation Maxim Cournoyer
@ 2018-11-25  6:54 ` Maxim Cournoyer
  2019-02-12 20:17   ` Marius Bakke
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2018-11-25  6:54 UTC (permalink / raw)
  To: 33497

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> 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).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-cmake-Generate-the-documentation.patch --]
[-- Type: text/x-patch, Size: 2544 bytes --]

From 07625983cd901c94e4ac25b157035c95e33a115e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#33497: [PATCH] Re: bug#33497: Our CMake package has no documentation
  2018-11-25  6:54 ` bug#33497: [PATCH] " Maxim Cournoyer
@ 2019-02-12 20:17   ` Marius Bakke
  2019-03-12  1:33     ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Bakke @ 2019-02-12 20:17 UTC (permalink / raw)
  To: Maxim Cournoyer, 33497

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

Hello!

Now would be the time to get this in 'core-updates'.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> 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 <maxim.cournoyer@gmail.com>
> 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.

I'm not very comfortable with pulling python-sphinx into the dependency
closure of CMake, because then we can't update it or its dependencies
outside of the 'core-updates' cycle.  It could also cause circular
dependency issues down the road.

Would it make sense to build the documentation as a separate package?
In that case it can go on the master branch.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33497: [PATCH] Re: bug#33497: Our CMake package has no documentation
  2019-02-12 20:17   ` Marius Bakke
@ 2019-03-12  1:33     ` Maxim Cournoyer
  2019-03-17 16:36       ` Marius Bakke
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2019-03-12  1:33 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 33497

Hello Marius!

Sorry for the delay.

Marius Bakke <mbakke@fastmail.com> writes:

> Hello!
>
> Now would be the time to get this in 'core-updates'.
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> 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 <maxim.cournoyer@gmail.com>
>> 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.
>
> I'm not very comfortable with pulling python-sphinx into the dependency
> closure of CMake, because then we can't update it or its dependencies
> outside of the 'core-updates' cycle.  It could also cause circular
> dependency issues down the road.
>
> Would it make sense to build the documentation as a separate package?
> In that case it can go on the master branch.

I don't like the idea of having a separate package for the documentation
of cmake because it goes against the expectations of Guix users (package
comes with its manpage, and extra doc can be installed as extra output
of the same package).

Maybe we could have a "cmake-minimal" package we'd keep hidden and use
by default as part of the cmake-build-system, which wouldn't include the
doc, and the regular, user facing cmake would be the one in this patch?

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33497: [PATCH] Re: bug#33497: Our CMake package has no documentation
  2019-03-12  1:33     ` Maxim Cournoyer
@ 2019-03-17 16:36       ` Marius Bakke
  2019-03-20 16:06         ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Bakke @ 2019-03-17 16:36 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 33497

[-- Attachment #1: Type: text/plain, Size: 2112 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Hello Marius!
>
> Sorry for the delay.
>
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Hello!
>>
>> Now would be the time to get this in 'core-updates'.
>>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>>
>>> Maxim Cournoyer <maxim.cournoyer@gmail.com> 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 <maxim.cournoyer@gmail.com>
>>> 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.
>>
>> I'm not very comfortable with pulling python-sphinx into the dependency
>> closure of CMake, because then we can't update it or its dependencies
>> outside of the 'core-updates' cycle.  It could also cause circular
>> dependency issues down the road.
>>
>> Would it make sense to build the documentation as a separate package?
>> In that case it can go on the master branch.
>
> I don't like the idea of having a separate package for the documentation
> of cmake because it goes against the expectations of Guix users (package
> comes with its manpage, and extra doc can be installed as extra output
> of the same package).
>
> Maybe we could have a "cmake-minimal" package we'd keep hidden and use
> by default as part of the cmake-build-system, which wouldn't include the
> doc, and the regular, user facing cmake would be the one in this patch?

This sounds reasonable to me.  Can you send a patch?  :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33497: [PATCH] Re: bug#33497: Our CMake package has no documentation
  2019-03-17 16:36       ` Marius Bakke
@ 2019-03-20 16:06         ` Maxim Cournoyer
  2019-03-21  2:08           ` bug#33497: [PATCHv2] " Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2019-03-20 16:06 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 33497

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

[...]

>>> I'm not very comfortable with pulling python-sphinx into the dependency
>>> closure of CMake, because then we can't update it or its dependencies
>>> outside of the 'core-updates' cycle.  It could also cause circular
>>> dependency issues down the road.
>>>
>>> Would it make sense to build the documentation as a separate package?
>>> In that case it can go on the master branch.
>>
>> I don't like the idea of having a separate package for the documentation
>> of cmake because it goes against the expectations of Guix users (package
>> comes with its manpage, and extra doc can be installed as extra output
>> of the same package).
>>
>> Maybe we could have a "cmake-minimal" package we'd keep hidden and use
>> by default as part of the cmake-build-system, which wouldn't include the
>> doc, and the regular, user facing cmake would be the one in this patch?
>
> This sounds reasonable to me.  Can you send a patch?  :-)

Here it comes, attached! Thanks to Ricardo on #guix for helping me
resolve a quoting issue :-).

To validate it works, I had to disable some failing test suites, using:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: disable-broken-tests.diff --]
[-- Type: text/x-patch, Size: 3202 bytes --]

diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index f47f7623b4..259ea23a67 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -106,26 +106,26 @@ conversions for values passed between the two languages.")
                   (guix build python-build-system))
        #:phases
        (modify-phases %standard-phases
-         (replace 'check
-           (lambda _
-             (setenv "PYTHONPATH"
-                     (string-append
-                      (getenv "PYTHONPATH")
-                      ":" (getcwd) "/build/"
-                      (car (scandir "build" (cut string-prefix? "lib." <>)))))
+         ;; (replace 'check
+         ;;   (lambda _
+         ;;     (setenv "PYTHONPATH"
+         ;;             (string-append
+         ;;              (getenv "PYTHONPATH")
+         ;;              ":" (getcwd) "/build/"
+         ;;              (car (scandir "build" (cut string-prefix? "lib." <>)))))
 
-             ;; XXX The "normal" approach of setting CC and friends does
-             ;; not work here.  Is this the correct way of doing things?
-             (substitute* "testing/embedding/test_basic.py"
-               (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
-                (string-append "c = distutils.ccompiler.new_compiler();"
-                               "c.set_executables(compiler='gcc',"
-                               "compiler_so='gcc',linker_exe='gcc',"
-                               "linker_so='gcc -shared')")))
-             (substitute* "testing/cffi0/test_ownlib.py"
-               (("'cc testownlib") "'gcc testownlib"))
-             (invoke "py.test" "-v" "c/" "testing/")
-             #t))
+         ;;     ;; XXX The "normal" approach of setting CC and friends does
+         ;;     ;; not work here.  Is this the correct way of doing things?
+         ;;     (substitute* "testing/embedding/test_basic.py"
+         ;;       (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
+         ;;        (string-append "c = distutils.ccompiler.new_compiler();"
+         ;;                       "c.set_executables(compiler='gcc',"
+         ;;                       "compiler_so='gcc',linker_exe='gcc',"
+         ;;                       "linker_so='gcc -shared')")))
+         ;;     (substitute* "testing/cffi0/test_ownlib.py"
+         ;;       (("'cc testownlib") "'gcc testownlib"))
+         ;;     (invoke "py.test" "-v" "c/" "testing/")
+         ;;     #t))
          (add-before 'check 'disable-failing-test
            ;; This is assumed to be a libffi issue:
            ;; https://bitbucket.org/cffi/cffi/issues/312/tests-failed-with-armv8
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0a483fb1db..67de01573e 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -127,7 +127,8 @@
                "tk"))                     ;tkinter; adds 50 MiB to the closure
     (build-system gnu-build-system)
     (arguments
-     `(#:test-target "test"
+     `(#:tests? #f
+       #:test-target "test"
        #:configure-flags
        (list "--enable-shared"                    ;allow embedding
              "--with-system-ffi"                  ;build ctypes

[-- Attachment #3: 0001-cmake-Generate-documentation.patch --]
[-- Type: text/x-patch, Size: 8101 bytes --]

From 61046db1d2087c8bf9d67480d881fa449157ffdb Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 20 Mar 2019 12:04:29 -0400
Subject: [PATCH] cmake: Generate documentation.

To prevent complicating the dependencies of a core tool, a new variant,
CMAKE-MINIMAL is introduced and the CMake build system is configured to use it
by default.  The regular CMAKE package gains a manpage, info manual as well
as HTML documentation.

Fixes issue #33497 (https://bugs.gnu.org/33497).

* gnu/packages/cmake.scm (gnu): Use modules (gnu packages python-xyz),
(gnu packages texinfo) and (srfi srfi-1).
(cmake-minimal): Rename the original cmake variable to this.
[phases]{configure}: Refactor the configure script arguments into ARGS, and
allow passing CONFIGURE-FLAGS to the phase.
[properties]: Set the HIDDEN? property to #t.
(cmake): New variable, which inherits from CMAKE-MINIMAL.
[phases]{move-html-doc}: Add phase.
[native-inputs]: Add PYTHON-SPHINX and TEXINFO.
[outputs]: Add the "doc" output.
[properties]: Clear the inherited HIDDEN? property.
* guix/build-system/cmake.scm (default-cmake): Use CMAKE-MINIMAL instead of
CMAKE.
---
 gnu/packages/cmake.scm      | 95 +++++++++++++++++++++++++++----------
 guix/build-system/cmake.scm |  2 +-
 2 files changed, 71 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 7772fbedb1..ed57cf0fee 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -8,6 +8,8 @@
 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,11 +41,16 @@
   #:use-module (gnu packages file)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages ncurses)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages xml)
+  #:use-module (srfi srfi-1))
 
-(define-public cmake
+;;; This minimal variant of CMake does not include the documentation. It is
+;;; used by the cmake-build-system.
+(define-public cmake-minimal
   (package
-    (name "cmake")
+    (name "cmake-minimal")
     (version "3.14.0")
     (source (origin
               (method url-fetch)
@@ -119,25 +126,28 @@
                (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
                                                 (getenv "C_INCLUDE_PATH")))
                #t)))
+         ;; CMake uses its own configure script.
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke
-                "./configure" "--verbose"
-                (string-append "--parallel=" (number->string (parallel-job-count)))
-                (string-append "--prefix=" out)
-                "--system-libs"
-                "--no-system-jsoncpp" ; FIXME: Circular dependency.
-                ;; By default, the man pages and other docs land
-                ;; in PREFIX/man and PREFIX/doc, but we want them
-                ;; in share/{man,doc}.  Note that unlike
-                ;; autoconf-generated configure scripts, cmake's
-                ;; configure prepends "PREFIX/" to what we pass
-                ;; to --mandir and --docdir.
-                "--mandir=share/man"
-                ,(string-append
-                  "--docdir=share/doc/cmake-"
-                  (version-major+minor version)))))))))
+           (lambda* (#:key outputs (configure-flags '()) #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (args `("--verbose"
+                            ,(string-append "--parallel="
+                                            (number->string (parallel-job-count)))
+                            ,(string-append "--prefix=" out)
+                            "--system-libs"
+                            "--no-system-jsoncpp" ; FIXME: Circular dependency.
+                            ;; By default, the man pages and other docs land in
+                            ;; PREFIX/man and PREFIX/doc, but we want them in
+                            ;; share/{man,doc}.  Note that unlike
+                            ;; autoconf-generated configure scripts, cmake's
+                            ;; configure prepends "PREFIX/" to what we pass to
+                            ;; --mandir and --docdir.
+                            "--mandir=share/man"
+                            ,,(string-append
+                               "--docdir=share/doc/cmake-"
+                               (version-major+minor version))
+                            ,@configure-flags)))
+               (apply invoke "./configure" args)))))))
     (inputs
      `(("bzip2" ,bzip2)
        ("curl" ,curl)
@@ -159,12 +169,47 @@
 CMake is used to control the software compilation process using simple platform
 and compiler independent configuration files.  CMake generates native makefiles
 and workspaces that can be used in the compiler environment of your choice.")
-    (license (list license:bsd-3             ; cmake
-                   license:bsd-4             ; cmcompress
-                   license:bsd-2             ; cmlibarchive
-                   license:expat             ; cmjsoncpp is dual MIT/public domain
+    (properties '((hidden? . #t)))
+    (license (list license:bsd-3        ; cmake
+                   license:bsd-4        ; cmcompress
+                   license:bsd-2        ; cmlibarchive
+                   license:expat        ; cmjsoncpp is dual MIT/public domain
                    license:public-domain)))) ; cmlibarchive/archive_getdate.c
 
+(define-public cmake
+  (package
+    (inherit cmake-minimal)
+    (name "cmake")
+    (arguments
+     (substitute-keyword-arguments (package-arguments cmake-minimal)
+       ((#:configure-flags configure-flags ''())
+        `(append ,configure-flags
+                ;; Extra configure flags used to generate the documentation.
+                '("--sphinx-info"
+                  "--sphinx-man"
+                  "--sphinx-html")))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (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
+                                            (package-version cmake-minimal))
+                                          "/html")))
+                 (copy-recursively (string-append out html)
+                                   (string-append doc html))
+                 (delete-file-recursively (string-append out html))
+                 #t)))))))
+    ;; Extra inputs required to build the documentation.
+    (native-inputs
+     `(,@(package-native-inputs cmake-minimal)
+       ("python-sphinx" ,python-sphinx)
+       ("texinfo" ,texinfo)))
+    (outputs '("out" "doc"))
+    (properties (alist-delete 'hidden? (package-properties cmake-minimal)))))
+
 (define-public emacs-cmake-mode
   (package
     (inherit cmake)
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index ee116c5a4c..ca88fadddf 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -48,7 +48,7 @@
 
   ;; Do not use `@' to avoid introducing circular dependencies.
   (let ((module (resolve-interface '(gnu packages cmake))))
-    (module-ref module 'cmake)))
+    (module-ref module 'cmake-minimal)))
 
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
-- 
2.20.1


[-- Attachment #4: Type: text/plain, Size: 16 bytes --]


Thanks!

Maxim

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#33497: [PATCHv2] Re: bug#33497: Our CMake package has no documentation
  2019-03-20 16:06         ` Maxim Cournoyer
@ 2019-03-21  2:08           ` Maxim Cournoyer
  2019-03-21 18:40             ` Marius Bakke
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2019-03-21  2:08 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 33497


[-- Attachment #1.1: Type: text/plain, Size: 73 bytes --]

Here's an improved version, following some comments of Marius on #guix.


[-- Attachment #1.2: 0001-cmake-Generate-documentation.patch --]
[-- Type: text/x-patch, Size: 8076 bytes --]

From 2f33a7321e5e37d37f57c229c8079cb4ffd10834 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 20 Mar 2019 21:38:19 -0400
Subject: [PATCH] cmake: Generate documentation.

To prevent complicating the dependencies of a core tool, a new variant,
CMAKE-MINIMAL is introduced and the CMake build system is configured to use it
by default.  The regular CMAKE package gains a manpage, info manual as well
as HTML documentation.

Fixes issue #33497 (https://bugs.gnu.org/33497).

* gnu/packages/cmake.scm (gnu): Use modules (gnu packages python-xyz),
(gnu packages texinfo) and (srfi srfi-1).
(cmake-minimal): Rename the original cmake variable to this.
[phases]{configure}: Extract the configure script arguments to...
[configure-flags]: here.
[properties]: Set the HIDDEN? property to #t.
(cmake): New variable, which inherits from CMAKE-MINIMAL.
[phases]{move-html-doc}: Add phase.
[native-inputs]: Add PYTHON-SPHINX and TEXINFO.
[outputs]: Add the "doc" output.
[properties]: Clear the inherited HIDDEN? property.
* guix/build-system/cmake.scm (default-cmake): Use CMAKE-MINIMAL instead of
CMAKE.
---
 gnu/packages/cmake.scm      | 94 +++++++++++++++++++++++++++----------
 guix/build-system/cmake.scm |  2 +-
 2 files changed, 70 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 7772fbedb1..b999c0c170 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -8,6 +8,8 @@
 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,11 +41,16 @@
   #:use-module (gnu packages file)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages ncurses)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages xml)
+  #:use-module (srfi srfi-1))
 
-(define-public cmake
+;;; This minimal variant of CMake does not include the documentation. It is
+;;; used by the cmake-build-system.
+(define-public cmake-minimal
   (package
-    (name "cmake")
+    (name "cmake-minimal")
     (version "3.14.0")
     (source (origin
               (method url-fetch)
@@ -72,6 +79,23 @@
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
+       #:configure-flags
+       (let ((out (assoc-ref %outputs "out"))
+             (parallel-job-count (number->string (parallel-job-count))))
+         (list "--verbose"
+               (string-append "--parallel=" parallel-job-count)
+               (string-append "--prefix=" out)
+               "--system-libs"
+               "--no-system-jsoncpp"    ; FIXME: Circular dependency.
+               ;; By default, the man pages and other docs land
+               ;; in PREFIX/man and PREFIX/doc, but we want them
+               ;; in share/{man,doc}.  Note that unlike
+               ;; autoconf-generated configure scripts, cmake's
+               ;; configure prepends "PREFIX/" to what we pass
+               ;; to --mandir and --docdir.
+               "--mandir=share/man"
+               ,(string-append "--docdir=share/doc/cmake-"
+                               (version-major+minor version))))
        #:make-flags
        (let ((skipped-tests
               (list "BundleUtilities" ; This test fails on Guix.
@@ -119,25 +143,10 @@
                (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
                                                 (getenv "C_INCLUDE_PATH")))
                #t)))
+         ;; CMake uses its own configure script.
          (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke
-                "./configure" "--verbose"
-                (string-append "--parallel=" (number->string (parallel-job-count)))
-                (string-append "--prefix=" out)
-                "--system-libs"
-                "--no-system-jsoncpp" ; FIXME: Circular dependency.
-                ;; By default, the man pages and other docs land
-                ;; in PREFIX/man and PREFIX/doc, but we want them
-                ;; in share/{man,doc}.  Note that unlike
-                ;; autoconf-generated configure scripts, cmake's
-                ;; configure prepends "PREFIX/" to what we pass
-                ;; to --mandir and --docdir.
-                "--mandir=share/man"
-                ,(string-append
-                  "--docdir=share/doc/cmake-"
-                  (version-major+minor version)))))))))
+           (lambda* (#:key (configure-flags '()) #:allow-other-keys)
+             (apply invoke "./configure" configure-flags))))))
     (inputs
      `(("bzip2" ,bzip2)
        ("curl" ,curl)
@@ -159,12 +168,47 @@
 CMake is used to control the software compilation process using simple platform
 and compiler independent configuration files.  CMake generates native makefiles
 and workspaces that can be used in the compiler environment of your choice.")
-    (license (list license:bsd-3             ; cmake
-                   license:bsd-4             ; cmcompress
-                   license:bsd-2             ; cmlibarchive
-                   license:expat             ; cmjsoncpp is dual MIT/public domain
+    (properties '((hidden? . #t)))
+    (license (list license:bsd-3        ; cmake
+                   license:bsd-4        ; cmcompress
+                   license:bsd-2        ; cmlibarchive
+                   license:expat        ; cmjsoncpp is dual MIT/public domain
                    license:public-domain)))) ; cmlibarchive/archive_getdate.c
 
+(define-public cmake
+  (package
+    (inherit cmake-minimal)
+    (name "cmake")
+    (arguments
+     (substitute-keyword-arguments (package-arguments cmake-minimal)
+       ((#:configure-flags configure-flags ''())
+        `(append ,configure-flags
+                ;; Extra configure flags used to generate the documentation.
+                '("--sphinx-info"
+                  "--sphinx-man"
+                  "--sphinx-html")))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (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
+                                            (package-version cmake-minimal))
+                                          "/html")))
+                 (copy-recursively (string-append out html)
+                                   (string-append doc html))
+                 (delete-file-recursively (string-append out html))
+                 #t)))))))
+    ;; Extra inputs required to build the documentation.
+    (native-inputs
+     `(,@(package-native-inputs cmake-minimal)
+       ("python-sphinx" ,python-sphinx)
+       ("texinfo" ,texinfo)))
+    (outputs '("out" "doc"))
+    (properties (alist-delete 'hidden? (package-properties cmake-minimal)))))
+
 (define-public emacs-cmake-mode
   (package
     (inherit cmake)
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index ee116c5a4c..ca88fadddf 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -48,7 +48,7 @@
 
   ;; Do not use `@' to avoid introducing circular dependencies.
   (let ((module (resolve-interface '(gnu packages cmake))))
-    (module-ref module 'cmake)))
+    (module-ref module 'cmake-minimal)))
 
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
-- 
2.20.1


[-- Attachment #1.3: Type: text/plain, Size: 7 bytes --]


Maxim

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#33497: [PATCHv2] Re: bug#33497: Our CMake package has no documentation
  2019-03-21  2:08           ` bug#33497: [PATCHv2] " Maxim Cournoyer
@ 2019-03-21 18:40             ` Marius Bakke
  2019-03-22  2:19               ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Bakke @ 2019-03-21 18:40 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 33497

[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Here's an improved version, following some comments of Marius on #guix.
>
> From 2f33a7321e5e37d37f57c229c8079cb4ffd10834 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Wed, 20 Mar 2019 21:38:19 -0400
> Subject: [PATCH] cmake: Generate documentation.
>
> To prevent complicating the dependencies of a core tool, a new variant,
> CMAKE-MINIMAL is introduced and the CMake build system is configured to use it
> by default.  The regular CMAKE package gains a manpage, info manual as well
> as HTML documentation.
>
> Fixes issue #33497 (https://bugs.gnu.org/33497).
>
> * gnu/packages/cmake.scm (gnu): Use modules (gnu packages python-xyz),
> (gnu packages texinfo) and (srfi srfi-1).
> (cmake-minimal): Rename the original cmake variable to this.
> [phases]{configure}: Extract the configure script arguments to...
> [configure-flags]: here.
> [properties]: Set the HIDDEN? property to #t.
> (cmake): New variable, which inherits from CMAKE-MINIMAL.
> [phases]{move-html-doc}: Add phase.
> [native-inputs]: Add PYTHON-SPHINX and TEXINFO.
> [outputs]: Add the "doc" output.
> [properties]: Clear the inherited HIDDEN? property.
> * guix/build-system/cmake.scm (default-cmake): Use CMAKE-MINIMAL instead of
> CMAKE.

Thanks!  LGTM.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#33497: [PATCHv2] Re: bug#33497: Our CMake package has no documentation
  2019-03-21 18:40             ` Marius Bakke
@ 2019-03-22  2:19               ` Maxim Cournoyer
  0 siblings, 0 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2019-03-22  2:19 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 33497-done

Marius Bakke <mbakke@fastmail.com> writes:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Here's an improved version, following some comments of Marius on #guix.
>>
>> From 2f33a7321e5e37d37f57c229c8079cb4ffd10834 Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>> Date: Wed, 20 Mar 2019 21:38:19 -0400
>> Subject: [PATCH] cmake: Generate documentation.
>>
>> To prevent complicating the dependencies of a core tool, a new variant,
>> CMAKE-MINIMAL is introduced and the CMake build system is configured to use it
>> by default.  The regular CMAKE package gains a manpage, info manual as well
>> as HTML documentation.
>>
>> Fixes issue #33497 (https://bugs.gnu.org/33497).
>>
>> * gnu/packages/cmake.scm (gnu): Use modules (gnu packages python-xyz),
>> (gnu packages texinfo) and (srfi srfi-1).
>> (cmake-minimal): Rename the original cmake variable to this.
>> [phases]{configure}: Extract the configure script arguments to...
>> [configure-flags]: here.
>> [properties]: Set the HIDDEN? property to #t.
>> (cmake): New variable, which inherits from CMAKE-MINIMAL.
>> [phases]{move-html-doc}: Add phase.
>> [native-inputs]: Add PYTHON-SPHINX and TEXINFO.
>> [outputs]: Add the "doc" output.
>> [properties]: Clear the inherited HIDDEN? property.
>> * guix/build-system/cmake.scm (default-cmake): Use CMAKE-MINIMAL instead of
>> CMAKE.
>
> Thanks!  LGTM.

Pushed to core-updates with commit 2f33a7321e. Thank you!

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-22  2:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-25  6:49 bug#33497: Our CMake package has no documentation Maxim Cournoyer
2018-11-25  6:54 ` bug#33497: [PATCH] " Maxim Cournoyer
2019-02-12 20:17   ` Marius Bakke
2019-03-12  1:33     ` Maxim Cournoyer
2019-03-17 16:36       ` Marius Bakke
2019-03-20 16:06         ` Maxim Cournoyer
2019-03-21  2:08           ` bug#33497: [PATCHv2] " Maxim Cournoyer
2019-03-21 18:40             ` Marius Bakke
2019-03-22  2:19               ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).