gnu: Add tbb-for-salmon.

* gnu/packages/tbb.scm (tbb-for-salmon): New variable.
This commit is contained in:
Ricardo Wurmus 2021-10-18 20:50:40 +00:00
parent e486b2b674
commit 0ceb01a1ed
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -25,6 +25,7 @@ (define-module (gnu packages tbb)
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (gnu packages))
(define-public tbb
@ -52,3 +53,80 @@ (define-public tbb
implementation work. It provides parallel loop constructs, asynchronous
tasks, synchronization primitives, atomic operations, and more.")
(license asl2.0)))
(define-public tbb-for-salmon
(package
(name "tbb")
(version "2020.3")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/01org/tbb")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0r9axsdlmacjlcnax4vkzg86nwf8lsx7wbqdi3wnryaxk0xvdcx6"))
(modules '((guix build utils)))
(snippet
'(begin
(substitute* "build/common.inc"
(("export tbb_build_prefix.+$")
"export tbb_build_prefix?=guix\n"))
;; Don't capture the build time and kernel version.
(substitute* "build/version_info_linux.sh"
(("uname -srv") "uname -s")
(("`date -u`") "01 Jan 1970"))
(substitute* "build/linux.inc"
(("os_kernel_version:=.*")
"os_kernel_version:=5\n")
(("os_version:=.*")
"os_version:=1\n"))))))
(outputs '("out" "doc"))
(build-system gnu-build-system)
(arguments
`(#:test-target "test"
#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib"))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'fail-on-test-errors
(lambda _
(substitute* "Makefile"
(("-\\$\\(MAKE") "$(MAKE"))))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(substitute* "build/linux.gcc.inc"
(("LIB_LINK_FLAGS =")
(string-append "LIB_LINK_FLAGS = -Wl,-rpath="
(assoc-ref outputs "out") "/lib")))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((doc (string-append
(assoc-ref outputs "doc") "/doc"))
(examples (string-append doc "/examples"))
(lib (string-append
(assoc-ref outputs "out") "/lib"))
(include (string-append
(assoc-ref outputs "out") "/include")))
(mkdir-p lib)
(for-each
(lambda (f)
(copy-file f
(string-append lib "/"
(basename f))))
(find-files "build/guix_release" "\\.so"))
(copy-recursively "doc" doc)
(copy-recursively "examples" examples)
(copy-recursively "include" include)))))))
(home-page "https://www.threadingbuildingblocks.org")
(synopsis "C++ library for parallel programming")
(description
"Threading Building Blocks (TBB) is a C++ runtime library that abstracts
the low-level threading details necessary for optimal multi-core performance.
It uses common C++ templates and coding style to eliminate tedious threading
implementation work. It provides parallel loop constructs, asynchronous
tasks, synchronization primitives, atomic operations, and more.")
(license asl2.0)))