summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-06-27 21:54:15 +0200
committerMarius Bakke <marius@gnu.org>2022-06-27 23:48:00 +0200
commitb1fa242cb1f6a35eb4999ffa80fb574b9fb50fd3 (patch)
tree9830281cf11fc3edd2891a1c57122b9d8a17aac8 /gnu
parent6cd881401112b1dae524aeb200283e07a7a26c68 (diff)
downloadguix-b1fa242cb1f6a35eb4999ffa80fb574b9fb50fd3.tar.gz
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')
-rw-r--r--gnu/packages/cmake.scm225
1 files changed, 109 insertions, 116 deletions
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 4fb74a7c51..fe49bdf0fa 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,
@@ -163,55 +162,54 @@ using the CMake build system.")
               (patches (search-patches "cmake-curl-certificates.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"
-               ;; 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
      (append
       (if (hurd-target?)
@@ -287,44 +285,43 @@ and workspaces that can be used in the compiler environment of your choice.")
                   #t))))
     (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
@@ -343,31 +340,28 @@ 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
-                )))
+       (prepend ncurses)))              ;required for ccmake
     ;; Extra inputs required to build the documentation.
     (native-inputs
      (modify-inputs (package-native-inputs cmake-minimal)
@@ -392,13 +386,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