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>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
48 (uri (string-append "https://www.cmake.org/files/v"
49 (version-major+minor version)
50 "/cmake-" version ".tar.gz"))
53 "0sv5k9q6braa8hhw0y3w19avqn0xn5czv5jf5fz5blnlf7ivw4y3"))
54 (modules '((guix build utils)))
57 ;; Drop bundled software.
58 (with-directory-excursion "Utilities"
59 (for-each delete-file-recursively
70 (build-system gnu-build-system)
72 `(#:test-target "test"
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"
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 "\\|") "\\)$")))
87 (modify-phases %standard-phases
88 (add-before 'configure 'patch-bin-sh
90 ;; Replace "/bin/sh" by the right path in... a lot of
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")))
105 (add-before 'configure 'set-paths
107 ;; Help cmake's bootstrap process to find system libraries
109 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
110 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let ((out (assoc-ref outputs "out")))
116 "./configure" "--verbose"
117 (string-append "--parallel=" (number->string (parallel-job-count)))
118 (string-append "--prefix=" out)
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.
129 "--docdir=share/doc/cmake-"
130 (version-major+minor version)))))))))
136 ("libarchive" ,libarchive)
138 ("ncurses" ,ncurses) ; required for ccmake
142 (list (search-path-specification
143 (variable "CMAKE_PREFIX_PATH")
145 (home-page "https://cmake.org/")
146 (synopsis "Cross-platform build system")
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