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.scm273
1 files changed, 125 insertions, 148 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 87fde01f63..151b91bf12 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -31,6 +31,7 @@
 (define-module (gnu packages cmake)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
@@ -99,8 +100,7 @@ using the CMake build system.")
       (lambda _
         (delete-file "Auxiliary/cmake-mode.el")
         (substitute* "Auxiliary/CMakeLists.txt"
-          ((".*cmake-mode.el.*") ""))
-        #t))
+          ((".*cmake-mode.el.*") ""))))
     ,@(if (target-x86-32?)
           '((add-after 'unpack 'skip-cpack-txz-test
               (lambda _
@@ -124,8 +124,7 @@ using the CMake build system.")
               "Source/cmExecProgramCommand.cxx"
               "Tests/CMakeLists.txt"
               "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
-          (("/bin/sh") (which "sh")))
-        #t))))
+          (("/bin/sh") (which "sh")))))))
 
 (define %common-disabled-tests
   '(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH,
@@ -143,6 +142,8 @@ using the CMake build system.")
     ;; be available along with the required headers.
     "Utilities/cmlibarchive/libarchive/archive_getdate.c"
     "Utilities/cmlibarchive/libarchive/archive_getdate.h"
+    ;; ELF headers.
+    "Utilities/cmelf"
     ;; CMake header wrappers.
     "Utilities/cm3p"))
 
@@ -151,7 +152,7 @@ using the CMake build system.")
 (define-public cmake-bootstrap
   (package
     (name "cmake-bootstrap")
-    (version "3.21.4")
+    (version "3.24.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://cmake.org/files/v"
@@ -159,71 +160,71 @@ using the CMake build system.")
                                   "/cmake-" version ".tar.gz"))
               (sha256
                (base32
-                "0y2rk316j9m1iqimgwah0z1ii3ggli65dw6hdn4ckx0mqaahlmyr"))
-              (patches (search-patches "cmake-curl-certificates.patch"))))
+                "1ny8y2dzc6fww9gzb1ml0vjpx4kclphjihkxagxigprxdzq2140d"))
+              (patches (search-patches "cmake-curl-certificates-3.24.patch"))))
     (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"
-               ;; 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))
+     (list
+      #:test-target "test"
+      #:configure-flags
+      #~(let ((parallel-job-count (number->string (parallel-job-count))))
+          (list "--verbose"
+                (string-append "--parallel=" parallel-job-count)
+                (string-append "--prefix=" #$output)
+                "--system-libs"
+                ;; 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))
 
-               ;; By default CMake is built without any optimizations.  Use
-               ;; the recommended Release target for a ~2.5x speedup.
-               "--" "-DCMAKE_BUILD_TYPE=Release"))
-       #:make-flags
-       (let ((skipped-tests
-              (list ,@%common-disabled-tests
-                    "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
-                    ;; This test fails when ARGS (below) is in use, see
-                    ;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>.
-                    "CTestCoverageCollectGCOV")))
-         (list
-          (string-append
-           ;; These arguments apply for the tests only.
-           "ARGS=-j " (number->string (parallel-job-count))
-           " --output-on-failure"
-           " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
-       #:phases
-       (modify-phases %standard-phases
-         ,@(%common-build-phases)
-         (add-before 'configure 'set-paths
-           (lambda _
-             ;; Help cmake's bootstrap process to find system libraries
-             (begin
-               (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
-               (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
-                                                (getenv "C_INCLUDE_PATH")))
-               #t)))
-         ;; CMake uses its own configure script.
-         (replace 'configure
-           (lambda* (#:key (configure-flags '()) #:allow-other-keys)
-             (apply invoke "./configure" configure-flags))))))
+                ;; By default CMake is built without any optimizations.  Use
+                ;; the recommended Release target for a ~2.5x speedup.
+                "--" "-DCMAKE_BUILD_TYPE=Release"))
+      #:make-flags
+      #~(let ((skipped-tests
+               (list #$@%common-disabled-tests
+                     "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
+                     ;; This test fails when ARGS (below) is in use, see
+                     ;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>.
+                     "CTestCoverageCollectGCOV")))
+          (list
+           (string-append
+            ;; These arguments apply for the tests only.
+            "ARGS=-j " (number->string (parallel-job-count))
+            " --output-on-failure"
+            " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
+      #:phases
+      #~(modify-phases %standard-phases
+          #$@(%common-build-phases)
+          (add-before 'configure 'set-paths
+            (lambda _
+              ;; Help cmake's bootstrap process to find system libraries
+              (begin
+                (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+                (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
+                                                 (getenv "C_INCLUDE_PATH"))))))
+          ;; CMake uses its own configure script.
+          (replace 'configure
+            (lambda* (#:key (configure-flags '()) #:allow-other-keys)
+              (apply invoke "./configure" configure-flags))))))
     (inputs
-     `(("bzip2" ,bzip2)
-       ("curl" ,curl)
-       ("expat" ,expat)
-       ("file" ,file)
-       ("libarchive" ,libarchive)
-       ,@(if (hurd-target?)
-             '()
-             `(("libuv" ,libuv)))       ;not supported on the Hurd
-       ("rhash" ,rhash)
-       ("zlib" ,zlib)))
+     (append
+      (if (hurd-target?)
+          '()
+          (list libuv))                 ;not supported on the Hurd
+      (list bzip2
+            curl
+            expat
+            file
+            jsoncpp
+            libarchive
+            rhash
+            zlib)))
     (native-search-paths
      (list (search-path-specification
             (variable "CMAKE_PREFIX_PATH")
@@ -284,72 +285,51 @@ and workspaces that can be used in the compiler environment of your choice.")
                                     "Utilities"
                                     lstat)
                   #t))))
-    (inputs
-     (modify-inputs (package-inputs cmake-bootstrap)
-       (prepend jsoncpp)))
     (build-system cmake-build-system)
     (arguments
-     `(#:configure-flags
-       (list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON"
-             (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
-                            ,(version-major+minor (package-version
-                                                   cmake-bootstrap))))
+     (list
+      #:configure-flags
+      #~(list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON"
+              (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
+                             #$(version-major+minor (package-version
+                                                     cmake-bootstrap))))
 
-       ;; This is the CMake used in cmake-build-system.  Ensure compiler
-       ;; optimizations are enabled to save size and CPU cycles.
-       #:build-type "Release"
-       #:phases
-       (modify-phases %standard-phases
-         ,@(%common-build-phases)
-         (add-after 'install 'delete-help-documentation
-           (lambda* (#:key outputs #:allow-other-keys)
-             (delete-file-recursively
-               (string-append (assoc-ref outputs "out")
+      ;; This is the CMake used in cmake-build-system.  Ensure compiler
+      ;; optimizations are enabled to save size and CPU cycles.
+      #:build-type "Release"
+      #:phases
+      #~(modify-phases %standard-phases
+          #$@(%common-build-phases)
+          (add-after 'install 'delete-help-documentation
+            (lambda _
+              (delete-file-recursively
+               (string-append #$output
                               "/share/cmake-"
-                              ,(version-major+minor
+                              #$(version-major+minor
                                  (package-version cmake-bootstrap))
-                              "/Help"))
-             #t))
-         (replace 'check
-           (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
-             (let ((skipped-tests (list ,@%common-disabled-tests
-                                        ;; This test requires the bundled libuv.
-                                        "BootstrapTest")))
-               (if tests?
-                   (begin
-                     (invoke "ctest" "-j" (if parallel-tests?
-                                              (number->string (parallel-job-count))
-                                              "1")
-                             "--exclude-regex"
-                             (string-append "^(" (string-join skipped-tests "|") ")$")))
-                   (format #t "test suite not run~%"))
-               #t))))
-        ,@(if (%current-target-system)
-              '()
-              `(#:cmake ,cmake-bootstrap))))))
+                              "/Help"))))
+          (replace 'check
+            (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
+              (let ((skipped-tests (list #$@%common-disabled-tests
+                                         ;; This test requires the bundled libuv.
+                                         "BootstrapTest")))
+                (if tests?
+                    (begin
+                      (invoke "ctest" "-j" (if parallel-tests?
+                                               (number->string (parallel-job-count))
+                                               "1")
+                              "--exclude-regex"
+                              (string-append "^(" (string-join skipped-tests "|") ")$")))
+                    (format #t "test suite not run~%"))))))
+      #:cmake (if (%current-target-system)
+                  cmake-minimal-cross
+                  cmake-bootstrap)))))
 
 ;;; The "user-facing" CMake, now with manuals and HTML documentation.
 (define-public cmake
   (package
     (inherit cmake-minimal)
     (name "cmake")
-    (version "3.24.2")
-    (source (origin
-              (inherit (package-source cmake-minimal))
-              (method url-fetch)
-              (uri (string-append "https://cmake.org/files/v"
-                                  (version-major+minor version)
-                                  "/cmake-" version ".tar.gz"))
-              (snippet (match (origin-snippet (package-source cmake-minimal))
-                         (('begin ('define 'preserved-files ('quote x))
-                                  rest ...)
-                          `(begin (define preserved-files
-                                    ',(cons "Utilities/cmelf" x))
-                                  ,@rest))))
-              (sha256
-               (base32
-                "1ny8y2dzc6fww9gzb1ml0vjpx4kclphjihkxagxigprxdzq2140d"))
-              (patches (search-patches "cmake-curl-certificates-3.24.patch"))))
     (outputs '("out" "doc"))
     (arguments
      (substitute-keyword-arguments (package-arguments cmake-minimal)
@@ -363,27 +343,25 @@ and workspaces that can be used in the compiler environment of your choice.")
        ((#:build-type _ #f) "RelWithDebInfo")
 
        ((#:configure-flags flags ''())
-        `(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON"
-                       (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
-                                      ,(version-major+minor (package-version
-                                                             cmake-minimal)))
-                       "-DCMAKE_INFO_DIR=share/info"
-                       "-DCMAKE_MAN_DIR=share/man")
-                 ,flags))
+        #~(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON"
+                        (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
+                                       #$(version-major+minor (package-version
+                                                               cmake-minimal)))
+                        "-DCMAKE_INFO_DIR=share/info"
+                        "-DCMAKE_MAN_DIR=share/man")
+                  #$flags))
        ((#:phases phases)
-        `(modify-phases ,phases
-           (delete 'delete-help-documentation)
-           (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)))))))))
+        #~(modify-phases #$phases
+            (delete 'delete-help-documentation)
+            (add-after 'install 'move-html-doc
+              (lambda _
+                (let ((html (string-append "/share/doc/cmake-"
+                                           #$(version-major+minor
+                                              (package-version cmake-minimal))
+                                           "/html")))
+                  (copy-recursively (string-append #$output html)
+                                    (string-append #$output:doc html))
+                  (delete-file-recursively (string-append #$output html)))))))))
     (inputs
      (modify-inputs (package-inputs cmake-minimal)
        (prepend ncurses)))              ;required for ccmake
@@ -411,13 +389,12 @@ and workspaces that can be used in the compiler environment of your choice.")
     (outputs '("out"))
     (build-system emacs-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'chdir-elisp
-           ;; Elisp directory is not in root of the source.
-           (lambda _
-             (chdir "Auxiliary")
-             #t)))))
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'chdir-elisp
+                 ;; Elisp directory is not in root of the source.
+                 (lambda _
+                   (chdir "Auxiliary"))))))
     (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