summary refs log tree commit diff
path: root/gnu/packages/cmake.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cmake.scm')
-rw-r--r--gnu/packages/cmake.scm107
1 files changed, 77 insertions, 30 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 95f884b36d..64349be444 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -8,6 +8,7 @@
 ;;; 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,12 +40,17 @@
   #:use-module (gnu packages file)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages ncurses)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages sphinx)
+  #: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")
-    (version "3.13.1")
+    (name "cmake-minimal")
+    (version "3.15.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.cmake.org/files/v"
@@ -52,7 +58,7 @@
                                   "/cmake-" version ".tar.gz"))
               (sha256
                (base32
-                "04123d7fgnn1fs5p0nwyq397ss89r0y4wkg9a09qiwkjsvk1rzmy"))
+                "1xyprly3sf4wi0n1x79k4n22yxm6pb7fv70gqr9lvc7qv14cbphq"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -72,6 +78,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.
@@ -101,7 +124,6 @@
              (substitute*
                  '("Modules/CompilerId/Xcode-3.pbxproj.in"
                    "Modules/CPack.RuntimeScript.in"
-                   "Source/cmakexbuild.cxx"
                    "Source/cmGlobalXCodeGenerator.cxx"
                    "Source/cmLocalUnixMakefileGenerator3.cxx"
                    "Source/cmExecProgramCommand.cxx"
@@ -116,27 +138,13 @@
              ;; Help cmake's bootstrap process to find system libraries
              (begin
                (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
-               (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
+               (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)
@@ -158,12 +166,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 cmake/fixed
   ;; This is a variant of CMake that fixes X.509 certificate lookup:
   ;; <https://issues.guix.gnu.org/issue/37371>.
@@ -180,6 +223,9 @@ and workspaces that can be used in the compiler environment of your choice.")
   (package
     (inherit cmake)
     (name "emacs-cmake-mode")
+    (native-inputs '())
+    (inputs '())
+    (outputs '("out"))
     (build-system emacs-build-system)
     (arguments
      `(#:phases
@@ -187,7 +233,8 @@ and workspaces that can be used in the compiler environment of your choice.")
          (add-after 'unpack 'chdir-elisp
            ;; Elisp directory is not in root of the source.
            (lambda _
-             (chdir "Auxiliary"))))))
+             (chdir "Auxiliary")
+             #t)))))
     (synopsis "Emacs major mode for editing Cmake expressions")
     (description "@code{cmakeos-mode} provides an Emacs major mode for editing
 Cmake files.  It supports syntax highlighting, indenting and refilling of