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.scm179
1 files changed, 57 insertions, 122 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index df8885b4dd..f76ee3ff3a 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017, 2018, 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2017, 2018, 2020, 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
@@ -110,7 +110,6 @@ using the CMake build system.")
               "Source/cmGlobalXCodeGenerator.cxx"
               "Source/cmLocalUnixMakefileGenerator3.cxx"
               "Source/cmExecProgramCommand.cxx"
-              "Utilities/Release/release_cmake.cmake"
               "Tests/CMakeLists.txt"
               "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
           (("/bin/sh") (which "sh")))
@@ -123,20 +122,24 @@ using the CMake build system.")
     ;; This test requires network access.
     "CTestTestUpload"
     ;; This test requires 'ldconfig' which is not available in Guix.
-    "RunCMake.install"))
+    "RunCMake.install"
+    ;; This test fails for unknown reason.
+    "RunCMake.file-GET_RUNTIME_DEPENDENCIES"))
 
 (define %preserved-third-party-files
   '(;; 'Source/cm_getdate.c' includes archive_getdate.c wholesale, so it must
     ;; be available along with the required headers.
     "Utilities/cmlibarchive/libarchive/archive_getdate.c"
-    "Utilities/cmlibarchive/libarchive/archive_getdate.h"))
+    "Utilities/cmlibarchive/libarchive/archive_getdate.h"
+    ;; CMake header wrappers.
+    "Utilities/cm3p"))
 
 ;;; The "bootstrap" CMake.  It is used to build 'cmake-minimal' below, as well
 ;;; as any dependencies that need cmake-build-system.
 (define-public cmake-bootstrap
   (package
     (name "cmake-bootstrap")
-    (version "3.16.5")
+    (version "3.20.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://cmake.org/files/v"
@@ -144,49 +147,7 @@ using the CMake build system.")
                                   "/cmake-" version ".tar.gz"))
               (sha256
                (base32
-                "1z4bb8z6b4dvq5hrvajrf1hyybqay3xybyimf71w1jgcp180nxjz"))
-              (modules '((guix build utils)
-                         (ice-9 ftw)))
-              (snippet
-               `(begin
-                  ;; CMake bundles its dependencies in the "Utilities" directory.
-                  ;; Delete those to ensure the system libraries are used.
-                  (define preserved-files
-                    '(,@%preserved-third-party-files
-                      ;; Use the bundled JsonCpp during bootstrap to work around
-                      ;; a circular dependency.  TODO: JsonCpp can be built with
-                      ;; Meson instead of CMake, but meson-build-system currently
-                      ;; does not support cross-compilation.
-                      "Utilities/cmjsoncpp"
-                      ;; LibUV is required to bootstrap the initial build system.
-                      "Utilities/cmlibuv"))
-
-                  (file-system-fold (lambda (dir stat result)         ;enter?
-                                      (or (string=? "Utilities" dir)  ;init
-                                          ;; The bundled dependencies are
-                                          ;; distinguished by having a "cm"
-                                          ;; prefix to their upstream names.
-                                          (and (string-prefix? "Utilities/cm" dir)
-                                               (not (member dir preserved-files)))))
-                                    (lambda (file stat result)        ;leaf
-                                      (unless (or (member file preserved-files)
-                                                  ;; Preserve top-level files.
-                                                  (string=? "Utilities"
-                                                            (dirname file)))
-                                        (delete-file file)))
-                                    (const #t)                        ;down
-                                    (lambda (dir stat result)         ;up
-                                      (when (equal? (scandir dir) '("." ".."))
-                                        (rmdir dir)))
-                                    (const #t)                        ;skip
-                                    (lambda (file stat errno result)
-                                      (format (current-error-port)
-                                              "warning: failed to delete ~a: ~a~%"
-                                              file (strerror errno)))
-                                    #t
-                                    "Utilities"
-                                    lstat)
-                  #t))
+                "0kjlb7sxbwg8z4027c3jjcmyjh9d36p0r9d4nqxynyaijz5nxkxf"))
               (patches (search-patches "cmake-curl-certificates.patch"))))
     (build-system gnu-build-system)
     (arguments
@@ -242,14 +203,13 @@ using the CMake build system.")
              (apply invoke "./configure" configure-flags))))))
     (inputs
      `(("bzip2" ,bzip2)
-       ("curl" ,curl-minimal)
+       ("curl" ,curl)
        ("expat" ,expat)
        ("file" ,file)
        ("libarchive" ,libarchive)
        ,@(if (hurd-target?)
              '()
              `(("libuv" ,libuv)))       ;not supported on the Hurd
-       ("ncurses" ,ncurses)             ;required for ccmake
        ("rhash" ,rhash)
        ("zlib" ,zlib)))
     (native-search-paths
@@ -287,17 +247,41 @@ and workspaces that can be used in the compiler environment of your choice.")
     (name "cmake-minimal")
     (source (origin
               (inherit (package-source cmake-bootstrap))
+              ;; Purge CMakes bundled dependencies as they are no longer needed.
+              (modules '((ice-9 ftw)))
               (snippet
-               (match (origin-snippet (package-source cmake-bootstrap))
-                 ((_ _ exp ...)
-                  ;; Now we can delete the remaining software bundles.
-                  (append `(begin
-                             (define preserved-files ',%preserved-third-party-files))
-                          exp))))))
+               `(begin
+                  (define preserved-files ',%preserved-third-party-files)
+
+                  (file-system-fold (lambda (dir stat result)         ;enter?
+                                      (or (string=? "Utilities" dir)  ;init
+                                          ;; The bundled dependencies are
+                                          ;; distinguished by having a "cm"
+                                          ;; prefix to their upstream names.
+                                          (and (string-prefix? "Utilities/cm" dir)
+                                               (not (member dir preserved-files)))))
+                                    (lambda (file stat result)        ;leaf
+                                      (unless (or (member file preserved-files)
+                                                  ;; Preserve top-level files.
+                                                  (string=? "Utilities"
+                                                            (dirname file)))
+                                        (delete-file file)))
+                                    (const #t)                        ;down
+                                    (lambda (dir stat result)         ;up
+                                      (when (equal? (scandir dir) '("." ".."))
+                                        (rmdir dir)))
+                                    (const #t)                        ;skip
+                                    (lambda (file stat errno result)
+                                      (format (current-error-port)
+                                              "warning: failed to delete ~a: ~a~%"
+                                              file (strerror errno)))
+                                    #t
+                                    "Utilities"
+                                    lstat)
+                  #t))))
     (inputs
-     `(("curl" ,curl)
-       ("jsoncpp" ,jsoncpp)
-       ,@(alist-delete "curl" (package-inputs cmake-bootstrap))))
+     `(("jsoncpp" ,jsoncpp)
+       ,@(package-inputs cmake-bootstrap)))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -312,6 +296,15 @@ and workspaces that can be used in the compiler environment of your choice.")
        #: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")
+                              "/share/cmake-"
+                              ,(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
@@ -336,8 +329,6 @@ and workspaces that can be used in the compiler environment of your choice.")
     (inherit cmake-minimal)
     (name "cmake")
     (version "3.21.1")
-    ;; TODO: Move the following source field to the cmake-bootstrap package in
-    ;; the next rebuild cycle.
     (source (origin
               (inherit (package-source cmake-bootstrap))
               (uri (string-append "https://cmake.org/files/v"
@@ -345,29 +336,7 @@ and workspaces that can be used in the compiler environment of your choice.")
                                   "/cmake-" version ".tar.gz"))
               (sha256
                (base32
-                "1m7y9j5lafkrfswsg2vkpx2fz6p6fqpp2pcp2dcz5pylf58r3hzs"))
-              (snippet
-               (match (origin-snippet (package-source cmake-bootstrap))
-                 ((_ _ exp ...)
-                  ;; Now we can delete the remaining software bundles.
-                  (append `(begin
-                             (define preserved-files
-                               '(,@%preserved-third-party-files
-                                 ;; TODO: Move this file to the
-                                 ;; %preserved-third-party-files variable in
-                                 ;; the next rebuild cycle.
-                                 "Utilities/cm3p" ;CMake header wrappers
-                                 ;; Use the bundled JsonCpp during bootstrap
-                                 ;; to work around a circular dependency.
-                                 ;; TODO: JsonCpp can be built with Meson
-                                 ;; instead of CMake, but meson-build-system
-                                 ;; currently does not support
-                                 ;; cross-compilation.
-                                 "Utilities/cmjsoncpp"
-                                 ;; LibUV is required to bootstrap the initial
-                                 ;; build system.
-                                 "Utilities/cmlibuv")))
-                          exp))))))
+                "1m7y9j5lafkrfswsg2vkpx2fz6p6fqpp2pcp2dcz5pylf58r3hzs"))))
     (arguments
      (substitute-keyword-arguments (package-arguments cmake-minimal)
        ;; Use cmake-minimal this time.
@@ -389,44 +358,7 @@ and workspaces that can be used in the compiler environment of your choice.")
                  ,flags))
        ((#:phases phases)
         `(modify-phases ,phases
-           ;; TODO: Remove this override in the next rebuild cycle and adjust
-           ;; the %common-build-phases variable instead: the
-           ;; Utilities/Release/release_cmake.cmake file no longer exists in
-           ;; version 3.19.0.
-           (replace 'patch-bin-sh
-             (lambda _
-               ;; Replace "/bin/sh" by the right path in... a lot of
-               ;; files.
-               (substitute*
-                   '("Modules/CompilerId/Xcode-3.pbxproj.in"
-                     "Modules/Internal/CPack/CPack.RuntimeScript.in"
-                     "Source/cmGlobalXCodeGenerator.cxx"
-                     "Source/cmLocalUnixMakefileGenerator3.cxx"
-                     "Source/cmExecProgramCommand.cxx"
-                     "Tests/CMakeLists.txt"
-                     "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
-                 (("/bin/sh") (which "sh")))
-               #t))
-           ;; TODO: Remove this override in the next rebuild cycle and adjust
-           ;; the %common-disabled-tests variable instead.
-           (replace 'check
-             (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
-               (let ((skipped-tests (list ,@%common-disabled-tests
-                                          ;; This test fails for unknown reason.
-                                          "RunCMake.file-GET_RUNTIME_DEPENDENCIES"
-                                          ;; This test fails for unknown reason.
-                                          "ExportImport"
-                                          ;; 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)))
+           (delete 'delete-help-documentation)
            (add-after 'install 'move-html-doc
              (lambda* (#:key outputs #:allow-other-keys)
                (let ((out (assoc-ref outputs "out"))
@@ -439,6 +371,9 @@ and workspaces that can be used in the compiler environment of your choice.")
                                    (string-append doc html))
                  (delete-file-recursively (string-append out html))
                  #t)))))))
+    (inputs
+     `(("ncurses" ,ncurses)             ;required for ccmake
+       ,@(package-inputs cmake-minimal)))
     ;; Extra inputs required to build the documentation.
     (native-inputs
      `(,@(package-native-inputs cmake-minimal)