gnu: superlu-dist: Return #t from all phases.
[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 (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))
42
43 (define-public cmake
44 (package
45 (name "cmake")
46 (version "3.11.0")
47 (source (origin
48 (method url-fetch)
49 (uri (string-append "https://www.cmake.org/files/v"
50 (version-major+minor version)
51 "/cmake-" version ".tar.gz"))
52 (sha256
53 (base32
54 "0sv5k9q6braa8hhw0y3w19avqn0xn5czv5jf5fz5blnlf7ivw4y3"))
55 (modules '((guix build utils)))
56 (snippet
57 '(begin
58 ;; Drop bundled software.
59 (with-directory-excursion "Utilities"
60 (for-each delete-file-recursively
61 '("cmbzip2"
62 ;; "cmcompress"
63 "cmcurl"
64 "cmexpat"
65 ;; "cmjsoncpp"
66 ;; "cmlibarchive"
67 "cmliblzma"
68 ;; "cmlibuv"
69 "cmzlib"))
70 #t)))))
71 (build-system gnu-build-system)
72 (arguments
73 `(#:test-target "test"
74 #:make-flags
75 (let ((skipped-tests
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"
80 "CTestTestUpload")))
81 (list
82 (string-append
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 "\\|") "\\)$")))
87 #:phases
88 (modify-phases %standard-phases
89 (add-before 'configure 'patch-bin-sh
90 (lambda _
91 ;; Replace "/bin/sh" by the right path in... a lot of
92 ;; files.
93 (substitute*
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")))
105 #t))
106 (add-before 'configure 'set-paths
107 (lambda _
108 ;; Help cmake's bootstrap process to find system libraries
109 (begin
110 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
111 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
112 #t)))
113 (replace 'configure
114 (lambda* (#:key outputs #:allow-other-keys)
115 (let ((out (assoc-ref outputs "out")))
116 (invoke
117 "./configure" "--verbose"
118 (string-append "--parallel=" (number->string (parallel-job-count)))
119 (string-append "--prefix=" out)
120 "--system-libs"
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.
128 "--mandir=share/man"
129 ,(string-append
130 "--docdir=share/doc/cmake-"
131 (version-major+minor version)))))))))
132 (inputs
133 `(("bzip2" ,bzip2)
134 ("curl" ,curl)
135 ("expat" ,expat)
136 ("file" ,file)
137 ("libarchive" ,libarchive)
138 ("libuv" ,libuv)
139 ("ncurses" ,ncurses) ; required for ccmake
140 ("rhash" ,rhash)
141 ("zlib" ,zlib)))
142 (native-search-paths
143 (list (search-path-specification
144 (variable "CMAKE_PREFIX_PATH")
145 (files '("")))))
146 (home-page "https://cmake.org/")
147 (synopsis "Cross-platform build system")
148 (description
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
158
159 (define-public emacs-cmake-mode
160 (package
161 (inherit cmake)
162 (name "emacs-cmake-mode")
163 (build-system emacs-build-system)
164 (arguments
165 `(#:phases
166 (modify-phases %standard-phases
167 (add-after 'unpack 'chdir-elisp
168 ;; Elisp directory is not in root of the source.
169 (lambda _
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
174 comments.")))