cmake.scm 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 Marius Bakke <mbakke@fastmail.com>
  9. ;;;
  10. ;;; This file is part of GNU Guix.
  11. ;;;
  12. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  13. ;;; under the terms of the GNU General Public License as published by
  14. ;;; the Free Software Foundation; either version 3 of the License, or (at
  15. ;;; your option) any later version.
  16. ;;;
  17. ;;; GNU Guix is distributed in the hope that it will be useful, but
  18. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;;; GNU General Public License for more details.
  21. ;;;
  22. ;;; You should have received a copy of the GNU General Public License
  23. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  24. (define-module (gnu packages cmake)
  25. #:use-module ((guix licenses) #:prefix license:)
  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 libevent)
  36. #:use-module (gnu packages ncurses)
  37. #:use-module (gnu packages xml))
  38. (define-public cmake
  39. (package
  40. (name "cmake")
  41. (version "3.7.2")
  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. "1q6a60695prpzzsmczm2xrgxdb61fyjznb04dr6yls6iwv24c4nw"))
  50. (patches (search-patches "cmake-fix-tests.patch"))
  51. (modules '((guix build utils)))
  52. (snippet
  53. '(begin
  54. ;; Drop bundled software.
  55. (with-directory-excursion "Utilities"
  56. (for-each delete-file-recursively
  57. '("cmbzip2"
  58. ;"cmcompress"
  59. "cmcurl"
  60. "cmexpat"
  61. ;"cmjsoncpp"
  62. ;"cmlibarchive"
  63. "cmliblzma"
  64. "cmlibuv"
  65. "cmzlib"))
  66. #t)))))
  67. (build-system gnu-build-system)
  68. (arguments
  69. `(#:test-target "test"
  70. #:phases
  71. (modify-phases %standard-phases
  72. (add-before 'configure 'patch-bin-sh
  73. (lambda _
  74. ;; Replace "/bin/sh" by the right path in... a lot of
  75. ;; files.
  76. (substitute*
  77. '("Modules/CompilerId/Xcode-3.pbxproj.in"
  78. "Modules/CompilerId/Xcode-1.pbxproj.in"
  79. "Modules/CompilerId/Xcode-2.pbxproj.in"
  80. "Modules/CPack.RuntimeScript.in"
  81. "Source/cmakexbuild.cxx"
  82. "Source/cmGlobalXCodeGenerator.cxx"
  83. "Source/CTest/cmCTestBatchTestHandler.cxx"
  84. "Source/cmLocalUnixMakefileGenerator3.cxx"
  85. "Source/cmExecProgramCommand.cxx"
  86. "Utilities/Release/release_cmake.cmake"
  87. "Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
  88. "Tests/CMakeLists.txt"
  89. "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
  90. (("/bin/sh") (which "sh")))
  91. #t))
  92. (add-before 'configure 'set-paths
  93. (lambda _
  94. ;; Help cmake's bootstrap process to find system libraries
  95. (begin
  96. (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
  97. (setenv "CMAKE_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
  98. #t)))
  99. (replace 'configure
  100. (lambda* (#:key outputs #:allow-other-keys)
  101. (let ((out (assoc-ref outputs "out")))
  102. (zero? (system*
  103. "./configure"
  104. (string-append "--prefix=" out)
  105. "--system-libs"
  106. "--no-system-jsoncpp" ; FIXME: Circular dependency.
  107. ;; By default, the man pages and other docs land
  108. ;; in PREFIX/man and PREFIX/doc, but we want them
  109. ;; in share/{man,doc}. Note that unlike
  110. ;; autoconf-generated configure scripts, cmake's
  111. ;; configure prepends "PREFIX/" to what we pass
  112. ;; to --mandir and --docdir.
  113. "--mandir=share/man"
  114. ,(string-append
  115. "--docdir=share/doc/cmake-"
  116. (version-major+minor version)))))))
  117. (add-before 'check 'set-test-environment
  118. (lambda _
  119. ;; Get verbose output from failed tests.
  120. (setenv "CTEST_OUTPUT_ON_FAILURE" "TRUE")
  121. ;; Run tests in parallel.
  122. (setenv "CTEST_PARALLEL_LEVEL"
  123. (number->string (parallel-job-count)))
  124. #t)))))
  125. (inputs
  126. `(("file" ,file)
  127. ("curl" ,curl)
  128. ("zlib" ,zlib)
  129. ("expat" ,expat)
  130. ("bzip2" ,bzip2)
  131. ("ncurses" ,ncurses) ; required for ccmake
  132. ("libuv" ,libuv)
  133. ("libarchive" ,libarchive)))
  134. (native-search-paths
  135. (list (search-path-specification
  136. (variable "CMAKE_PREFIX_PATH")
  137. (files '("")))))
  138. (home-page "https://www.cmake.org/")
  139. (synopsis "Cross-platform build system")
  140. (description
  141. "CMake is a family of tools designed to build, test and package software.
  142. CMake is used to control the software compilation process using simple platform
  143. and compiler independent configuration files. CMake generates native makefiles
  144. and workspaces that can be used in the compiler environment of your choice.")
  145. (license (list license:bsd-3 ; cmake
  146. license:bsd-4 ; cmcompress
  147. license:bsd-2 ; cmlibarchive
  148. license:expat ; cmjsoncpp is dual MIT/public domain
  149. license:public-domain)))) ; cmlibarchive/archive_getdate.c