Merge remote-tracking branch 'origin/master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / cmake.scm
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>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
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.
16 ;;;
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.
21 ;;;
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/>.
24
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))
39
40 (define-public cmake
41 (package
42 (name "cmake")
43 (version "3.7.2")
44 (source (origin
45 (method url-fetch)
46 (uri (string-append "https://www.cmake.org/files/v"
47 (version-major+minor version)
48 "/cmake-" version ".tar.gz"))
49 (sha256
50 (base32
51 "1q6a60695prpzzsmczm2xrgxdb61fyjznb04dr6yls6iwv24c4nw"))
52 (patches (search-patches "cmake-fix-tests.patch"))
53 (modules '((guix build utils)))
54 (snippet
55 '(begin
56 ;; Drop bundled software.
57 (with-directory-excursion "Utilities"
58 (for-each delete-file-recursively
59 '("cmbzip2"
60 ;"cmcompress"
61 "cmcurl"
62 "cmexpat"
63 ;"cmjsoncpp"
64 ;"cmlibarchive"
65 "cmliblzma"
66 "cmlibuv"
67 "cmzlib"))
68 #t)))))
69 (build-system gnu-build-system)
70 (arguments
71 `(#:test-target "test"
72 #:phases
73 (modify-phases %standard-phases
74 (add-before 'configure 'patch-bin-sh
75 (lambda _
76 ;; Replace "/bin/sh" by the right path in... a lot of
77 ;; files.
78 (substitute*
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")))
93 #t))
94 (add-before 'configure 'set-paths
95 (lambda _
96 ;; Help cmake's bootstrap process to find system libraries
97 (begin
98 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
99 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
100 #t)))
101 (replace 'configure
102 (lambda* (#:key outputs #:allow-other-keys)
103 (let ((out (assoc-ref outputs "out")))
104 (zero? (system*
105 "./configure"
106 (string-append "--prefix=" out)
107 "--system-libs"
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.
115 "--mandir=share/man"
116 ,(string-append
117 "--docdir=share/doc/cmake-"
118 (version-major+minor version)))))))
119 (add-before 'check 'set-test-environment
120 (lambda _
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)))
126 #t)))))
127 (inputs
128 `(("file" ,file)
129 ("curl" ,curl)
130 ("zlib" ,zlib)
131 ("expat" ,expat)
132 ("bzip2" ,bzip2)
133 ("ncurses" ,ncurses) ; required for ccmake
134 ("libuv" ,libuv)
135 ("libarchive" ,libarchive)))
136 (native-search-paths
137 (list (search-path-specification
138 (variable "CMAKE_PREFIX_PATH")
139 (files '("")))))
140 (home-page "https://www.cmake.org/")
141 (synopsis "Cross-platform build system")
142 (description
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