gnu: Add lci.
[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 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages cmake)
25 #:use-module ((guix licenses) #:select (bsd-3))
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages backup)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages file)
35 #:use-module (gnu packages xml))
36
37 (define-public cmake
38 (package
39 (name "cmake")
40 (version "3.5.2")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append "https://www.cmake.org/files/v"
44 (version-major+minor version)
45 "/cmake-" version ".tar.gz"))
46 (sha256
47 (base32
48 "0ap6nlmv6nda942db43k9k9mhnm5dm3fsapzvy0vh6wq7l6l3n4j"))
49 (patches (search-patches "cmake-fix-tests.patch"))))
50 (build-system gnu-build-system)
51 (arguments
52 `(#:test-target "test"
53 #:phases
54 (modify-phases %standard-phases
55 (add-before 'configure 'patch-bin-sh
56 (lambda _
57 ;; Replace "/bin/sh" by the right path in... a lot of
58 ;; files.
59 (substitute*
60 '("Modules/CompilerId/Xcode-3.pbxproj.in"
61 "Modules/CompilerId/Xcode-1.pbxproj.in"
62 "Modules/CompilerId/Xcode-2.pbxproj.in"
63 "Modules/CPack.RuntimeScript.in"
64 "Source/cmakexbuild.cxx"
65 "Source/cmGlobalXCodeGenerator.cxx"
66 "Source/CTest/cmCTestBatchTestHandler.cxx"
67 "Source/cmLocalUnixMakefileGenerator3.cxx"
68 "Source/cmExecProgramCommand.cxx"
69 "Utilities/cmbzip2/Makefile-libbz2_so"
70 "Utilities/Release/release_cmake.cmake"
71 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
72 "Tests/CMakeLists.txt"
73 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
74 (("/bin/sh") (which "sh")))))
75 (add-before 'configure 'set-paths
76 (lambda _
77 ;; Help cmake's bootstrap process to find system libraries
78 (begin
79 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
80 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
81 ;; Get verbose output from failed tests
82 (setenv "CTEST_OUTPUT_ON_FAILURE" "TRUE"))))
83 (replace 'configure
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let ((out (assoc-ref outputs "out")))
86 (zero? (system*
87 "./configure"
88 (string-append "--prefix=" out)
89 "--system-libs"
90 "--no-system-jsoncpp" ; not packaged yet
91 ;; By default, the man pages and other docs land
92 ;; in PREFIX/man and PREFIX/doc, but we want them
93 ;; in share/{man,doc}. Note that unlike
94 ;; autoconf-generated configure scripts, cmake's
95 ;; configure prepends "PREFIX/" to what we pass
96 ;; to --mandir and --docdir.
97 "--mandir=share/man"
98 ,(string-append
99 "--docdir=share/doc/cmake-"
100 (version-major+minor version)))))))
101 (add-after 'unpack 'remove-libarchive-version-test
102 ; This test check has been failing consistantly over libarchive 3.2.x
103 ; and cmake 3.4.x and 3.5.x so we disable it for now
104 (lambda _
105 (substitute*
106 "Tests/CMakeOnly/AllFindModules/CMakeLists.txt"
107 (("LibArchive") ""))
108 #t)))))
109 (inputs
110 `(("file" ,file)
111 ("curl" ,curl)
112 ("zlib" ,zlib)
113 ("expat" ,expat)
114 ("bzip2" ,bzip2)
115 ("libarchive" ,libarchive)))
116 (native-search-paths
117 (list (search-path-specification
118 (variable "CMAKE_PREFIX_PATH")
119 (files '("")))))
120 (home-page "http://www.cmake.org/")
121 (synopsis "Cross-platform build system")
122 (description
123 "CMake is a family of tools designed to build, test and package software.
124 CMake is used to control the software compilation process using simple platform
125 and compiler independent configuration files. CMake generates native makefiles
126 and workspaces that can be used in the compiler environment of your choice.")
127 (license bsd-3)))