gnu: cmake, cmake-minimal: Use cmake-build-system.
This allows removing the bundled LibUV in a subsequent commit. This commit alone makes no functional changes apart from the build system adjustments. * gnu/packages/cmake.scm (%common-build-phases, %common-disabled-tests): New variables. (cmake-bootstrap)[arguments]: Refactor to use the shared phases and tests. (cmake-minimal)[build-system]: Change to CMAKE-BUILD-SYSTEM. [arguments]: Adjust accordingly. (cmake)[arguments]: Likewise.master
parent
88b263465c
commit
013c5c23f9
|
@ -33,6 +33,7 @@
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (guix deprecation)
|
#:use-module (guix deprecation)
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
|
#:use-module (guix build-system cmake)
|
||||||
#:use-module (guix build-system emacs)
|
#:use-module (guix build-system emacs)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
#:use-module (gnu packages backup)
|
#:use-module (gnu packages backup)
|
||||||
|
@ -49,8 +50,63 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1))
|
#:use-module (srfi srfi-1))
|
||||||
|
|
||||||
;;; The "bootstrap" CMake. It is used to build the inputs of 'cmake-minimal'
|
;;; Build phases shared between 'cmake-bootstrap' and the later variants
|
||||||
;;; below, to prevent a cyclic dependency on cmake-build-system.
|
;;; that use cmake-build-system.
|
||||||
|
(define %common-build-phases
|
||||||
|
`((add-after 'unpack 'split-package
|
||||||
|
;; Remove files that have been packaged in other package recipes.
|
||||||
|
(lambda _
|
||||||
|
(delete-file "Auxiliary/cmake-mode.el")
|
||||||
|
(substitute* "Auxiliary/CMakeLists.txt"
|
||||||
|
((".*cmake-mode.el.*") ""))
|
||||||
|
#t))
|
||||||
|
(add-after 'unpack 'use-system-libarchive
|
||||||
|
;; 'Source/cm_get_date.c' includes archive_getdate.c wholesale,
|
||||||
|
;; so it needs to be available along with the header file.
|
||||||
|
(lambda* (#:key native-inputs inputs #:allow-other-keys)
|
||||||
|
(let ((libarchive-source (assoc-ref (or native-inputs inputs)
|
||||||
|
"libarchive:source"))
|
||||||
|
;; XXX: We can not use ,(package-version libarchive) here due to
|
||||||
|
;; a cyclic module reference at the top-level.
|
||||||
|
(libarchive-version "3.4.1")
|
||||||
|
(files-to-unpack '("libarchive/archive_getdate.c"
|
||||||
|
"libarchive/archive_getdate.h")))
|
||||||
|
(mkdir-p "Utilities/cmlibarchive")
|
||||||
|
(apply invoke "tar" "-xvf" libarchive-source
|
||||||
|
"--strip-components=1"
|
||||||
|
"-C" "Utilities/cmlibarchive"
|
||||||
|
(map (lambda (file)
|
||||||
|
(string-append "libarchive-" libarchive-version
|
||||||
|
"/" file))
|
||||||
|
files-to-unpack))
|
||||||
|
#t)))
|
||||||
|
(add-before 'configure '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"
|
||||||
|
"Utilities/Release/release_cmake.cmake"
|
||||||
|
"Tests/CMakeLists.txt"
|
||||||
|
"Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
|
||||||
|
(("/bin/sh") (which "sh")))
|
||||||
|
#t))))
|
||||||
|
|
||||||
|
(define %common-disabled-tests
|
||||||
|
'(;; 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"
|
||||||
|
;; This test requires 'ldconfig' which is not available in Guix.
|
||||||
|
"RunCMake.install"))
|
||||||
|
|
||||||
|
;;; 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
|
(define-public cmake-bootstrap
|
||||||
(package
|
(package
|
||||||
(name "cmake-bootstrap")
|
(name "cmake-bootstrap")
|
||||||
|
@ -78,17 +134,13 @@
|
||||||
(and (string-prefix? "cm" file)
|
(and (string-prefix? "cm" file)
|
||||||
(eq? 'directory (stat:type (stat file)))
|
(eq? 'directory (stat:type (stat file)))
|
||||||
|
|
||||||
;; jsoncpp must be kept around for now to
|
;; These inputs are required to bootstrap
|
||||||
;; work around a circular dependency. It
|
;; the initial build system. They are
|
||||||
;; gets deleted once we reach "cmake-minimal".
|
;; deleted in 'cmake-minimal' below.
|
||||||
;; TODO: Consider building jsoncpp with
|
;; TODO: Consider building jsoncpp with
|
||||||
;; Meson instead, once meson-build-system
|
;; Meson instead, once meson-build-system
|
||||||
;; learns cross-compilation.
|
;; learns cross-compilation.
|
||||||
(not (string=? "cmjsoncpp" file))
|
(not (string=? "cmjsoncpp" file))
|
||||||
|
|
||||||
;; XXX: cmake's bootstrap script appears to
|
|
||||||
;; rquire libuv, even though it detects and
|
|
||||||
;; uses the system version eventually.
|
|
||||||
(not (string=? "cmlibuv" file)))))))
|
(not (string=? "cmlibuv" file)))))))
|
||||||
#t))
|
#t))
|
||||||
(patches (search-patches "cmake-curl-certificates.patch"))))
|
(patches (search-patches "cmake-curl-certificates.patch"))))
|
||||||
|
@ -118,13 +170,11 @@
|
||||||
"--" "-DCMAKE_BUILD_TYPE=Release"))
|
"--" "-DCMAKE_BUILD_TYPE=Release"))
|
||||||
#:make-flags
|
#:make-flags
|
||||||
(let ((skipped-tests
|
(let ((skipped-tests
|
||||||
(list "BundleUtilities" ; This test fails on Guix.
|
(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 requires 'ldconfig' which is not available in Guix.
|
;; This test fails when ARGS (below) is in use, see
|
||||||
"RunCMake.install"
|
;; <https://gitlab.kitware.com/cmake/cmake/issues/17165>.
|
||||||
;; These tests requires network access.
|
"CTestCoverageCollectGCOV")))
|
||||||
"CTestCoverageCollectGCOV"
|
|
||||||
"CTestTestUpload")))
|
|
||||||
(list
|
(list
|
||||||
(string-append
|
(string-append
|
||||||
;; These arguments apply for the tests only.
|
;; These arguments apply for the tests only.
|
||||||
|
@ -133,46 +183,7 @@
|
||||||
" --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
|
" --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'split-package
|
,@%common-build-phases
|
||||||
;; Remove files that have been packaged in other package recipes.
|
|
||||||
(lambda _
|
|
||||||
(delete-file "Auxiliary/cmake-mode.el")
|
|
||||||
(substitute* "Auxiliary/CMakeLists.txt"
|
|
||||||
((".*cmake-mode.el.*") ""))
|
|
||||||
#t))
|
|
||||||
(add-after 'unpack 'use-system-libarchive
|
|
||||||
(lambda* (#:key native-inputs inputs #:allow-other-keys)
|
|
||||||
(let ((libarchive-source (assoc-ref (or native-inputs inputs)
|
|
||||||
"libarchive:source"))
|
|
||||||
(libarchive-version ,(package-version libarchive))
|
|
||||||
(files-to-unpack '("libarchive/archive_getdate.c"
|
|
||||||
"libarchive/archive_getdate.h")))
|
|
||||||
;; XXX: Source/cm_get_date.c includes archive_getdate.c wholesale,
|
|
||||||
;; so it needs to be available along with the header file.
|
|
||||||
(mkdir-p "Utilities/cmlibarchive")
|
|
||||||
(apply invoke "tar" "-xvf" libarchive-source
|
|
||||||
"--strip-components=1"
|
|
||||||
"-C" "Utilities/cmlibarchive"
|
|
||||||
(map (lambda (file)
|
|
||||||
(string-append "libarchive-" libarchive-version
|
|
||||||
"/" file))
|
|
||||||
files-to-unpack))
|
|
||||||
#t)))
|
|
||||||
(add-before 'configure '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"
|
|
||||||
"Utilities/Release/release_cmake.cmake"
|
|
||||||
"Tests/CMakeLists.txt"
|
|
||||||
"Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
|
|
||||||
(("/bin/sh") (which "sh")))
|
|
||||||
#t))
|
|
||||||
(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
|
||||||
|
@ -187,8 +198,6 @@
|
||||||
(apply invoke "./configure" configure-flags))))))
|
(apply invoke "./configure" configure-flags))))))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("bzip2" ,bzip2)
|
`(("bzip2" ,bzip2)
|
||||||
;; cURL depends on ghostscript (via groff and OpenLDAP), which depends on
|
|
||||||
;; 'cmake-build-system' through libtiff and ultimately libjpeg-turbo.
|
|
||||||
("curl" ,curl-minimal)
|
("curl" ,curl-minimal)
|
||||||
("expat" ,expat)
|
("expat" ,expat)
|
||||||
("file" ,file)
|
("file" ,file)
|
||||||
|
@ -243,10 +252,37 @@ and workspaces that can be used in the compiler environment of your choice.")
|
||||||
`(("curl" ,curl)
|
`(("curl" ,curl)
|
||||||
("jsoncpp" ,jsoncpp)
|
("jsoncpp" ,jsoncpp)
|
||||||
,@(alist-delete "curl" (package-native-inputs cmake-bootstrap))))
|
,@(alist-delete "curl" (package-native-inputs cmake-bootstrap))))
|
||||||
|
(build-system cmake-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments cmake-bootstrap)
|
`(#:configure-flags
|
||||||
((#:configure-flags flags ''())
|
(list "-DCMAKE_USE_SYSTEM_LIBRARIES=ON"
|
||||||
`(delete "--no-system-jsoncpp" ,flags))))))
|
(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
|
||||||
|
(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))))))
|
||||||
|
|
||||||
;;; 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
|
||||||
|
@ -255,12 +291,19 @@ and workspaces that can be used in the compiler environment of your choice.")
|
||||||
(name "cmake")
|
(name "cmake")
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments cmake-minimal)
|
(substitute-keyword-arguments (package-arguments cmake-minimal)
|
||||||
((#:configure-flags configure-flags ''())
|
;; Use cmake-minimal this time.
|
||||||
`(append ,configure-flags
|
((#:cmake _ #f)
|
||||||
;; Extra configure flags used to generate the documentation.
|
(if (%current-target-system)
|
||||||
'("--sphinx-info"
|
cmake-minimal-cross
|
||||||
"--sphinx-man"
|
cmake-minimal))
|
||||||
"--sphinx-html")))
|
((#: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))
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(modify-phases ,phases
|
`(modify-phases ,phases
|
||||||
(add-after 'install 'move-html-doc
|
(add-after 'install 'move-html-doc
|
||||||
|
|
Reference in New Issue