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>
12 ;;; This file is part of GNU Guix.
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.
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.
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/>.
27 (define-module (gnu packages cmake)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix utils)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system emacs)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages backup)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages crypto)
38 #:use-module (gnu packages curl)
39 #:use-module (gnu packages file)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages ncurses)
42 #:use-module (gnu packages xml))
50 (uri (string-append "https://www.cmake.org/files/v"
51 (version-major+minor version)
52 "/cmake-" version ".tar.gz"))
55 "04123d7fgnn1fs5p0nwyq397ss89r0y4wkg9a09qiwkjsvk1rzmy"))
56 (modules '((guix build utils)))
59 ;; Drop bundled software.
60 (with-directory-excursion "Utilities"
61 (for-each delete-file-recursively
72 (build-system gnu-build-system)
74 `(#:test-target "test"
77 (list "BundleUtilities" ; This test fails on Guix.
78 "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
79 ;; These tests requires network access.
80 "CTestCoverageCollectGCOV"
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 "\\|") "\\)$")))
89 (modify-phases %standard-phases
90 (add-after 'unpack 'split-package
91 ;; Remove files that have been packaged in other package recipes.
93 (delete-file "Auxiliary/cmake-mode.el")
94 (substitute* "Auxiliary/CMakeLists.txt"
95 ((".*cmake-mode.el.*") ""))
97 (add-before 'configure 'patch-bin-sh
99 ;; Replace "/bin/sh" by the right path in... a lot of
102 '("Modules/CompilerId/Xcode-3.pbxproj.in"
103 "Modules/CPack.RuntimeScript.in"
104 "Source/cmakexbuild.cxx"
105 "Source/cmGlobalXCodeGenerator.cxx"
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")
112 (("/bin/sh") (which "sh")))
114 (add-before 'configure 'set-paths
116 ;; Help cmake's bootstrap process to find system libraries
118 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
119 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
122 (lambda* (#:key outputs #:allow-other-keys)
123 (let ((out (assoc-ref outputs "out")))
125 "./configure" "--verbose"
126 (string-append "--parallel=" (number->string (parallel-job-count)))
127 (string-append "--prefix=" out)
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.
138 "--docdir=share/doc/cmake-"
139 (version-major+minor version)))))))))
145 ("libarchive" ,libarchive)
147 ("ncurses" ,ncurses) ; required for ccmake
151 (list (search-path-specification
152 (variable "CMAKE_PREFIX_PATH")
154 (home-page "https://cmake.org/")
155 (synopsis "Cross-platform build system")
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
159 and compiler independent configuration files. CMake generates native makefiles
160 and workspaces that can be used in the compiler environment of your choice.")
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
167 (define-public cmake/fixed
168 ;; This is a variant of CMake that fixes X.509 certificate lookup:
169 ;; <https://issues.guix.gnu.org/issue/37371>.
172 (version (string-append (package-version cmake) "-1"))
174 (inherit (package-source cmake))
176 (append (search-patches "cmake-curl-certificates.patch")
177 (origin-patches (package-source cmake))))))))
179 (define-public emacs-cmake-mode
182 (name "emacs-cmake-mode")
183 (build-system emacs-build-system)
186 (modify-phases %standard-phases
187 (add-after 'unpack 'chdir-elisp
188 ;; Elisp directory is not in root of the source.
190 (chdir "Auxiliary"))))))
191 (synopsis "Emacs major mode for editing Cmake expressions")
192 (description "@code{cmakeos-mode} provides an Emacs major mode for editing
193 Cmake files. It supports syntax highlighting, indenting and refilling of