tbb.scm 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
  3. ;;; Copyright © 2016 Nikita <nikita@n0.is>
  4. ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages tbb)
  22. #:use-module (guix packages)
  23. #:use-module (guix licenses)
  24. #:use-module (guix git-download)
  25. #:use-module (guix utils)
  26. #:use-module (guix build-system cmake)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (gnu packages))
  29. (define-public tbb
  30. (package
  31. (name "tbb")
  32. (version "2021.3.0")
  33. (source (origin
  34. (method git-fetch)
  35. (uri (git-reference
  36. (url "https://github.com/oneapi-src/oneTBB")
  37. (commit (string-append "v" version))))
  38. (file-name (git-file-name name version))
  39. (sha256
  40. (base32
  41. "1bz039my3ma87f24ngcsqs16f8jlpdgaqg01ab4g60nfqbrz1lkq"))))
  42. (build-system cmake-build-system)
  43. (arguments
  44. `(#:configure-flags '("-DTBB_STRICT=OFF"))) ;; Don't fail on warnings
  45. (home-page "https://www.threadingbuildingblocks.org")
  46. (synopsis "C++ library for parallel programming")
  47. (description
  48. "Threading Building Blocks (TBB) is a C++ runtime library that abstracts
  49. the low-level threading details necessary for optimal multi-core performance.
  50. It uses common C++ templates and coding style to eliminate tedious threading
  51. implementation work. It provides parallel loop constructs, asynchronous
  52. tasks, synchronization primitives, atomic operations, and more.")
  53. (license asl2.0)))
  54. (define-public tbb-2020
  55. (package
  56. (name "tbb")
  57. (version "2020.3")
  58. (source (origin
  59. (method git-fetch)
  60. (uri (git-reference
  61. (url "https://github.com/01org/tbb")
  62. (commit (string-append "v" version))))
  63. (file-name (git-file-name name version))
  64. (sha256
  65. (base32
  66. "0r9axsdlmacjlcnax4vkzg86nwf8lsx7wbqdi3wnryaxk0xvdcx6"))
  67. (modules '((guix build utils)))
  68. (snippet
  69. '(begin
  70. (substitute* "build/common.inc"
  71. (("export tbb_build_prefix.+$")
  72. "export tbb_build_prefix?=guix\n"))
  73. ;; Don't capture the build time and kernel version.
  74. (substitute* "build/version_info_linux.sh"
  75. (("uname -srv") "uname -s")
  76. (("`date -u`") "01 Jan 1970"))
  77. (substitute* "build/linux.inc"
  78. (("os_kernel_version:=.*")
  79. "os_kernel_version:=5\n")
  80. (("os_version:=.*")
  81. "os_version:=1\n"))))))
  82. (outputs '("out" "doc"))
  83. (build-system gnu-build-system)
  84. (arguments
  85. `(#:test-target "test"
  86. #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
  87. (assoc-ref %outputs "out") "/lib"))
  88. #:phases
  89. (modify-phases %standard-phases
  90. (add-after 'unpack 'fail-on-test-errors
  91. (lambda _
  92. (substitute* "Makefile"
  93. (("-\\$\\(MAKE") "$(MAKE"))))
  94. (replace 'configure
  95. (lambda* (#:key outputs #:allow-other-keys)
  96. (substitute* "build/linux.gcc.inc"
  97. (("LIB_LINK_FLAGS =")
  98. (string-append "LIB_LINK_FLAGS = -Wl,-rpath="
  99. (assoc-ref outputs "out") "/lib")))))
  100. (replace 'install
  101. (lambda* (#:key outputs #:allow-other-keys)
  102. (let* ((doc (string-append
  103. (assoc-ref outputs "doc") "/doc"))
  104. (examples (string-append doc "/examples"))
  105. (lib (string-append
  106. (assoc-ref outputs "out") "/lib"))
  107. (include (string-append
  108. (assoc-ref outputs "out") "/include")))
  109. (mkdir-p lib)
  110. (for-each
  111. (lambda (f)
  112. (copy-file f
  113. (string-append lib "/"
  114. (basename f))))
  115. (find-files "build/guix_release" "\\.so"))
  116. (copy-recursively "doc" doc)
  117. (copy-recursively "examples" examples)
  118. (copy-recursively "include" include)))))))
  119. (home-page "https://www.threadingbuildingblocks.org")
  120. (synopsis "C++ library for parallel programming")
  121. (description
  122. "Threading Building Blocks (TBB) is a C++ runtime library that abstracts
  123. the low-level threading details necessary for optimal multi-core performance.
  124. It uses common C++ templates and coding style to eliminate tedious threading
  125. implementation work. It provides parallel loop constructs, asynchronous
  126. tasks, synchronization primitives, atomic operations, and more.")
  127. (license asl2.0)))