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> |
b6a64843 CR |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu packages cmake) | |
db909bf2 | 28 | #:use-module ((guix licenses) #:prefix license:) |
b6a64843 CR |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
29a7c98a | 31 | #:use-module (guix utils) |
b6a64843 | 32 | #:use-module (guix build-system gnu) |
aa4818c3 | 33 | #:use-module (guix build-system emacs) |
b6a64843 | 34 | #:use-module (gnu packages) |
c824d34f EB |
35 | #:use-module (gnu packages backup) |
36 | #:use-module (gnu packages compression) | |
1568cc14 | 37 | #:use-module (gnu packages crypto) |
c824d34f | 38 | #:use-module (gnu packages curl) |
6212b8e5 | 39 | #:use-module (gnu packages file) |
4bbb7d48 | 40 | #:use-module (gnu packages libevent) |
21e5e1e0 | 41 | #:use-module (gnu packages ncurses) |
29a7c98a | 42 | #:use-module (gnu packages xml)) |
b6a64843 CR |
43 | |
44 | (define-public cmake | |
45 | (package | |
46 | (name "cmake") | |
334bd08c | 47 | (version "3.12.2") |
b6a64843 | 48 | (source (origin |
12420c80 AI |
49 | (method url-fetch) |
50 | (uri (string-append "https://www.cmake.org/files/v" | |
51 | (version-major+minor version) | |
52 | "/cmake-" version ".tar.gz")) | |
53 | (sha256 | |
54 | (base32 | |
334bd08c | 55 | "19410mxgcyvk5q42phaclb1hz6rl08z4yj8iriq706p5k5bli5qg")) |
12420c80 AI |
56 | (modules '((guix build utils))) |
57 | (snippet | |
58 | '(begin | |
59 | ;; Drop bundled software. | |
60 | (with-directory-excursion "Utilities" | |
61 | (for-each delete-file-recursively | |
62 | '("cmbzip2" | |
63 | ;; "cmcompress" | |
64 | "cmcurl" | |
65 | "cmexpat" | |
66 | ;; "cmjsoncpp" | |
67 | ;; "cmlibarchive" | |
68 | "cmliblzma" | |
69 | ;; "cmlibuv" | |
70 | "cmzlib")) | |
71 | #t))))) | |
b6a64843 CR |
72 | (build-system gnu-build-system) |
73 | (arguments | |
6212b8e5 | 74 | `(#:test-target "test" |
89db6c6d AI |
75 | #:make-flags |
76 | (let ((skipped-tests | |
77 | (list "BundleUtilities" ; This test fails on Guix. | |
78 | "CTestTestSubdir" ; This test fails to build 2 of the 3 tests. | |
89db6c6d AI |
79 | ;; These tests requires network access. |
80 | "CTestCoverageCollectGCOV" | |
81 | "CTestTestUpload"))) | |
82 | (list | |
83 | (string-append | |
12cb6c31 MB |
84 | ;; These arguments apply for the tests only. |
85 | "ARGS=-j " (number->string (parallel-job-count)) | |
86 | " --output-on-failure" | |
87 | " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$"))) | |
6e261af1 EF |
88 | #:phases |
89 | (modify-phases %standard-phases | |
ffd526e6 OP |
90 | (add-after 'unpack 'split-package |
91 | ;; Remove files that have been packaged in other package recipes. | |
92 | (lambda _ | |
93 | (delete-file "Auxiliary/cmake-mode.el") | |
94 | (substitute* "Auxiliary/CMakeLists.txt" | |
95 | ((".*cmake-mode.el.*") "")) | |
96 | #t)) | |
6e261af1 EF |
97 | (add-before 'configure 'patch-bin-sh |
98 | (lambda _ | |
12420c80 AI |
99 | ;; Replace "/bin/sh" by the right path in... a lot of |
100 | ;; files. | |
101 | (substitute* | |
102 | '("Modules/CompilerId/Xcode-3.pbxproj.in" | |
103 | "Modules/CPack.RuntimeScript.in" | |
104 | "Source/cmakexbuild.cxx" | |
105 | "Source/cmGlobalXCodeGenerator.cxx" | |
12420c80 AI |
106 | "Source/cmLocalUnixMakefileGenerator3.cxx" |
107 | "Source/cmExecProgramCommand.cxx" | |
108 | "Utilities/Release/release_cmake.cmake" | |
109 | "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c" | |
110 | "Tests/CMakeLists.txt" | |
111 | "Tests/RunCMake/File_Generate/RunCMakeTest.cmake") | |
4bbb7d48 | 112 | (("/bin/sh") (which "sh"))) |
12420c80 | 113 | #t)) |
6e261af1 EF |
114 | (add-before 'configure 'set-paths |
115 | (lambda _ | |
116 | ;; Help cmake's bootstrap process to find system libraries | |
117 | (begin | |
118 | (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) | |
119 | (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH")) | |
4bbb7d48 | 120 | #t))) |
6e261af1 EF |
121 | (replace 'configure |
122 | (lambda* (#:key outputs #:allow-other-keys) | |
123 | (let ((out (assoc-ref outputs "out"))) | |
89db6c6d | 124 | (invoke |
12cb6c31 MB |
125 | "./configure" "--verbose" |
126 | (string-append "--parallel=" (number->string (parallel-job-count))) | |
89db6c6d AI |
127 | (string-append "--prefix=" out) |
128 | "--system-libs" | |
129 | "--no-system-jsoncpp" ; FIXME: Circular dependency. | |
130 | ;; By default, the man pages and other docs land | |
131 | ;; in PREFIX/man and PREFIX/doc, but we want them | |
132 | ;; in share/{man,doc}. Note that unlike | |
133 | ;; autoconf-generated configure scripts, cmake's | |
134 | ;; configure prepends "PREFIX/" to what we pass | |
135 | ;; to --mandir and --docdir. | |
136 | "--mandir=share/man" | |
137 | ,(string-append | |
138 | "--docdir=share/doc/cmake-" | |
12cb6c31 | 139 | (version-major+minor version))))))))) |
b6a64843 | 140 | (inputs |
89db6c6d AI |
141 | `(("bzip2" ,bzip2) |
142 | ("curl" ,curl) | |
143 | ("expat" ,expat) | |
144 | ("file" ,file) | |
145 | ("libarchive" ,libarchive) | |
146 | ("libuv" ,libuv) | |
147 | ("ncurses" ,ncurses) ; required for ccmake | |
148 | ("rhash" ,rhash) | |
149 | ("zlib" ,zlib))) | |
0d6f9360 AE |
150 | (native-search-paths |
151 | (list (search-path-specification | |
89db6c6d AI |
152 | (variable "CMAKE_PREFIX_PATH") |
153 | (files '(""))))) | |
154 | (home-page "https://cmake.org/") | |
749b90a5 | 155 | (synopsis "Cross-platform build system") |
b6a64843 CR |
156 | (description |
157 | "CMake is a family of tools designed to build, test and package software. | |
158 | CMake is used to control the software compilation process using simple platform | |
c824d34f | 159 | and compiler independent configuration files. CMake generates native makefiles |
b6a64843 | 160 | and workspaces that can be used in the compiler environment of your choice.") |
db909bf2 MB |
161 | (license (list license:bsd-3 ; cmake |
162 | license:bsd-4 ; cmcompress | |
163 | license:bsd-2 ; cmlibarchive | |
164 | license:expat ; cmjsoncpp is dual MIT/public domain | |
165 | license:public-domain)))) ; cmlibarchive/archive_getdate.c | |
1568cc14 | 166 | |
bbdf3666 OP |
167 | (define-public emacs-cmake-mode |
168 | (package | |
169 | (inherit cmake) | |
170 | (name "emacs-cmake-mode") | |
171 | (build-system emacs-build-system) | |
172 | (arguments | |
173 | `(#:phases | |
174 | (modify-phases %standard-phases | |
175 | (add-after 'unpack 'chdir-elisp | |
176 | ;; Elisp directory is not in root of the source. | |
177 | (lambda _ | |
178 | (chdir "Auxiliary")))))) | |
179 | (synopsis "Emacs major mode for editing Cmake expressions") | |
180 | (description "@code{cmakeos-mode} provides an Emacs major mode for editing | |
181 | Cmake files. It supports syntax highlighting, indenting and refilling of | |
182 | comments."))) |