From 0ceb01a1ed86df0b7f5e57d90efba1949f73e480 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 18 Oct 2021 20:50:40 +0000 Subject: gnu: Add tbb-for-salmon. * gnu/packages/tbb.scm (tbb-for-salmon): New variable. --- gnu/packages/tbb.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'gnu/packages/tbb.scm') diff --git a/gnu/packages/tbb.scm b/gnu/packages/tbb.scm index 2aa31225df..252dc98f7c 100644 --- a/gnu/packages/tbb.scm +++ b/gnu/packages/tbb.scm @@ -25,6 +25,7 @@ #: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 @@ 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))) + +(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))) -- cgit v1.2.3