2024-06-20 14:57:18 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
} :
stdenv . mkDerivation rec {
pname = " t b b " ;
version = " 2 0 2 1 . 5 . 0 " ;
outputs = [ " o u t " " d e v " ] ;
src = fetchFromGitHub {
owner = " o n e a p i - s r c " ;
repo = " o n e T B B " ;
rev = " v ${ version } " ;
hash = " s h a 2 5 6 - T J / o S S M v g t K u z 7 P V y I o F E b B W 6 E Z z 7 t 2 w r / k P 0 9 3 H F / w = " ;
} ;
nativeBuildInputs = [
cmake
] ;
patches = [
# port of https://github.com/oneapi-src/oneTBB/pull/1031
./gcc13-fixes-2021.5.0.patch
( fetchpatch {
# Fix "field used uninitialized" on modern gcc versions (https://github.com/oneapi-src/oneTBB/pull/958)
url = " h t t p s : / / g i t h u b . c o m / o n e a p i - s r c / o n e T B B / c o m m i t / 3 0 0 3 e c 0 7 7 4 0 7 0 3 e 6 a e d 1 2 b 0 2 8 a f 2 0 f 4 b 0 f 1 6 a d a e . p a t c h " ;
hash = " s h a 2 5 6 - l 4 + 9 I x I E d R X / q 8 J y D Y 9 C P K W z S L a t p I V S i N j m I M 7 i l j 0 = " ;
} )
] ;
# Disable failing test on musl
# test/conformance/conformance_resumable_tasks.cpp:37:24: error: ‘ suspend’ is not a member of ‘ tbb::v1::task’ ; did you mean ‘ tbb::detail::r1::suspend’ ?
postPatch = lib . optionalString stdenv . hostPlatform . isMusl ''
substituteInPlace test/CMakeLists.txt \
- - replace-fail ' conformance_resumable_tasks' " "
'' ;
# Fix build with modern gcc
# In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]',
NIX_CFLAGS_COMPILE = lib . optionals stdenv . cc . isGNU [ " - W n o - e r r o r = a r r a y - b o u n d s " " - W n o - e r r o r = s t r i n g o p - o v e r f l o w " " - W n o - a d d r e s s " ] ++
# error: variable 'val' set but not used
lib . optionals stdenv . cc . isClang [ " - W n o - e r r o r = u n u s e d - b u t - s e t - v a r i a b l e " ] ++
# Workaround for gcc-12 ICE when using -O3
# https://gcc.gnu.org/PR108854
2024-09-26 11:04:55 +00:00
lib . optionals ( stdenv . cc . isGNU && stdenv . hostPlatform . isx86_32 ) [ " - O 2 " ] ;
2024-06-20 14:57:18 +00:00
# Fix undefined reference errors with version script under LLVM.
NIX_LDFLAGS = lib . optionalString ( stdenv . cc . bintools . isLLVM && lib . versionAtLeast stdenv . cc . bintools . version " 1 7 " ) " - - u n d e f i n e d - v e r s i o n " ;
meta = with lib ; {
description = " I n t e l T h r e a d B u i l d i n g B l o c k s C + + L i b r a r y " ;
homepage = " h t t p : / / t h r e a d i n g b u i l d i n g b l o c k s . o r g / " ;
license = licenses . asl20 ;
longDescription = ''
Intel Threading Building Blocks offers a rich and complete approach to
expressing parallelism in a C ++ program . It is a library that helps you
take advantage of multi-core processor performance without having to be a
threading expert . Intel TBB is not just a threads-replacement library . It
represents a higher-level , task-based parallelism that abstracts platform
details and threading mechanisms for scalability and performance .
'' ;
platforms = platforms . unix ;
maintainers = with maintainers ; [ thoughtpolice tmarkus ] ;
} ;
}