diff options
| author | Marius Bakke <marius@gnu.org> | 2022-06-27 21:54:15 +0200 |
|---|---|---|
| committer | Marius Bakke <marius@gnu.org> | 2022-06-27 23:48:00 +0200 |
| commit | b1fa242cb1f6a35eb4999ffa80fb574b9fb50fd3 (patch) | |
| tree | 9830281cf11fc3edd2891a1c57122b9d8a17aac8 /gnu/packages/cmake.scm | |
| parent | 6cd881401112b1dae524aeb200283e07a7a26c68 (diff) | |
gnu: CMake: Use G-expressions.
* gnu/packages/cmake.scm (%common-build-phases): Remove trailing #t's.
(cmake-bootstrap, cmake-minimal, cmake, emacs-cmake-mode)[arguments]: Use
G-expressions.
Diffstat (limited to 'gnu/packages/cmake.scm')
| -rw-r--r-- | gnu/packages/cmake.scm | 225 |
1 files changed, 109 insertions, 116 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm index 4fb74a7c515..fe49bdf0fa4 100644 --- a/gnu/packages/cmake.scm +++ b/gnu/packages/cmake.scm | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | (define-module (gnu packages cmake) | 31 | (define-module (gnu packages cmake) |
| 32 | #:use-module ((guix licenses) #:prefix license:) | 32 | #:use-module ((guix licenses) #:prefix license:) |
| 33 | #:use-module (guix packages) | 33 | #:use-module (guix packages) |
| 34 | #:use-module (guix gexp) | ||
| 34 | #:use-module (guix download) | 35 | #:use-module (guix download) |
| 35 | #:use-module (guix git-download) | 36 | #:use-module (guix git-download) |
| 36 | #:use-module (guix utils) | 37 | #:use-module (guix utils) |
| @@ -99,8 +100,7 @@ using the CMake build system.") | |||
| 99 | (lambda _ | 100 | (lambda _ |
| 100 | (delete-file "Auxiliary/cmake-mode.el") | 101 | (delete-file "Auxiliary/cmake-mode.el") |
| 101 | (substitute* "Auxiliary/CMakeLists.txt" | 102 | (substitute* "Auxiliary/CMakeLists.txt" |
| 102 | ((".*cmake-mode.el.*") "")) | 103 | ((".*cmake-mode.el.*") "")))) |
| 103 | #t)) | ||
| 104 | ,@(if (target-x86-32?) | 104 | ,@(if (target-x86-32?) |
| 105 | '((add-after 'unpack 'skip-cpack-txz-test | 105 | '((add-after 'unpack 'skip-cpack-txz-test |
| 106 | (lambda _ | 106 | (lambda _ |
| @@ -124,8 +124,7 @@ using the CMake build system.") | |||
| 124 | "Source/cmExecProgramCommand.cxx" | 124 | "Source/cmExecProgramCommand.cxx" |
| 125 | "Tests/CMakeLists.txt" | 125 | "Tests/CMakeLists.txt" |
| 126 | "Tests/RunCMake/File_Generate/RunCMakeTest.cmake") | 126 | "Tests/RunCMake/File_Generate/RunCMakeTest.cmake") |
| 127 | (("/bin/sh") (which "sh"))) | 127 | (("/bin/sh") (which "sh"))))))) |
| 128 | #t)))) | ||
| 129 | 128 | ||
| 130 | (define %common-disabled-tests | 129 | (define %common-disabled-tests |
| 131 | '(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH, | 130 | '(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH, |
| @@ -163,55 +162,54 @@ using the CMake build system.") | |||
| 163 | (patches (search-patches "cmake-curl-certificates.patch")))) | 162 | (patches (search-patches "cmake-curl-certificates.patch")))) |
| 164 | (build-system gnu-build-system) | 163 | (build-system gnu-build-system) |
| 165 | (arguments | 164 | (arguments |
| 166 | `(#:test-target "test" | 165 | (list |
| 167 | #:configure-flags | 166 | #:test-target "test" |
| 168 | (let ((out (assoc-ref %outputs "out")) | 167 | #:configure-flags |
| 169 | (parallel-job-count (number->string (parallel-job-count)))) | 168 | #~(let ((parallel-job-count (number->string (parallel-job-count)))) |
| 170 | (list "--verbose" | 169 | (list "--verbose" |
| 171 | (string-append "--parallel=" parallel-job-count) | 170 | (string-append "--parallel=" parallel-job-count) |
| 172 | (string-append "--prefix=" out) | 171 | (string-append "--prefix=" #$output) |
| 173 | "--system-libs" | 172 | "--system-libs" |
| 174 | ;; By default, the man pages and other docs land | 173 | ;; By default, the man pages and other docs land |
| 175 | ;; in PREFIX/man and PREFIX/doc, but we want them | 174 | ;; in PREFIX/man and PREFIX/doc, but we want them |
| 176 | ;; in share/{man,doc}. Note that unlike | 175 | ;; in share/{man,doc}. Note that unlike |
| 177 | ;; autoconf-generated configure scripts, cmake's | 176 | ;; autoconf-generated configure scripts, cmake's |
| 178 | ;; configure prepends "PREFIX/" to what we pass | 177 | ;; configure prepends "PREFIX/" to what we pass |
| 179 | ;; to --mandir and --docdir. | 178 | ;; to --mandir and --docdir. |
| 180 | "--mandir=share/man" | 179 | "--mandir=share/man" |
| 181 | ,(string-append "--docdir=share/doc/cmake-" | 180 | (string-append "--docdir=share/doc/cmake-" |
| 182 | (version-major+minor version)) | 181 | #$(version-major+minor version)) |
| 183 | 182 | ||
| 184 | ;; By default CMake is built without any optimizations. Use | 183 | ;; By default CMake is built without any optimizations. Use |
| 185 | ;; the recommended Release target for a ~2.5x speedup. | 184 | ;; the recommended Release target for a ~2.5x speedup. |
| 186 | "--" "-DCMAKE_BUILD_TYPE=Release")) | 185 | "--" "-DCMAKE_BUILD_TYPE=Release")) |
| 187 | #:make-flags | 186 | #:make-flags |
| 188 | (let ((skipped-tests | 187 | #~(let ((skipped-tests |
| 189 | (list ,@%common-disabled-tests | 188 | (list #$@%common-disabled-tests |
| 190 | "CTestTestSubdir" ; This test fails to build 2 of the 3 tests. | 189 | "CTestTestSubdir" ; This test fails to build 2 of the 3 tests. |
| 191 | ;; This test fails when ARGS (below) is in use, see | 190 | ;; This test fails when ARGS (below) is in use, see |
| 192 | ;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>. | 191 | ;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>. |
| 193 | "CTestCoverageCollectGCOV"))) | 192 | "CTestCoverageCollectGCOV"))) |
| 194 | (list | 193 | (list |
| 195 | (string-append | 194 | (string-append |
| 196 | ;; These arguments apply for the tests only. | 195 | ;; These arguments apply for the tests only. |
| 197 | "ARGS=-j " (number->string (parallel-job-count)) | 196 | "ARGS=-j " (number->string (parallel-job-count)) |
| 198 | " --output-on-failure" | 197 | " --output-on-failure" |
| 199 | " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$"))) | 198 | " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$"))) |
| 200 | #:phases | 199 | #:phases |
| 201 | (modify-phases %standard-phases | 200 | #~(modify-phases %standard-phases |
| 202 | ,@(%common-build-phases) | 201 | #$@(%common-build-phases) |
| 203 | (add-before 'configure 'set-paths | 202 | (add-before 'configure 'set-paths |
| 204 | (lambda _ | 203 | (lambda _ |
| 205 | ;; Help cmake's bootstrap process to find system libraries | 204 | ;; Help cmake's bootstrap process to find system libraries |
| 206 | (begin | 205 | (begin |
| 207 | (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) | 206 | (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) |
| 208 | (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH") | 207 | (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH") |
| 209 | (getenv "C_INCLUDE_PATH"))) | 208 | (getenv "C_INCLUDE_PATH")))))) |
| 210 | #t))) | 209 | ;; CMake uses its own configure script. |
| 211 | ;; CMake uses its own configure script. | 210 | (replace 'configure |
| 212 | (replace 'configure | 211 | (lambda* (#:key (configure-flags '()) #:allow-other-keys) |
| 213 | (lambda* (#:key (configure-flags '()) #:allow-other-keys) | 212 | (apply invoke "./configure" configure-flags)))))) |
| 214 | (apply invoke "./configure" configure-flags)))))) | ||
| 215 | (inputs | 213 | (inputs |
| 216 | (append | 214 | (append |
| 217 | (if (hurd-target?) | 215 | (if (hurd-target?) |
| @@ -287,44 +285,43 @@ and workspaces that can be used in the compiler environment of your choice.") | |||
| 287 | #t)))) | 285 | #t)))) |
| 288 | (build-system cmake-build-system) | 286 | (build-system cmake-build-system) |
| 289 | (arguments | 287 | (arguments |
| 290 | `(#:configure-flags | 288 | (list |
| 291 | (list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON" | 289 | #:configure-flags |
| 292 | (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-" | 290 | #~(list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON" |
| 293 | ,(version-major+minor (package-version | 291 | (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-" |
| 294 | cmake-bootstrap)))) | 292 | #$(version-major+minor (package-version |
| 293 | cmake-bootstrap)))) | ||
| 295 | 294 | ||
| 296 | ;; This is the CMake used in cmake-build-system. Ensure compiler | 295 | ;; This is the CMake used in cmake-build-system. Ensure compiler |
| 297 | ;; optimizations are enabled to save size and CPU cycles. | 296 | ;; optimizations are enabled to save size and CPU cycles. |
| 298 | #:build-type "Release" | 297 | #:build-type "Release" |
| 299 | #:phases | 298 | #:phases |
| 300 | (modify-phases %standard-phases | 299 | #~(modify-phases %standard-phases |
| 301 | ,@(%common-build-phases) | 300 | #$@(%common-build-phases) |
| 302 | (add-after 'install 'delete-help-documentation | 301 | (add-after 'install 'delete-help-documentation |
| 303 | (lambda* (#:key outputs #:allow-other-keys) | 302 | (lambda _ |
| 304 | (delete-file-recursively | 303 | (delete-file-recursively |
| 305 | (string-append (assoc-ref outputs "out") | 304 | (string-append #$output |
| 306 | "/share/cmake-" | 305 | "/share/cmake-" |
| 307 | ,(version-major+minor | 306 | #$(version-major+minor |
| 308 | (package-version cmake-bootstrap)) | 307 | (package-version cmake-bootstrap)) |
| 309 | "/Help")) | 308 | "/Help")))) |
| 310 | #t)) | 309 | (replace 'check |
| 311 | (replace 'check | 310 | (lambda* (#:key tests? parallel-tests? #:allow-other-keys) |
| 312 | (lambda* (#:key tests? parallel-tests? #:allow-other-keys) | 311 | (let ((skipped-tests (list #$@%common-disabled-tests |
| 313 | (let ((skipped-tests (list ,@%common-disabled-tests | 312 | ;; This test requires the bundled libuv. |
| 314 | ;; This test requires the bundled libuv. | 313 | "BootstrapTest"))) |
| 315 | "BootstrapTest"))) | 314 | (if tests? |
| 316 | (if tests? | 315 | (begin |
| 317 | (begin | 316 | (invoke "ctest" "-j" (if parallel-tests? |
| 318 | (invoke "ctest" "-j" (if parallel-tests? | 317 | (number->string (parallel-job-count)) |
| 319 | (number->string (parallel-job-count)) | 318 | "1") |
| 320 | "1") | 319 | "--exclude-regex" |
| 321 | "--exclude-regex" | 320 | (string-append "^(" (string-join skipped-tests "|") ")$"))) |
| 322 | (string-append "^(" (string-join skipped-tests "|") ")$"))) | 321 | (format #t "test suite not run~%")))))) |
| 323 | (format #t "test suite not run~%")) | 322 | #:cmake (if (%current-target-system) |
| 324 | #t)))) | 323 | cmake-minimal-cross |
| 325 | ,@(if (%current-target-system) | 324 | cmake-bootstrap))))) |
| 326 | '() | ||
| 327 | `(#:cmake ,cmake-bootstrap)))))) | ||
| 328 | 325 | ||
| 329 | ;;; The "user-facing" CMake, now with manuals and HTML documentation. | 326 | ;;; The "user-facing" CMake, now with manuals and HTML documentation. |
| 330 | (define-public cmake | 327 | (define-public cmake |
| @@ -343,31 +340,28 @@ and workspaces that can be used in the compiler environment of your choice.") | |||
| 343 | ((#:build-type _ #f) "RelWithDebInfo") | 340 | ((#:build-type _ #f) "RelWithDebInfo") |
| 344 | 341 | ||
| 345 | ((#:configure-flags flags ''()) | 342 | ((#:configure-flags flags ''()) |
| 346 | `(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON" | 343 | #~(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON" |
| 347 | (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-" | 344 | (string-append "-DCMAKE_DOC_DIR=share/doc/cmake-" |
| 348 | ,(version-major+minor (package-version | 345 | #$(version-major+minor (package-version |
| 349 | cmake-minimal))) | 346 | cmake-minimal))) |
| 350 | "-DCMAKE_INFO_DIR=share/info" | 347 | "-DCMAKE_INFO_DIR=share/info" |
| 351 | "-DCMAKE_MAN_DIR=share/man") | 348 | "-DCMAKE_MAN_DIR=share/man") |
| 352 | ,flags)) | 349 | #$flags)) |
| 353 | ((#:phases phases) | 350 | ((#:phases phases) |
| 354 | `(modify-phases ,phases | 351 | #~(modify-phases #$phases |
| 355 | (delete 'delete-help-documentation) | 352 | (delete 'delete-help-documentation) |
| 356 | (add-after 'install 'move-html-doc | 353 | (add-after 'install 'move-html-doc |
| 357 | (lambda* (#:key outputs #:allow-other-keys) | 354 | (lambda _ |
| 358 | (let ((out (assoc-ref outputs "out")) | 355 | (let ((html (string-append "/share/doc/cmake-" |
| 359 | (doc (assoc-ref outputs "doc")) | 356 | #$(version-major+minor |
| 360 | (html (string-append "/share/doc/cmake-" | 357 | (package-version cmake-minimal)) |
| 361 | ,(version-major+minor | 358 | "/html"))) |
| 362 | (package-version cmake-minimal)) | 359 | (copy-recursively (string-append #$output html) |
| 363 | "/html"))) | 360 | (string-append #$output:doc html)) |
| 364 | (copy-recursively (string-append out html) | 361 | (delete-file-recursively (string-append #$output html))))))))) |
| 365 | (string-append doc html)) | ||
| 366 | (delete-file-recursively (string-append out html))))))))) | ||
| 367 | (inputs | 362 | (inputs |
| 368 | (modify-inputs (package-inputs cmake-minimal) | 363 | (modify-inputs (package-inputs cmake-minimal) |
| 369 | (prepend ncurses ;required for ccmake | 364 | (prepend ncurses))) ;required for ccmake |
| 370 | ))) | ||
| 371 | ;; Extra inputs required to build the documentation. | 365 | ;; Extra inputs required to build the documentation. |
| 372 | (native-inputs | 366 | (native-inputs |
| 373 | (modify-inputs (package-native-inputs cmake-minimal) | 367 | (modify-inputs (package-native-inputs cmake-minimal) |
| @@ -392,13 +386,12 @@ and workspaces that can be used in the compiler environment of your choice.") | |||
| 392 | (outputs '("out")) | 386 | (outputs '("out")) |
| 393 | (build-system emacs-build-system) | 387 | (build-system emacs-build-system) |
| 394 | (arguments | 388 | (arguments |
| 395 | `(#:phases | 389 | (list #:phases |
| 396 | (modify-phases %standard-phases | 390 | #~(modify-phases %standard-phases |
| 397 | (add-after 'unpack 'chdir-elisp | 391 | (add-after 'unpack 'chdir-elisp |
| 398 | ;; Elisp directory is not in root of the source. | 392 | ;; Elisp directory is not in root of the source. |
| 399 | (lambda _ | 393 | (lambda _ |
| 400 | (chdir "Auxiliary") | 394 | (chdir "Auxiliary")))))) |
| 401 | #t))))) | ||
| 402 | (synopsis "Emacs major mode for editing Cmake expressions") | 395 | (synopsis "Emacs major mode for editing Cmake expressions") |
| 403 | (description "@code{cmakeos-mode} provides an Emacs major mode for editing | 396 | (description "@code{cmakeos-mode} provides an Emacs major mode for editing |
| 404 | Cmake files. It supports syntax highlighting, indenting and refilling of | 397 | Cmake files. It supports syntax highlighting, indenting and refilling of |
