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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages cmake)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system emacs)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages backup)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages crypto)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages file)
39 #:use-module (gnu packages libevent)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages xml))
49 (uri (string-append "https://www.cmake.org/files/v"
50 (version-major+minor version)
51 "/cmake-" version ".tar.gz"))
54 "0sv5k9q6braa8hhw0y3w19avqn0xn5czv5jf5fz5blnlf7ivw4y3"))
55 (modules '((guix build utils)))
58 ;; Drop bundled software.
59 (with-directory-excursion "Utilities"
60 (for-each delete-file-recursively
71 (build-system gnu-build-system)
73 `(#:test-target "test"
76 (list "BundleUtilities" ; This test fails on Guix.
77 "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
78 ;; These tests requires network access.
79 "CTestCoverageCollectGCOV"
83 ;; These arguments apply for the tests only.
84 "ARGS=-j " (number->string (parallel-job-count))
85 " --output-on-failure"
86 " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
88 (modify-phases %standard-phases
89 (add-before 'configure 'patch-bin-sh
91 ;; Replace "/bin/sh" by the right path in... a lot of
94 '("Modules/CompilerId/Xcode-3.pbxproj.in"
95 "Modules/CPack.RuntimeScript.in"
96 "Source/cmakexbuild.cxx"
97 "Source/cmGlobalXCodeGenerator.cxx"
98 "Source/cmLocalUnixMakefileGenerator3.cxx"
99 "Source/cmExecProgramCommand.cxx"
100 "Utilities/Release/release_cmake.cmake"
101 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
102 "Tests/CMakeLists.txt"
103 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
104 (("/bin/sh") (which "sh")))
106 (add-before 'configure 'set-paths
108 ;; Help cmake's bootstrap process to find system libraries
110 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
111 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
114 (lambda* (#:key outputs #:allow-other-keys)
115 (let ((out (assoc-ref outputs "out")))
117 "./configure" "--verbose"
118 (string-append "--parallel=" (number->string (parallel-job-count)))
119 (string-append "--prefix=" out)
121 "--no-system-jsoncpp" ; FIXME: Circular dependency.
122 ;; By default, the man pages and other docs land
123 ;; in PREFIX/man and PREFIX/doc, but we want them
124 ;; in share/{man,doc}. Note that unlike
125 ;; autoconf-generated configure scripts, cmake's
126 ;; configure prepends "PREFIX/" to what we pass
127 ;; to --mandir and --docdir.
130 "--docdir=share/doc/cmake-"
131 (version-major+minor version)))))))))
137 ("libarchive" ,libarchive)
139 ("ncurses" ,ncurses) ; required for ccmake
143 (list (search-path-specification
144 (variable "CMAKE_PREFIX_PATH")
146 (home-page "https://cmake.org/")
147 (synopsis "Cross-platform build system")
149 "CMake is a family of tools designed to build, test and package software.
150 CMake is used to control the software compilation process using simple platform
151 and compiler independent configuration files. CMake generates native makefiles
152 and workspaces that can be used in the compiler environment of your choice.")
153 (license (list license:bsd-3 ; cmake
154 license:bsd-4 ; cmcompress
155 license:bsd-2 ; cmlibarchive
156 license:expat ; cmjsoncpp is dual MIT/public domain
157 license:public-domain)))) ; cmlibarchive/archive_getdate.c
159 (define-public emacs-cmake-mode
162 (name "emacs-cmake-mode")
163 (build-system emacs-build-system)
166 (modify-phases %standard-phases
167 (add-after 'unpack 'chdir-elisp
168 ;; Elisp directory is not in root of the source.
170 (chdir "Auxiliary"))))))
171 (synopsis "Emacs major mode for editing Cmake expressions")
172 (description "@code{cmakeos-mode} provides an Emacs major mode for editing
173 Cmake files. It supports syntax highlighting, indenting and refilling of