projects/guix·blob javascript-team · refs

176 lines · 7.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015, 2016, 2022, 2024 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2016 Nikita <[email protected]>
4;;; Copyright © 2019 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
6;;; Copyright © 2022, 2023 Efraim Flashner <[email protected]>
7;;; Copyright © 2025 Janneke Nieuwenhuizen <[email protected]>
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 tbb)
25 #:use-module (guix packages)
26 #:use-module (guix licenses)
27 #:use-module (guix gexp)
28 #:use-module (guix git-download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system cmake)
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages))
33
34(define-public tbb
35 (package
36 (name "tbb")
37 (version "2021.6.0")
38 (source (origin
39 (method git-fetch)
40 (uri (git-reference
41 (url "https://github.com/uxlfoundation/oneTBB/")
42 (commit (string-append "v" version))))
43 (file-name (git-file-name name version))
44 (sha256
45 (base32
46 "039v4jmnkkxs7haxrfmk9j57vfbrwlhjynlm5byfaqddv4cbsy0p"))
47 (patches (search-patches "tbb-other-arches.patch"
48 "tbb-gcc-14.patch"))))
49 (build-system cmake-build-system)
50 (arguments
51 `(#:parallel-tests? #f
52 #:configure-flags
53 '(,@(if (or (target-riscv64?)
54 (target-ppc32?))
55 '("-DTBB_TEST_LINK_FLAGS=-latomic")
56 `())
57 ,@(if (or (target-arm32?)
58 (target-ppc32?))
59 '("-DTBB_TEST_COMPILE_FLAGS=-DTBB_TEST_LOW_WORKLOAD")
60 `())
61 "-DTBB_STRICT=OFF") ;; Don't fail on warnings
62 #:phases
63 (modify-phases %standard-phases
64 ,@(cond
65 ((target-arm32?)
66 `((add-after 'unpack 'adjust-test-suite
67 (lambda _
68 (substitute* "test/CMakeLists.txt"
69 ;; Bus error, skipped on mips.
70 ((".*test_malloc_pools.*") ""))))))
71 ((target-ppc32?)
72 `((add-after 'unpack 'adjust-test-suite
73 (lambda _
74 (substitute* "test/CMakeLists.txt"
75 ;; These tests hang forever.
76 ((".*test_function_node.*") "")
77 ((".*test_multifunction_node.*") "")
78 ((".*test_async_node.*") ""))))))
79 (else '())))))
80 (home-page "https://uxlfoundation.github.io/oneTBB/")
81 (synopsis "C++ library for parallel programming")
82 (description
83 "@acronym{TBB, Threading Building Blocks} is a C++ runtime library that
84abstracts the low-level threading details necessary for optimal multi-core
85performance. It uses common C++ templates and coding style to eliminate
86tedious threading implementation work. It provides parallel loop constructs,
87asynchronous tasks, synchronization primitives, atomic operations, and more.")
88 (license asl2.0)))
89
90(define-public tbb-2020
91 (package
92 (name "tbb")
93 (version "2020.3")
94 (source (origin
95 (method git-fetch)
96 (uri (git-reference
97 (url "https://github.com/01org/tbb")
98 (commit (string-append "v" version))))
99 (file-name (git-file-name name version))
100 (sha256
101 (base32
102 "0r9axsdlmacjlcnax4vkzg86nwf8lsx7wbqdi3wnryaxk0xvdcx6"))
103 (modules '((guix build utils)))
104 (snippet
105 '(begin
106 (substitute* "build/common.inc"
107 (("export tbb_build_prefix.+$")
108 "export tbb_build_prefix?=guix\n"))
109
110 ;; Don't capture the build time and kernel version.
111 (substitute* "build/version_info_linux.sh"
112 (("uname -srv") "uname -s")
113 (("`date -u`") "01 Jan 1970"))
114
115 (substitute* "build/linux.inc"
116 (("os_kernel_version:=.*")
117 "os_kernel_version:=5\n")
118 (("os_version:=.*")
119 "os_version:=1\n"))))))
120 (outputs '("out" "doc"))
121 (build-system gnu-build-system)
122 (arguments
123 `(#:test-target "test"
124 #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
125 (assoc-ref %outputs "out") "/lib")
126 "CFLAGS=-fuse-ld=gold"
127 ,(string-append "CXXFLAGS="
128 " -Wno-error=changes-meaning"
129 " -Wno-error=template-id-cdtor"))
130 #:phases
131 (modify-phases %standard-phases
132 (add-after 'unpack 'fail-on-test-errors
133 (lambda _
134 (substitute* "Makefile"
135 (("-\\$\\(MAKE") "$(MAKE"))))
136 (replace 'configure
137 (lambda* (#:key outputs #:allow-other-keys)
138 (substitute* "build/linux.gcc.inc"
139 (("LIB_LINK_FLAGS =")
140 (string-append "LIB_LINK_FLAGS = -Wl,-rpath="
141 (assoc-ref outputs "out") "/lib")))))
142 (replace 'install
143 (lambda* (#:key outputs #:allow-other-keys)
144 (let* ((doc (string-append
145 (assoc-ref outputs "doc") "/doc"))
146 (examples (string-append doc "/examples"))
147 (lib (string-append
148 (assoc-ref outputs "out") "/lib"))
149 (include (string-append
150 (assoc-ref outputs "out") "/include")))
151 (mkdir-p lib)
152 (for-each
153 (lambda (f)
154 (copy-file f
155 (string-append lib "/"
156 (basename f))))
157 (find-files "build/guix_release" "\\.so"))
158 (copy-recursively "doc" doc)
159 (copy-recursively "examples" examples)
160 (copy-recursively "include" include)))))))
161 (native-inputs
162 ;; XXX: For some reason, since commit "gnu: binutils: Absorb
163 ;; binutils-next", the build of just this version of TBB crashes during
164 ;; tests. Workaround it by linking the binaries with ld.gold.
165 (list (module-ref (resolve-interface
166 '(gnu packages commencement))
167 'ld-gold-wrapper)))
168 (home-page "https://www.threadingbuildingblocks.org")
169 (synopsis "C++ library for parallel programming")
170 (description
171 "Threading Building Blocks (TBB) is a C++ runtime library that abstracts
172the low-level threading details necessary for optimal multi-core performance.
173It uses common C++ templates and coding style to eliminate tedious threading
174implementation work. It provides parallel loop constructs, asynchronous
175tasks, synchronization primitives, atomic operations, and more.")
176 (license asl2.0)))