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