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 MC |
11 | ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
12 | ||
b6a64843 CR |
13 | ;;; |
14 | ;;; This file is part of GNU Guix. | |
15 | ;;; | |
16 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
17 | ;;; under the terms of the GNU General Public License as published by | |
18 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
19 | ;;; your option) any later version. | |
20 | ;;; | |
21 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
22 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | ;;; GNU General Public License for more details. | |
25 | ;;; | |
26 | ;;; You should have received a copy of the GNU General Public License | |
27 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
28 | ||
29 | (define-module (gnu packages cmake) | |
db909bf2 | 30 | #:use-module ((guix licenses) #:prefix license:) |
b6a64843 CR |
31 | #:use-module (guix packages) |
32 | #:use-module (guix download) | |
29a7c98a | 33 | #:use-module (guix utils) |
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) |
2f33a732 MC |
44 | #:use-module (gnu packages python-xyz) |
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") |
de7dae6e | 54 | (version "3.14.3") |
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 | |
de7dae6e | 62 | "0cmnyk9agdgwnc4svzafhddqgcrhvwp5cgmn54mih1qkx1j0np91")) |
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" | |
128 | "Source/cmakexbuild.cxx" | |
129 | "Source/cmGlobalXCodeGenerator.cxx" | |
12420c80 AI |
130 | "Source/cmLocalUnixMakefileGenerator3.cxx" |
131 | "Source/cmExecProgramCommand.cxx" | |
132 | "Utilities/Release/release_cmake.cmake" | |
133 | "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c" | |
134 | "Tests/CMakeLists.txt" | |
135 | "Tests/RunCMake/File_Generate/RunCMakeTest.cmake") | |
4bbb7d48 | 136 | (("/bin/sh") (which "sh"))) |
12420c80 | 137 | #t)) |
6e261af1 EF |
138 | (add-before 'configure 'set-paths |
139 | (lambda _ | |
140 | ;; Help cmake's bootstrap process to find system libraries | |
141 | (begin | |
142 | (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) | |
546bee40 MB |
143 | (setenv "CMAKE_INCLUDE_PATH" (or (getenv "CPATH") |
144 | (getenv "C_INCLUDE_PATH"))) | |
4bbb7d48 | 145 | #t))) |
2f33a732 | 146 | ;; CMake uses its own configure script. |
6e261af1 | 147 | (replace 'configure |
2f33a732 MC |
148 | (lambda* (#:key (configure-flags '()) #:allow-other-keys) |
149 | (apply invoke "./configure" configure-flags)))))) | |
b6a64843 | 150 | (inputs |
89db6c6d AI |
151 | `(("bzip2" ,bzip2) |
152 | ("curl" ,curl) | |
153 | ("expat" ,expat) | |
154 | ("file" ,file) | |
155 | ("libarchive" ,libarchive) | |
156 | ("libuv" ,libuv) | |
157 | ("ncurses" ,ncurses) ; required for ccmake | |
158 | ("rhash" ,rhash) | |
159 | ("zlib" ,zlib))) | |
0d6f9360 AE |
160 | (native-search-paths |
161 | (list (search-path-specification | |
89db6c6d AI |
162 | (variable "CMAKE_PREFIX_PATH") |
163 | (files '(""))))) | |
164 | (home-page "https://cmake.org/") | |
749b90a5 | 165 | (synopsis "Cross-platform build system") |
b6a64843 CR |
166 | (description |
167 | "CMake is a family of tools designed to build, test and package software. | |
168 | CMake is used to control the software compilation process using simple platform | |
c824d34f | 169 | and compiler independent configuration files. CMake generates native makefiles |
b6a64843 | 170 | and workspaces that can be used in the compiler environment of your choice.") |
2f33a732 MC |
171 | (properties '((hidden? . #t))) |
172 | (license (list license:bsd-3 ; cmake | |
173 | license:bsd-4 ; cmcompress | |
174 | license:bsd-2 ; cmlibarchive | |
175 | license:expat ; cmjsoncpp is dual MIT/public domain | |
db909bf2 | 176 | license:public-domain)))) ; cmlibarchive/archive_getdate.c |
1568cc14 | 177 | |
2f33a732 MC |
178 | (define-public cmake |
179 | (package | |
180 | (inherit cmake-minimal) | |
181 | (name "cmake") | |
182 | (arguments | |
183 | (substitute-keyword-arguments (package-arguments cmake-minimal) | |
184 | ((#:configure-flags configure-flags ''()) | |
185 | `(append ,configure-flags | |
186 | ;; Extra configure flags used to generate the documentation. | |
187 | '("--sphinx-info" | |
188 | "--sphinx-man" | |
189 | "--sphinx-html"))) | |
190 | ((#:phases phases) | |
191 | `(modify-phases ,phases | |
192 | (add-after 'install 'move-html-doc | |
193 | (lambda* (#:key outputs #:allow-other-keys) | |
194 | (let ((out (assoc-ref outputs "out")) | |
195 | (doc (assoc-ref outputs "doc")) | |
196 | (html (string-append "/share/doc/cmake-" | |
197 | ,(version-major+minor | |
198 | (package-version cmake-minimal)) | |
199 | "/html"))) | |
200 | (copy-recursively (string-append out html) | |
201 | (string-append doc html)) | |
202 | (delete-file-recursively (string-append out html)) | |
203 | #t))))))) | |
204 | ;; Extra inputs required to build the documentation. | |
205 | (native-inputs | |
206 | `(,@(package-native-inputs cmake-minimal) | |
207 | ("python-sphinx" ,python-sphinx) | |
208 | ("texinfo" ,texinfo))) | |
209 | (outputs '("out" "doc")) | |
210 | (properties (alist-delete 'hidden? (package-properties cmake-minimal))))) | |
211 | ||
bbdf3666 OP |
212 | (define-public emacs-cmake-mode |
213 | (package | |
214 | (inherit cmake) | |
215 | (name "emacs-cmake-mode") | |
216 | (build-system emacs-build-system) | |
217 | (arguments | |
218 | `(#:phases | |
219 | (modify-phases %standard-phases | |
220 | (add-after 'unpack 'chdir-elisp | |
221 | ;; Elisp directory is not in root of the source. | |
222 | (lambda _ | |
223 | (chdir "Auxiliary")))))) | |
224 | (synopsis "Emacs major mode for editing Cmake expressions") | |
225 | (description "@code{cmakeos-mode} provides an Emacs major mode for editing | |
226 | Cmake files. It supports syntax highlighting, indenting and refilling of | |
227 | comments."))) |