aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/cmake.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cmake.scm')
-rw-r--r--gnu/packages/cmake.scm212
1 files changed, 74 insertions, 138 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index df8885b4dd..3adda91fd3 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -5,10 +5,10 @@
;;; 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>
+;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
@@ -92,7 +92,7 @@ using the CMake build system.")
;;; Build phases shared between 'cmake-bootstrap' and the later variants
;;; that use cmake-build-system.
-(define %common-build-phases
+(define (%common-build-phases)
`((add-after 'unpack 'split-package
;; Remove files that have been packaged in other package recipes.
(lambda _
@@ -100,6 +100,17 @@ using the CMake build system.")
(substitute* "Auxiliary/CMakeLists.txt"
((".*cmake-mode.el.*") ""))
#t))
+ ,@(if (target-x86-32?)
+ '((add-after 'unpack 'skip-cpack-txz-test
+ (lambda _
+ ;; In 'RunCMake.CPack_TXZ', the 'TXZ/THREADED_ALL' test
+ ;; would occasionally fail on i686 with "Internal error
+ ;; initializing compression library: Cannot allocate
+ ;; memory": <https://issues.guix.gnu.org/50617>. Skip it.
+ (substitute* "Tests/RunCMake/CPack/RunCMakeTest.cmake"
+ (("THREADED_ALL \"TXZ;DEB\"")
+ "THREADED_ALL \"DEB\"")))))
+ '())
(add-before 'configure 'patch-bin-sh
(lambda _
;; Replace "/bin/sh" by the right path in... a lot of
@@ -110,7 +121,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")))
@@ -120,23 +130,27 @@ using the CMake build system.")
'(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH,
;; but does not cope with the file being read-only.
"BundleUtilities"
- ;; This test requires network access.
- "CTestTestUpload"
+ ;; These tests require network access.
+ "CTestTestUpload" "CMake.FileDownload"
;; 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.21.3")
(source (origin
(method url-fetch)
(uri (string-append "https://cmake.org/files/v"
@@ -144,49 +158,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))
+ "0kvrhgbrvm0lv7jshzd4nsvp3d5q1jkgal2d5kj4w4v58bghckfi"))
(patches (search-patches "cmake-curl-certificates.patch"))))
(build-system gnu-build-system)
(arguments
@@ -227,7 +199,7 @@ using the CMake build system.")
" --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
#:phases
(modify-phases %standard-phases
- ,@%common-build-phases
+ ,@(%common-build-phases)
(add-before 'configure 'set-paths
(lambda _
;; Help cmake's bootstrap process to find system libraries
@@ -242,14 +214,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 +258,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
@@ -311,7 +306,16 @@ and workspaces that can be used in the compiler environment of your choice.")
#:build-type "Release"
#:phases
(modify-phases %standard-phases
- ,@%common-build-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
@@ -335,39 +339,6 @@ and workspaces that can be used in the compiler environment of your choice.")
(package
(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"
- (version-major+minor version)
- "/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))))))
(arguments
(substitute-keyword-arguments (package-arguments cmake-minimal)
;; Use cmake-minimal this time.
@@ -389,44 +360,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"))
@@ -437,8 +371,10 @@ and workspaces that can be used in the compiler environment of your choice.")
"/html")))
(copy-recursively (string-append out html)
(string-append doc html))
- (delete-file-recursively (string-append out html))
- #t)))))))
+ (delete-file-recursively (string-append out html)))))))))
+ (inputs
+ `(("ncurses" ,ncurses) ;required for ccmake
+ ,@(package-inputs cmake-minimal)))
;; Extra inputs required to build the documentation.
(native-inputs
`(,@(package-native-inputs cmake-minimal)