gnu: webkitgtk: Update to 2.28.2.
[jackhill/guix/guix.git] / gnu / packages / cmake.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
6 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
7 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
9 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
10 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages cmake)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix utils)
33 #:use-module (guix deprecation)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system emacs)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages backup)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages crypto)
40 #:use-module (gnu packages curl)
41 #:use-module (gnu packages file)
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages sphinx)
45 #:use-module (gnu packages texinfo)
46 #:use-module (gnu packages xml)
47 #:use-module (srfi srfi-1))
48
49 ;;; This minimal variant of CMake does not include the documentation. It is
50 ;;; used by the cmake-build-system.
51 (define-public cmake-minimal
52 (package
53 (name "cmake-minimal")
54 (version "3.15.1")
55 (source (origin
56 (method url-fetch)
57 (uri (string-append "https://www.cmake.org/files/v"
58 (version-major+minor version)
59 "/cmake-" version ".tar.gz"))
60 (sha256
61 (base32
62 "1xyprly3sf4wi0n1x79k4n22yxm6pb7fv70gqr9lvc7qv14cbphq"))
63 (modules '((guix build utils)))
64 (snippet
65 '(begin
66 ;; Drop bundled software.
67 (with-directory-excursion "Utilities"
68 (for-each delete-file-recursively
69 '("cmbzip2"
70 ;; "cmcompress"
71 "cmcurl"
72 "cmexpat"
73 ;; "cmjsoncpp"
74 ;; "cmlibarchive"
75 "cmliblzma"
76 ;; "cmlibuv"
77 "cmzlib"))
78 #t)))))
79 (build-system gnu-build-system)
80 (arguments
81 `(#:test-target "test"
82 #:configure-flags
83 (let ((out (assoc-ref %outputs "out"))
84 (parallel-job-count (number->string (parallel-job-count))))
85 (list "--verbose"
86 (string-append "--parallel=" parallel-job-count)
87 (string-append "--prefix=" out)
88 "--system-libs"
89 "--no-system-jsoncpp" ; FIXME: Circular dependency.
90 ;; By default, the man pages and other docs land
91 ;; in PREFIX/man and PREFIX/doc, but we want them
92 ;; in share/{man,doc}. Note that unlike
93 ;; autoconf-generated configure scripts, cmake's
94 ;; configure prepends "PREFIX/" to what we pass
95 ;; to --mandir and --docdir.
96 "--mandir=share/man"
97 ,(string-append "--docdir=share/doc/cmake-"
98 (version-major+minor version))))
99 #:make-flags
100 (let ((skipped-tests
101 (list "BundleUtilities" ; This test fails on Guix.
102 "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
103 ;; These tests requires network access.
104 "CTestCoverageCollectGCOV"
105 "CTestTestUpload")))
106 (list
107 (string-append
108 ;; These arguments apply for the tests only.
109 "ARGS=-j " (number->string (parallel-job-count))
110 " --output-on-failure"
111 " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
112 #:phases
113 (modify-phases %standard-phases
114 (add-after 'unpack 'split-package
115 ;; Remove files that have been packaged in other package recipes.
116 (lambda _
117 (delete-file "Auxiliary/cmake-mode.el")
118 (substitute* "Auxiliary/CMakeLists.txt"
119 ((".*cmake-mode.el.*") ""))
120 #t))
121 (add-before 'configure 'patch-bin-sh
122 (lambda _
123 ;; Replace "/bin/sh" by the right path in... a lot of
124 ;; files.
125 (substitute*
126 '("Modules/CompilerId/Xcode-3.pbxproj.in"
127 "Modules/CPack.RuntimeScript.in"
128 "Source/cmGlobalXCodeGenerator.cxx"
129 "Source/cmLocalUnixMakefileGenerator3.cxx"
130 "Source/cmExecProgramCommand.cxx"
131 "Utilities/Release/release_cmake.cmake"
132 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
133 "Tests/CMakeLists.txt"
134 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
135 (("/bin/sh") (which "sh")))
136 #t))
137 (add-before 'configure 'set-paths
138 (lambda _
139 ;; Help cmake's bootstrap process to find system libraries
140 (begin
141 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
142 (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
143 (getenv "C_INCLUDE_PATH")))
144 #t)))
145 ;; CMake uses its own configure script.
146 (replace 'configure
147 (lambda* (#:key (configure-flags '()) #:allow-other-keys)
148 (apply invoke "./configure" configure-flags))))))
149 (inputs
150 `(("bzip2" ,bzip2)
151 ("curl" ,curl)
152 ("expat" ,expat)
153 ("file" ,file)
154 ("libarchive" ,libarchive)
155 ("libuv" ,libuv)
156 ("ncurses" ,ncurses) ; required for ccmake
157 ("rhash" ,rhash)
158 ("zlib" ,zlib)))
159 (native-search-paths
160 (list (search-path-specification
161 (variable "CMAKE_PREFIX_PATH")
162 (files '("")))))
163 (home-page "https://cmake.org/")
164 (synopsis "Cross-platform build system")
165 (description
166 "CMake is a family of tools designed to build, test and package software.
167 CMake is used to control the software compilation process using simple platform
168 and compiler independent configuration files. CMake generates native makefiles
169 and workspaces that can be used in the compiler environment of your choice.")
170 (properties '((hidden? . #t)))
171 (license (list license:bsd-3 ; cmake
172 license:bsd-4 ; cmcompress
173 license:bsd-2 ; cmlibarchive
174 license:expat ; cmjsoncpp is dual MIT/public domain
175 license:public-domain)))) ; cmlibarchive/archive_getdate.c
176
177 (define-public cmake
178 (package
179 (inherit cmake-minimal)
180 (name "cmake")
181 (arguments
182 (substitute-keyword-arguments (package-arguments cmake-minimal)
183 ((#:configure-flags configure-flags ''())
184 `(append ,configure-flags
185 ;; Extra configure flags used to generate the documentation.
186 '("--sphinx-info"
187 "--sphinx-man"
188 "--sphinx-html")))
189 ((#:phases phases)
190 `(modify-phases ,phases
191 (add-after 'install 'move-html-doc
192 (lambda* (#:key outputs #:allow-other-keys)
193 (let ((out (assoc-ref outputs "out"))
194 (doc (assoc-ref outputs "doc"))
195 (html (string-append "/share/doc/cmake-"
196 ,(version-major+minor
197 (package-version cmake-minimal))
198 "/html")))
199 (copy-recursively (string-append out html)
200 (string-append doc html))
201 (delete-file-recursively (string-append out html))
202 #t)))))))
203 ;; Extra inputs required to build the documentation.
204 (native-inputs
205 `(,@(package-native-inputs cmake-minimal)
206 ("python-sphinx" ,python-sphinx)
207 ("texinfo" ,texinfo)))
208 (outputs '("out" "doc"))
209 (properties (alist-delete 'hidden? (package-properties cmake-minimal)))))
210
211 (define-public cmake-3.15.5
212 ;; CMake 3.15.5 fixes some issues, but declare another version to
213 ;; avoid triggering the rebuild of all CMake-based packages.
214 ;; See <https://issues.guix.gnu.org/issue/38060>.
215 ;;
216 ;; Furthermore, this variant fixes X.509 certificate lookup:
217 ;; <https://issues.guix.gnu.org/issue/37371>.
218 (package
219 (inherit cmake)
220 (version "3.15.5")
221 (source (origin
222 (inherit (package-source cmake))
223 (uri (string-append "https://www.cmake.org/files/v"
224 (version-major+minor version)
225 "/cmake-" version ".tar.gz"))
226 (sha256
227 (base32
228 "1d5y8d92axcc6rfqlsxamayfs3fc1vdby91hn5mx1kn02ppprpgv"))
229 (patches
230 (append (search-patches "cmake-curl-certificates.patch")
231 (origin-patches (package-source cmake))))))
232
233 (native-search-paths
234 ;; "cmake-curl-certificates.patch" changes CMake to honor 'SSL_CERT_DIR'
235 ;; and 'SSL_CERT_FILE', hence these search path entries.
236 (append (list (search-path-specification
237 (variable "SSL_CERT_DIR")
238 (separator #f) ;single entry
239 (files '("etc/ssl/certs")))
240 (search-path-specification
241 (variable "SSL_CERT_FILE")
242 (file-type 'regular)
243 (separator #f) ;single entry
244 (files '("etc/ssl/certs/ca-certificates.crt"))))
245 (package-native-search-paths cmake)))))
246
247 ;; This was cmake@3.15.1 plus "cmake-curl-certificates.patch".
248 (define-deprecated cmake/fixed cmake-3.15.5)
249 (export cmake/fixed)
250
251 (define-public emacs-cmake-mode
252 (package
253 (inherit cmake)
254 (name "emacs-cmake-mode")
255 (native-inputs '())
256 (inputs '())
257 (outputs '("out"))
258 (build-system emacs-build-system)
259 (arguments
260 `(#:phases
261 (modify-phases %standard-phases
262 (add-after 'unpack 'chdir-elisp
263 ;; Elisp directory is not in root of the source.
264 (lambda _
265 (chdir "Auxiliary")
266 #t)))))
267 (synopsis "Emacs major mode for editing Cmake expressions")
268 (description "@code{cmakeos-mode} provides an Emacs major mode for editing
269 Cmake files. It supports syntax highlighting, indenting and refilling of
270 comments.")))