Merge branch '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, 2018 Marius Bakke <mbakke@fastmail.com>
9 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
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.
17 ;;;
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.
22 ;;;
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/>.
25
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 (gnu packages)
33 #:use-module (gnu packages backup)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages crypto)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages file)
38 #:use-module (gnu packages libevent)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages xml))
41
42 (define-public cmake
43 (package
44 (name "cmake")
45 (version "3.11.0")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "https://www.cmake.org/files/v"
49 (version-major+minor version)
50 "/cmake-" version ".tar.gz"))
51 (sha256
52 (base32
53 "0sv5k9q6braa8hhw0y3w19avqn0xn5czv5jf5fz5blnlf7ivw4y3"))
54 (modules '((guix build utils)))
55 (snippet
56 '(begin
57 ;; Drop bundled software.
58 (with-directory-excursion "Utilities"
59 (for-each delete-file-recursively
60 '("cmbzip2"
61 ;; "cmcompress"
62 "cmcurl"
63 "cmexpat"
64 ;; "cmjsoncpp"
65 ;; "cmlibarchive"
66 "cmliblzma"
67 ;; "cmlibuv"
68 "cmzlib"))
69 #t)))))
70 (build-system gnu-build-system)
71 (arguments
72 `(#:test-target "test"
73 #:make-flags
74 (let ((skipped-tests
75 (list "BundleUtilities" ; This test fails on Guix.
76 "CTestTestSubdir" ; This test fails to build 2 of the 3 tests.
77 ;; These tests requires network access.
78 "CTestCoverageCollectGCOV"
79 "CTestTestUpload")))
80 (list
81 (string-append
82 ;; These arguments apply for the tests only.
83 "ARGS=-j " (number->string (parallel-job-count))
84 " --output-on-failure"
85 " --exclude-regex ^\\(" (string-join skipped-tests "\\|") "\\)$")))
86 #:phases
87 (modify-phases %standard-phases
88 (add-before 'configure 'patch-bin-sh
89 (lambda _
90 ;; Replace "/bin/sh" by the right path in... a lot of
91 ;; files.
92 (substitute*
93 '("Modules/CompilerId/Xcode-3.pbxproj.in"
94 "Modules/CPack.RuntimeScript.in"
95 "Source/cmakexbuild.cxx"
96 "Source/cmGlobalXCodeGenerator.cxx"
97 "Source/cmLocalUnixMakefileGenerator3.cxx"
98 "Source/cmExecProgramCommand.cxx"
99 "Utilities/Release/release_cmake.cmake"
100 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
101 "Tests/CMakeLists.txt"
102 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
103 (("/bin/sh") (which "sh")))
104 #t))
105 (add-before 'configure 'set-paths
106 (lambda _
107 ;; Help cmake's bootstrap process to find system libraries
108 (begin
109 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
110 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
111 #t)))
112 (replace 'configure
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let ((out (assoc-ref outputs "out")))
115 (invoke
116 "./configure" "--verbose"
117 (string-append "--parallel=" (number->string (parallel-job-count)))
118 (string-append "--prefix=" out)
119 "--system-libs"
120 "--no-system-jsoncpp" ; FIXME: Circular dependency.
121 ;; By default, the man pages and other docs land
122 ;; in PREFIX/man and PREFIX/doc, but we want them
123 ;; in share/{man,doc}. Note that unlike
124 ;; autoconf-generated configure scripts, cmake's
125 ;; configure prepends "PREFIX/" to what we pass
126 ;; to --mandir and --docdir.
127 "--mandir=share/man"
128 ,(string-append
129 "--docdir=share/doc/cmake-"
130 (version-major+minor version)))))))))
131 (inputs
132 `(("bzip2" ,bzip2)
133 ("curl" ,curl)
134 ("expat" ,expat)
135 ("file" ,file)
136 ("libarchive" ,libarchive)
137 ("libuv" ,libuv)
138 ("ncurses" ,ncurses) ; required for ccmake
139 ("rhash" ,rhash)
140 ("zlib" ,zlib)))
141 (native-search-paths
142 (list (search-path-specification
143 (variable "CMAKE_PREFIX_PATH")
144 (files '("")))))
145 (home-page "https://cmake.org/")
146 (synopsis "Cross-platform build system")
147 (description
148 "CMake is a family of tools designed to build, test and package software.
149 CMake is used to control the software compilation process using simple platform
150 and compiler independent configuration files. CMake generates native makefiles
151 and workspaces that can be used in the compiler environment of your choice.")
152 (license (list license:bsd-3 ; cmake
153 license:bsd-4 ; cmcompress
154 license:bsd-2 ; cmlibarchive
155 license:expat ; cmjsoncpp is dual MIT/public domain
156 license:public-domain)))) ; cmlibarchive/archive_getdate.c