gnu: python-pandas: Fix build on 32-bit.
[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 ncurses)
36 #:use-module (gnu packages xml))
37
38 (define-public cmake
39 (package
40 (name "cmake")
41 (version "3.6.1")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append "https://www.cmake.org/files/v"
45 (version-major+minor version)
46 "/cmake-" version ".tar.gz"))
47 (sha256
48 (base32
49 "04ggm9c0zklxypm6df1v4klrrd85m6vpv13kasj42za283n9ivi8"))
50 (patches (search-patches "cmake-fix-tests.patch"))))
51 (build-system gnu-build-system)
52 (arguments
53 `(#:test-target "test"
54 #:phases
55 (modify-phases %standard-phases
56 (add-before 'configure 'patch-bin-sh
57 (lambda _
58 ;; Replace "/bin/sh" by the right path in... a lot of
59 ;; files.
60 (substitute*
61 '("Modules/CompilerId/Xcode-3.pbxproj.in"
62 "Modules/CompilerId/Xcode-1.pbxproj.in"
63 "Modules/CompilerId/Xcode-2.pbxproj.in"
64 "Modules/CPack.RuntimeScript.in"
65 "Source/cmakexbuild.cxx"
66 "Source/cmGlobalXCodeGenerator.cxx"
67 "Source/CTest/cmCTestBatchTestHandler.cxx"
68 "Source/cmLocalUnixMakefileGenerator3.cxx"
69 "Source/cmExecProgramCommand.cxx"
70 "Utilities/cmbzip2/Makefile-libbz2_so"
71 "Utilities/Release/release_cmake.cmake"
72 "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
73 "Tests/CMakeLists.txt"
74 "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
75 (("/bin/sh") (which "sh")))))
76 (add-before 'configure 'set-paths
77 (lambda _
78 ;; Help cmake's bootstrap process to find system libraries
79 (begin
80 (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
81 (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
82 ;; Get verbose output from failed tests
83 (setenv "CTEST_OUTPUT_ON_FAILURE" "TRUE"))))
84 (replace 'configure
85 (lambda* (#:key outputs #:allow-other-keys)
86 (let ((out (assoc-ref outputs "out")))
87 (zero? (system*
88 "./configure"
89 (string-append "--prefix=" out)
90 "--system-libs"
91 "--no-system-jsoncpp" ; not packaged yet
92 ;; By default, the man pages and other docs land
93 ;; in PREFIX/man and PREFIX/doc, but we want them
94 ;; in share/{man,doc}. Note that unlike
95 ;; autoconf-generated configure scripts, cmake's
96 ;; configure prepends "PREFIX/" to what we pass
97 ;; to --mandir and --docdir.
98 "--mandir=share/man"
99 ,(string-append
100 "--docdir=share/doc/cmake-"
101 (version-major+minor version))))))))))
102 (inputs
103 `(("file" ,file)
104 ("curl" ,curl)
105 ("zlib" ,zlib)
106 ("expat" ,expat)
107 ("bzip2" ,bzip2)
108 ("ncurses" ,ncurses) ; required for ccmake
109 ("libarchive" ,libarchive)))
110 (native-search-paths
111 (list (search-path-specification
112 (variable "CMAKE_PREFIX_PATH")
113 (files '("")))))
114 (home-page "https://www.cmake.org/")
115 (synopsis "Cross-platform build system")
116 (description
117 "CMake is a family of tools designed to build, test and package software.
118 CMake is used to control the software compilation process using simple platform
119 and compiler independent configuration files. CMake generates native makefiles
120 and workspaces that can be used in the compiler environment of your choice.")
121 (license bsd-3)))