Commit | Line | Data |
---|---|---|
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) |
b6a64843 | 33 | #:use-module (guix build-system gnu) |
aa4818c3 | 34 | #:use-module (guix build-system emacs) |
b6a64843 | 35 | #:use-module (gnu packages) |
c824d34f EB |
36 | #:use-module (gnu packages backup) |
37 | #:use-module (gnu packages compression) | |
1568cc14 | 38 | #:use-module (gnu packages crypto) |
c824d34f | 39 | #:use-module (gnu packages curl) |
6212b8e5 | 40 | #:use-module (gnu packages file) |
4bbb7d48 | 41 | #:use-module (gnu packages libevent) |
21e5e1e0 | 42 | #:use-module (gnu packages ncurses) |
57df83e0 | 43 | #:use-module (gnu packages sphinx) |
2f33a732 MC |
44 | #:use-module (gnu packages texinfo) |
45 | #:use-module (gnu packages xml) | |
46 | #:use-module (srfi srfi-1)) | |
b6a64843 | 47 | |
2f33a732 MC |
48 | ;;; This minimal variant of CMake does not include the documentation. It is |
49 | ;;; used by the cmake-build-system. | |
50 | (define-public cmake-minimal | |
b6a64843 | 51 | (package |
2f33a732 | 52 | (name "cmake-minimal") |
14767d44 | 53 | (version "3.15.1") |
b6a64843 | 54 | (source (origin |
12420c80 AI |
55 | (method url-fetch) |
56 | (uri (string-append "https://www.cmake.org/files/v" | |
57 | (version-major+minor version) | |
58 | "/cmake-" version ".tar.gz")) | |
59 | (sha256 | |
60 | (base32 | |
14767d44 | 61 | "1xyprly3sf4wi0n1x79k4n22yxm6pb7fv70gqr9lvc7qv14cbphq")) |
12420c80 AI |
62 | (modules '((guix build utils))) |
63 | (snippet | |
64 | '(begin | |
65 | ;; Drop bundled software. | |
66 | (with-directory-excursion "Utilities" | |
67 | (for-each delete-file-recursively | |
68 | '("cmbzip2" | |
69 | ;; "cmcompress" | |
70 | "cmcurl" | |
71 | "cmexpat" | |
72 | ;; "cmjsoncpp" | |
73 | ;; "cmlibarchive" | |
74 | "cmliblzma" | |
75 | ;; "cmlibuv" | |
76 | "cmzlib")) | |
77 | #t))))) | |
b6a64843 CR |
78 | (build-system gnu-build-system) |
79 | (arguments | |
6212b8e5 | 80 | `(#:test-target "test" |
2f33a732 MC |
81 | #:configure-flags |
82 | (let ((out (assoc-ref %outputs "out")) | |
83 | (parallel-job-count (number->string (parallel-job-count)))) | |
84 | (list "--verbose" | |
85 | (string-append "--parallel=" parallel-job-count) | |
86 | (string-append "--prefix=" out) | |
87 | "--system-libs" | |
88 | "--no-system-jsoncpp" ; FIXME: Circular dependency. | |
89 | ;; By default, the man pages and other docs land | |
90 | ;; in PREFIX/man and PREFIX/doc, but we want them | |
91 | ;; in share/{man,doc}. Note that unlike | |
92 | ;; autoconf-generated configure scripts, cmake's | |
93 | ;; configure prepends "PREFIX/" to what we pass | |
94 | ;; to --mandir and --docdir. | |
95 | "--mandir=share/man" | |
96 | ,(string-append "--docdir=share/doc/cmake-" | |
97 | (version-major+minor version)))) | |
89db6c6d AI |
98 | #:make-flags |
99 | (let ((skipped-tests | |
100 | (list "BundleUtilities" ; This test fails on Guix. | |
101 | "CTestTestSubdir" ; This test fails to build 2 of the 3 tests. | |
89db6c6d AI |
102 | ;; These tests requires network access. |
103 | "CTestCoverageCollectGCOV" | |
104 | "CTestTestUpload"))) | |
105 | (list | |
106 | (string-append | |
12cb6c31 MB |
107 | ;; These arguments apply for the tests only. |
108 | "ARGS=-j " (number->string (parallel-job-count)) | |
109 | " --output-on-failure" | |
110 | " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$"))) | |
6e261af1 EF |
111 | #:phases |
112 | (modify-phases %standard-phases | |
ffd526e6 OP |
113 | (add-after 'unpack 'split-package |
114 | ;; Remove files that have been packaged in other package recipes. | |
115 | (lambda _ | |
116 | (delete-file "Auxiliary/cmake-mode.el") | |
117 | (substitute* "Auxiliary/CMakeLists.txt" | |
118 | ((".*cmake-mode.el.*") "")) | |
119 | #t)) | |
6e261af1 EF |
120 | (add-before 'configure 'patch-bin-sh |
121 | (lambda _ | |
12420c80 AI |
122 | ;; Replace "/bin/sh" by the right path in... a lot of |
123 | ;; files. | |
124 | (substitute* | |
125 | '("Modules/CompilerId/Xcode-3.pbxproj.in" | |
126 | "Modules/CPack.RuntimeScript.in" | |
12420c80 | 127 | "Source/cmGlobalXCodeGenerator.cxx" |
12420c80 AI |
128 | "Source/cmLocalUnixMakefileGenerator3.cxx" |
129 | "Source/cmExecProgramCommand.cxx" | |
130 | "Utilities/Release/release_cmake.cmake" | |
131 | "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c" | |
132 | "Tests/CMakeLists.txt" | |
133 | "Tests/RunCMake/File_Generate/RunCMakeTest.cmake") | |
4bbb7d48 | 134 | (("/bin/sh") (which "sh"))) |
12420c80 | 135 | #t)) |
6e261af1 EF |
136 | (add-before 'configure 'set-paths |
137 | (lambda _ | |
138 | ;; Help cmake's bootstrap process to find system libraries | |
139 | (begin | |
140 | (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) | |
546bee40 MB |
141 | (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH") |
142 | (getenv "C_INCLUDE_PATH"))) | |
4bbb7d48 | 143 | #t))) |
2f33a732 | 144 | ;; CMake uses its own configure script. |
6e261af1 | 145 | (replace 'configure |
2f33a732 MC |
146 | (lambda* (#:key (configure-flags '()) #:allow-other-keys) |
147 | (apply invoke "./configure" configure-flags)))))) | |
b6a64843 | 148 | (inputs |
89db6c6d AI |
149 | `(("bzip2" ,bzip2) |
150 | ("curl" ,curl) | |
151 | ("expat" ,expat) | |
152 | ("file" ,file) | |
153 | ("libarchive" ,libarchive) | |
154 | ("libuv" ,libuv) | |
155 | ("ncurses" ,ncurses) ; required for ccmake | |
156 | ("rhash" ,rhash) | |
157 | ("zlib" ,zlib))) | |
0d6f9360 AE |
158 | (native-search-paths |
159 | (list (search-path-specification | |
89db6c6d AI |
160 | (variable "CMAKE_PREFIX_PATH") |
161 | (files '(""))))) | |
162 | (home-page "https://cmake.org/") | |
749b90a5 | 163 | (synopsis "Cross-platform build system") |
b6a64843 CR |
164 | (description |
165 | "CMake is a family of tools designed to build, test and package software. | |
166 | CMake is used to control the software compilation process using simple platform | |
c824d34f | 167 | and compiler independent configuration files. CMake generates native makefiles |
b6a64843 | 168 | and workspaces that can be used in the compiler environment of your choice.") |
2f33a732 MC |
169 | (properties '((hidden? . #t))) |
170 | (license (list license:bsd-3 ; cmake | |
171 | license:bsd-4 ; cmcompress | |
172 | license:bsd-2 ; cmlibarchive | |
173 | license:expat ; cmjsoncpp is dual MIT/public domain | |
db909bf2 | 174 | license:public-domain)))) ; cmlibarchive/archive_getdate.c |
1568cc14 | 175 | |
2f33a732 MC |
176 | (define-public cmake |
177 | (package | |
178 | (inherit cmake-minimal) | |
179 | (name "cmake") | |
180 | (arguments | |
181 | (substitute-keyword-arguments (package-arguments cmake-minimal) | |
182 | ((#:configure-flags configure-flags ''()) | |
183 | `(append ,configure-flags | |
184 | ;; Extra configure flags used to generate the documentation. | |
185 | '("--sphinx-info" | |
186 | "--sphinx-man" | |
187 | "--sphinx-html"))) | |
188 | ((#:phases phases) | |
189 | `(modify-phases ,phases | |
190 | (add-after 'install 'move-html-doc | |
191 | (lambda* (#:key outputs #:allow-other-keys) | |
192 | (let ((out (assoc-ref outputs "out")) | |
193 | (doc (assoc-ref outputs "doc")) | |
194 | (html (string-append "/share/doc/cmake-" | |
195 | ,(version-major+minor | |
196 | (package-version cmake-minimal)) | |
197 | "/html"))) | |
198 | (copy-recursively (string-append out html) | |
199 | (string-append doc html)) | |
200 | (delete-file-recursively (string-append out html)) | |
201 | #t))))))) | |
202 | ;; Extra inputs required to build the documentation. | |
203 | (native-inputs | |
204 | `(,@(package-native-inputs cmake-minimal) | |
205 | ("python-sphinx" ,python-sphinx) | |
206 | ("texinfo" ,texinfo))) | |
207 | (outputs '("out" "doc")) | |
208 | (properties (alist-delete 'hidden? (package-properties cmake-minimal))))) | |
209 | ||
489d1657 LC |
210 | (define-public cmake/fixed |
211 | ;; This is a variant of CMake that fixes X.509 certificate lookup: | |
212 | ;; <https://issues.guix.gnu.org/issue/37371>. | |
213 | (package | |
214 | (inherit cmake) | |
215 | (version (string-append (package-version cmake) "-1")) | |
216 | (source (origin | |
217 | (inherit (package-source cmake)) | |
218 | (patches | |
219 | (append (search-patches "cmake-curl-certificates.patch") | |
220 | (origin-patches (package-source cmake)))))))) | |
221 | ||
528b5239 IVB |
222 | (define-public cmake-3.15.5 |
223 | ;; CMake 3.15.5 fixes some issues, but declare another version to | |
224 | ;; avoid triggering the rebuild of all CMake-based packages. | |
225 | ;; See <https://issues.guix.gnu.org/issue/38060>. | |
226 | (package | |
227 | (inherit cmake) | |
228 | (version "3.15.5") | |
229 | (source (origin | |
230 | (inherit (package-source cmake)) | |
231 | (uri (string-append "https://www.cmake.org/files/v" | |
232 | (version-major+minor version) | |
233 | "/cmake-" version ".tar.gz")) | |
234 | (sha256 | |
235 | (base32 | |
236 | "1d5y8d92axcc6rfqlsxamayfs3fc1vdby91hn5mx1kn02ppprpgv")))))) | |
237 | ||
bbdf3666 OP |
238 | (define-public emacs-cmake-mode |
239 | (package | |
240 | (inherit cmake) | |
241 | (name "emacs-cmake-mode") | |
5a7c6d02 MB |
242 | (native-inputs '()) |
243 | (inputs '()) | |
244 | (outputs '("out")) | |
bbdf3666 OP |
245 | (build-system emacs-build-system) |
246 | (arguments | |
247 | `(#:phases | |
248 | (modify-phases %standard-phases | |
249 | (add-after 'unpack 'chdir-elisp | |
250 | ;; Elisp directory is not in root of the source. | |
251 | (lambda _ | |
5a7c6d02 MB |
252 | (chdir "Auxiliary") |
253 | #t))))) | |
bbdf3666 OP |
254 | (synopsis "Emacs major mode for editing Cmake expressions") |
255 | (description "@code{cmakeos-mode} provides an Emacs major mode for editing | |
256 | Cmake files. It supports syntax highlighting, indenting and refilling of | |
257 | comments."))) |