mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 06:18:07 -05:00
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.
This commit is contained in:
parent
6cd8814011
commit
b1fa242cb1
1 changed files with 109 additions and 116 deletions
|
@ -31,6 +31,7 @@
|
||||||
(define-module (gnu packages cmake)
|
(define-module (gnu packages cmake)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
@ -99,8 +100,7 @@ (define (%common-build-phases)
|
||||||
(lambda _
|
(lambda _
|
||||||
(delete-file "Auxiliary/cmake-mode.el")
|
(delete-file "Auxiliary/cmake-mode.el")
|
||||||
(substitute* "Auxiliary/CMakeLists.txt"
|
(substitute* "Auxiliary/CMakeLists.txt"
|
||||||
((".*cmake-mode.el.*") ""))
|
((".*cmake-mode.el.*") ""))))
|
||||||
#t))
|
|
||||||
,@(if (target-x86-32?)
|
,@(if (target-x86-32?)
|
||||||
'((add-after 'unpack 'skip-cpack-txz-test
|
'((add-after 'unpack 'skip-cpack-txz-test
|
||||||
(lambda _
|
(lambda _
|
||||||
|
@ -124,8 +124,7 @@ (define (%common-build-phases)
|
||||||
"Source/cmExecProgramCommand.cxx"
|
"Source/cmExecProgramCommand.cxx"
|
||||||
"Tests/CMakeLists.txt"
|
"Tests/CMakeLists.txt"
|
||||||
"Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
|
"Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
|
||||||
(("/bin/sh") (which "sh")))
|
(("/bin/sh") (which "sh")))))))
|
||||||
#t))))
|
|
||||||
|
|
||||||
(define %common-disabled-tests
|
(define %common-disabled-tests
|
||||||
'(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH,
|
'(;; This test copies libgcc_s.so.1 from GCC and tries to modify its RPATH,
|
||||||
|
@ -163,55 +162,54 @@ (define-public cmake-bootstrap
|
||||||
(patches (search-patches "cmake-curl-certificates.patch"))))
|
(patches (search-patches "cmake-curl-certificates.patch"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:test-target "test"
|
(list
|
||||||
#:configure-flags
|
#:test-target "test"
|
||||||
(let ((out (assoc-ref %outputs "out"))
|
#:configure-flags
|
||||||
(parallel-job-count (number->string (parallel-job-count))))
|
#~(let ((parallel-job-count (number->string (parallel-job-count))))
|
||||||
(list "--verbose"
|
(list "--verbose"
|
||||||
(string-append "--parallel=" parallel-job-count)
|
(string-append "--parallel=" parallel-job-count)
|
||||||
(string-append "--prefix=" out)
|
(string-append "--prefix=" #$output)
|
||||||
"--system-libs"
|
"--system-libs"
|
||||||
;; By default, the man pages and other docs land
|
;; By default, the man pages and other docs land
|
||||||
;; in PREFIX/man and PREFIX/doc, but we want them
|
;; in PREFIX/man and PREFIX/doc, but we want them
|
||||||
;; in share/{man,doc}. Note that unlike
|
;; in share/{man,doc}. Note that unlike
|
||||||
;; autoconf-generated configure scripts, cmake's
|
;; autoconf-generated configure scripts, cmake's
|
||||||
;; configure prepends "PREFIX/" to what we pass
|
;; configure prepends "PREFIX/" to what we pass
|
||||||
;; to --mandir and --docdir.
|
;; to --mandir and --docdir.
|
||||||
"--mandir=share/man"
|
"--mandir=share/man"
|
||||||
,(string-append "--docdir=share/doc/cmake-"
|
(string-append "--docdir=share/doc/cmake-"
|
||||||
(version-major+minor version))
|
#$(version-major+minor version))
|
||||||
|
|
||||||
;; By default CMake is built without any optimizations. Use
|
;; By default CMake is built without any optimizations. Use
|
||||||
;; the recommended Release target for a ~2.5x speedup.
|
;; the recommended Release target for a ~2.5x speedup.
|
||||||
"--" "-DCMAKE_BUILD_TYPE=Release"))
|
"--" "-DCMAKE_BUILD_TYPE=Release"))
|
||||||
#:make-flags
|
#:make-flags
|
||||||
(let ((skipped-tests
|
#~(let ((skipped-tests
|
||||||
(list ,@%common-disabled-tests
|
(list #$@%common-disabled-tests
|
||||||
"CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
|
"CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
|
||||||
;; This test fails when ARGS (below) is in use, see
|
;; This test fails when ARGS (below) is in use, see
|
||||||
;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>.
|
;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>.
|
||||||
"CTestCoverageCollectGCOV")))
|
"CTestCoverageCollectGCOV")))
|
||||||
(list
|
(list
|
||||||
(string-append
|
(string-append
|
||||||
;; These arguments apply for the tests only.
|
;; These arguments apply for the tests only.
|
||||||
"ARGS=-j " (number->string (parallel-job-count))
|
"ARGS=-j " (number->string (parallel-job-count))
|
||||||
" --output-on-failure"
|
" --output-on-failure"
|
||||||
" --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
|
" --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
,@(%common-build-phases)
|
#$@(%common-build-phases)
|
||||||
(add-before 'configure 'set-paths
|
(add-before 'configure 'set-paths
|
||||||
(lambda _
|
(lambda _
|
||||||
;; Help cmake's bootstrap process to find system libraries
|
;; Help cmake's bootstrap process to find system libraries
|
||||||
(begin
|
(begin
|
||||||
(setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
|
(setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
|
||||||
(setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
|
(setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
|
||||||
(getenv "C_INCLUDE_PATH")))
|
(getenv "C_INCLUDE_PATH"))))))
|
||||||
#t)))
|
;; CMake uses its own configure script.
|
||||||
;; CMake uses its own configure script.
|
(replace 'configure
|
||||||
(replace 'configure
|
(lambda* (#:key (configure-flags '()) #:allow-other-keys)
|
||||||
(lambda* (#:key (configure-flags '()) #:allow-other-keys)
|
(apply invoke "./configure" configure-flags))))))
|
||||||
(apply invoke "./configure" configure-flags))))))
|
|
||||||
(inputs
|
(inputs
|
||||||
(append
|
(append
|
||||||
(if (hurd-target?)
|
(if (hurd-target?)
|
||||||
|
@ -287,44 +285,43 @@ (define preserved-files ',%preserved-third-party-files)
|
||||||
#t))))
|
#t))))
|
||||||
(build-system cmake-build-system)
|
(build-system cmake-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:configure-flags
|
(list
|
||||||
(list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON"
|
#:configure-flags
|
||||||
(string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
|
#~(list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON"
|
||||||
,(version-major+minor (package-version
|
(string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
|
||||||
cmake-bootstrap))))
|
#$(version-major+minor (package-version
|
||||||
|
cmake-bootstrap))))
|
||||||
|
|
||||||
;; This is the CMake used in cmake-build-system. Ensure compiler
|
;; This is the CMake used in cmake-build-system. Ensure compiler
|
||||||
;; optimizations are enabled to save size and CPU cycles.
|
;; optimizations are enabled to save size and CPU cycles.
|
||||||
#:build-type "Release"
|
#:build-type "Release"
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
,@(%common-build-phases)
|
#$@(%common-build-phases)
|
||||||
(add-after 'install 'delete-help-documentation
|
(add-after 'install 'delete-help-documentation
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda _
|
||||||
(delete-file-recursively
|
(delete-file-recursively
|
||||||
(string-append (assoc-ref outputs "out")
|
(string-append #$output
|
||||||
"/share/cmake-"
|
"/share/cmake-"
|
||||||
,(version-major+minor
|
#$(version-major+minor
|
||||||
(package-version cmake-bootstrap))
|
(package-version cmake-bootstrap))
|
||||||
"/Help"))
|
"/Help"))))
|
||||||
#t))
|
(replace 'check
|
||||||
(replace 'check
|
(lambda* (#:key tests? parallel-tests? #:allow-other-keys)
|
||||||
(lambda* (#:key tests? parallel-tests? #:allow-other-keys)
|
(let ((skipped-tests (list #$@%common-disabled-tests
|
||||||
(let ((skipped-tests (list ,@%common-disabled-tests
|
;; This test requires the bundled libuv.
|
||||||
;; This test requires the bundled libuv.
|
"BootstrapTest")))
|
||||||
"BootstrapTest")))
|
(if tests?
|
||||||
(if tests?
|
(begin
|
||||||
(begin
|
(invoke "ctest" "-j" (if parallel-tests?
|
||||||
(invoke "ctest" "-j" (if parallel-tests?
|
(number->string (parallel-job-count))
|
||||||
(number->string (parallel-job-count))
|
"1")
|
||||||
"1")
|
"--exclude-regex"
|
||||||
"--exclude-regex"
|
(string-append "^(" (string-join skipped-tests "|") ")$")))
|
||||||
(string-append "^(" (string-join skipped-tests "|") ")$")))
|
(format #t "test suite not run~%"))))))
|
||||||
(format #t "test suite not run~%"))
|
#:cmake (if (%current-target-system)
|
||||||
#t))))
|
cmake-minimal-cross
|
||||||
,@(if (%current-target-system)
|
cmake-bootstrap)))))
|
||||||
'()
|
|
||||||
`(#:cmake ,cmake-bootstrap))))))
|
|
||||||
|
|
||||||
;;; The "user-facing" CMake, now with manuals and HTML documentation.
|
;;; The "user-facing" CMake, now with manuals and HTML documentation.
|
||||||
(define-public cmake
|
(define-public cmake
|
||||||
|
@ -343,31 +340,28 @@ (define-public cmake
|
||||||
((#:build-type _ #f) "RelWithDebInfo")
|
((#:build-type _ #f) "RelWithDebInfo")
|
||||||
|
|
||||||
((#:configure-flags flags ''())
|
((#:configure-flags flags ''())
|
||||||
`(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON"
|
#~(append (list "-DSPHINX_INFO=ON" "-DSPHINX_MAN=ON" "-DSPHINX_HTML=ON"
|
||||||
(string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
|
(string-append "-DCMAKE_DOC_DIR=share/doc/cmake-"
|
||||||
,(version-major+minor (package-version
|
#$(version-major+minor (package-version
|
||||||
cmake-minimal)))
|
cmake-minimal)))
|
||||||
"-DCMAKE_INFO_DIR=share/info"
|
"-DCMAKE_INFO_DIR=share/info"
|
||||||
"-DCMAKE_MAN_DIR=share/man")
|
"-DCMAKE_MAN_DIR=share/man")
|
||||||
,flags))
|
#$flags))
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(modify-phases ,phases
|
#~(modify-phases #$phases
|
||||||
(delete 'delete-help-documentation)
|
(delete 'delete-help-documentation)
|
||||||
(add-after 'install 'move-html-doc
|
(add-after 'install 'move-html-doc
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda _
|
||||||
(let ((out (assoc-ref outputs "out"))
|
(let ((html (string-append "/share/doc/cmake-"
|
||||||
(doc (assoc-ref outputs "doc"))
|
#$(version-major+minor
|
||||||
(html (string-append "/share/doc/cmake-"
|
(package-version cmake-minimal))
|
||||||
,(version-major+minor
|
"/html")))
|
||||||
(package-version cmake-minimal))
|
(copy-recursively (string-append #$output html)
|
||||||
"/html")))
|
(string-append #$output:doc html))
|
||||||
(copy-recursively (string-append out html)
|
(delete-file-recursively (string-append #$output html)))))))))
|
||||||
(string-append doc html))
|
|
||||||
(delete-file-recursively (string-append out html)))))))))
|
|
||||||
(inputs
|
(inputs
|
||||||
(modify-inputs (package-inputs cmake-minimal)
|
(modify-inputs (package-inputs cmake-minimal)
|
||||||
(prepend ncurses ;required for ccmake
|
(prepend ncurses))) ;required for ccmake
|
||||||
)))
|
|
||||||
;; Extra inputs required to build the documentation.
|
;; Extra inputs required to build the documentation.
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(modify-inputs (package-native-inputs cmake-minimal)
|
(modify-inputs (package-native-inputs cmake-minimal)
|
||||||
|
@ -392,13 +386,12 @@ (define-public emacs-cmake-mode
|
||||||
(outputs '("out"))
|
(outputs '("out"))
|
||||||
(build-system emacs-build-system)
|
(build-system emacs-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:phases
|
(list #:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'chdir-elisp
|
(add-after 'unpack 'chdir-elisp
|
||||||
;; Elisp directory is not in root of the source.
|
;; Elisp directory is not in root of the source.
|
||||||
(lambda _
|
(lambda _
|
||||||
(chdir "Auxiliary")
|
(chdir "Auxiliary"))))))
|
||||||
#t)))))
|
|
||||||
(synopsis "Emacs major mode for editing Cmake expressions")
|
(synopsis "Emacs major mode for editing Cmake expressions")
|
||||||
(description "@code{cmakeos-mode} provides an Emacs major mode for editing
|
(description "@code{cmakeos-mode} provides an Emacs major mode for editing
|
||||||
Cmake files. It supports syntax highlighting, indenting and refilling of
|
Cmake files. It supports syntax highlighting, indenting and refilling of
|
||||||
|
|
Loading…
Reference in a new issue