gnu: sbcl-cl-cffi-gtk: Update to 20200417.
[jackhill/guix/guix.git] / gnu / packages / cmake.scm
CommitLineData
b6a64843
CR
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
6212b8e5 3;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
c824d34f 4;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
29a7c98a 5;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
477a752e 6;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
3b698589 7;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
1568cc14 8;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
89db6c6d 9;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
4f3958da 10;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
2f33a732 11;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
b6a64843
CR
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)
db909bf2 29 #:use-module ((guix licenses) #:prefix license:)
b6a64843
CR
30 #:use-module (guix packages)
31 #:use-module (guix download)
29a7c98a 32 #:use-module (guix utils)
0de28f9e 33 #:use-module (guix deprecation)
b6a64843 34 #:use-module (guix build-system gnu)
aa4818c3 35 #:use-module (guix build-system emacs)
b6a64843 36 #:use-module (gnu packages)
c824d34f
EB
37 #:use-module (gnu packages backup)
38 #:use-module (gnu packages compression)
1568cc14 39 #:use-module (gnu packages crypto)
c824d34f 40 #:use-module (gnu packages curl)
6212b8e5 41 #:use-module (gnu packages file)
4bbb7d48 42 #:use-module (gnu packages libevent)
21e5e1e0 43 #:use-module (gnu packages ncurses)
57df83e0 44 #:use-module (gnu packages sphinx)
2f33a732
MC
45 #:use-module (gnu packages texinfo)
46 #:use-module (gnu packages xml)
47 #:use-module (srfi srfi-1))
b6a64843 48
2f33a732
MC
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
b6a64843 52 (package
2f33a732 53 (name "cmake-minimal")
14767d44 54 (version "3.15.1")
b6a64843 55 (source (origin
12420c80
AI
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
14767d44 62 "1xyprly3sf4wi0n1x79k4n22yxm6pb7fv70gqr9lvc7qv14cbphq"))
12420c80
AI
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)))))
b6a64843
CR
79 (build-system gnu-build-system)
80 (arguments
6212b8e5 81 `(#:test-target "test"
2f33a732
MC
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))))
89db6c6d
AI
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.
89db6c6d
AI
103 ;; These tests requires network access.
104 "CTestCoverageCollectGCOV"
105 "CTestTestUpload")))
106 (list
107 (string-append
12cb6c31
MB
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 "\\|") "\\)$")))
6e261af1
EF
112 #:phases
113 (modify-phases %standard-phases
ffd526e6
OP
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))
6e261af1
EF
121 (add-before 'configure 'patch-bin-sh
122 (lambda _
12420c80
AI
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"
12420c80 128 "Source/cmGlobalXCodeGenerator.cxx"
12420c80
AI
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")
4bbb7d48 135 (("/bin/sh") (which "sh")))
12420c80 136 #t))
6e261af1
EF
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"))
546bee40
MB
142 (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH")
143 (getenv "C_INCLUDE_PATH")))
4bbb7d48 144 #t)))
2f33a732 145 ;; CMake uses its own configure script.
6e261af1 146 (replace 'configure
2f33a732
MC
147 (lambda* (#:key (configure-flags '()) #:allow-other-keys)
148 (apply invoke "./configure" configure-flags))))))
b6a64843 149 (inputs
89db6c6d
AI
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)))
0d6f9360
AE
159 (native-search-paths
160 (list (search-path-specification
89db6c6d
AI
161 (variable "CMAKE_PREFIX_PATH")
162 (files '("")))))
163 (home-page "https://cmake.org/")
749b90a5 164 (synopsis "Cross-platform build system")
b6a64843
CR
165 (description
166 "CMake is a family of tools designed to build, test and package software.
167CMake is used to control the software compilation process using simple platform
c824d34f 168and compiler independent configuration files. CMake generates native makefiles
b6a64843 169and workspaces that can be used in the compiler environment of your choice.")
2f33a732
MC
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
db909bf2 175 license:public-domain)))) ; cmlibarchive/archive_getdate.c
1568cc14 176
2f33a732
MC
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
528b5239
IVB
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>.
0de28f9e
LC
215 ;;
216 ;; Furthermore, this variant fixes X.509 certificate lookup:
217 ;; <https://issues.guix.gnu.org/issue/37371>.
528b5239
IVB
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
0de28f9e
LC
228 "1d5y8d92axcc6rfqlsxamayfs3fc1vdby91hn5mx1kn02ppprpgv"))
229 (patches
230 (append (search-patches "cmake-curl-certificates.patch")
79154f0a
LC
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)))))
0de28f9e
LC
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)
528b5239 250
bbdf3666
OP
251(define-public emacs-cmake-mode
252 (package
253 (inherit cmake)
254 (name "emacs-cmake-mode")
5a7c6d02
MB
255 (native-inputs '())
256 (inputs '())
257 (outputs '("out"))
bbdf3666
OP
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 _
5a7c6d02
MB
265 (chdir "Auxiliary")
266 #t)))))
bbdf3666
OP
267 (synopsis "Emacs major mode for editing Cmake expressions")
268 (description "@code{cmakeos-mode} provides an Emacs major mode for editing
269Cmake files. It supports syntax highlighting, indenting and refilling of
270comments.")))