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 Marius Bakke <mbakke@fastmail.com>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages cmake)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages backup)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages curl)
35 #:use-module (gnu packages file)
36 #:use-module (gnu packages libevent)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages xml))
46 (uri (string-append "https://www.cmake.org/files/v"
47 (version-major+minor version)
48 "/cmake-" version ".tar.gz"))
51 "1q6a60695prpzzsmczm2xrgxdb61fyjznb04dr6yls6iwv24c4nw"))
52 (patches (search-patches "cmake-fix-tests.patch"))
53 (modules '((guix build utils)))
56 ;; Drop bundled software.
57 (with-directory-excursion "Utilities"
58 (for-each delete-file-recursively
69 (build-system gnu-build-system)
71 `(#:test-target "test"
73 (modify-phases %standard-phases
74 (add-before 'configure 'patch-bin-sh
76 ;; Replace "/bin/sh" by the right path in... a lot of
79 '("Modules/CompilerId/Xcode-3.pbxproj.in"
80 "Modules/CompilerId/Xcode-1.pbxproj.in"
81 "Modules/CompilerId/Xcode-2.pbxproj.in"
82 "Modules/CPack.RuntimeScript.in"
83 "Source/cmakexbuild.cxx"
84 "Source/cmGlobalXCodeGenerator.cxx"
85 "Source/CTest/cmCTestBatchTestHandler.cxx"
86 "Source/cmLocalUnixMakefileGenerator3.cxx"
87 "Source/cmExecProgramCommand.cxx"
88 "Utilities/Release/release_cmake.cmake"
89 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
90 "Tests/CMakeLists.txt"
91 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
92 (("/bin/sh") (which "sh")))
94 (add-before 'configure 'set-paths
96 ;; Help cmake's bootstrap process to find system libraries
98 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
99 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
102 (lambda* (#:key outputs #:allow-other-keys)
103 (let ((out (assoc-ref outputs "out")))
106 (string-append "--prefix=" out)
108 "--no-system-jsoncpp" ; FIXME: Circular dependency.
109 ;; By default, the man pages and other docs land
110 ;; in PREFIX/man and PREFIX/doc, but we want them
111 ;; in share/{man,doc}. Note that unlike
112 ;; autoconf-generated configure scripts, cmake's
113 ;; configure prepends "PREFIX/" to what we pass
114 ;; to --mandir and --docdir.
117 "--docdir=share/doc/cmake-"
118 (version-major+minor version)))))))
119 (add-before 'check 'set-test-environment
121 ;; Get verbose output from failed tests.
122 (setenv "CTEST_OUTPUT_ON_FAILURE" "TRUE")
123 ;; Run tests in parallel.
124 (setenv "CTEST_PARALLEL_LEVEL"
125 (number->string (parallel-job-count)))
133 ("ncurses" ,ncurses) ; required for ccmake
135 ("libarchive" ,libarchive)))
137 (list (search-path-specification
138 (variable "CMAKE_PREFIX_PATH")
140 (home-page "https://www.cmake.org/")
141 (synopsis "Cross-platform build system")
143 "CMake is a family of tools designed to build, test and package software.
144 CMake is used to control the software compilation process using simple platform
145 and compiler independent configuration files. CMake generates native makefiles
146 and workspaces that can be used in the compiler environment of your choice.")
147 (license (list license:bsd-3 ; cmake
148 license:bsd-4 ; cmcompress
149 license:bsd-2 ; cmlibarchive
150 license:expat ; cmjsoncpp is dual MIT/public domain
151 license:public-domain)))) ; cmlibarchive/archive_getdate.c