2021-05-20 23:08:51 +00:00
{ lib
, stdenv
, fetchFromGitHub
2023-03-15 16:39:30 +00:00
, fetchpatch
, cmake
2021-05-20 23:08:51 +00:00
} :
2020-04-24 23:36:52 +00:00
2021-05-20 23:08:51 +00:00
stdenv . mkDerivation rec {
2020-04-24 23:36:52 +00:00
pname = " t b b " ;
2023-03-15 16:39:30 +00:00
version = " 2 0 2 1 . 8 . 0 " ;
2020-04-24 23:36:52 +00:00
2023-02-16 17:41:37 +00:00
outputs = [ " o u t " " d e v " ] ;
2020-04-24 23:36:52 +00:00
src = fetchFromGitHub {
2021-05-20 23:08:51 +00:00
owner = " o n e a p i - s r c " ;
repo = " o n e T B B " ;
rev = " v ${ version } " ;
2023-03-15 16:39:30 +00:00
hash = " s h a 2 5 6 - 7 M j U d P B 1 G s P t 7 Z k Y j 7 D C i s q 2 0 X 8 p s l j s V C j D p C S T Y T 4 = " ;
2020-04-24 23:36:52 +00:00
} ;
2023-03-15 16:39:30 +00:00
nativeBuildInputs = [
cmake
] ;
2022-06-16 17:23:12 +00:00
2023-03-15 16:39:30 +00:00
patches = [
# Fix musl build from https://github.com/oneapi-src/oneTBB/pull/899
( fetchpatch {
url = " h t t p s : / / p a t c h - d i f f . g i t h u b u s e r c o n t e n t . c o m / r a w / o n e a p i - s r c / o n e T B B / p u l l / 8 9 9 . p a t c h " ;
hash = " s h a 2 5 6 - k U 6 R R X + s d e 0 N r Q M K l N t W 3 j X a v 6 J 4 Q i V I U m D 5 0 a s m B P U = " ;
2022-06-16 17:23:12 +00:00
} )
2022-08-12 12:06:08 +00:00
2023-03-15 16:39:30 +00:00
# Fix/suppress warnings on gcc12.1 from https://github.com/oneapi-src/oneTBB/pull/866
( fetchpatch {
url = " h t t p s : / / p a t c h - d i f f . g i t h u b u s e r c o n t e n t . c o m / r a w / o n e a p i - s r c / o n e T B B / p u l l / 8 6 6 . p a t c h " ;
hash = " s h a 2 5 6 - e 4 4 Y v 8 4 H f l 5 x o x W W T n L J L S G e N A 1 R B b a h 4 / L 4 3 g P L S + c = " ;
2022-08-12 12:06:08 +00:00
} )
2024-01-13 08:15:51 +00:00
# Fix build with GCC 13
( fetchpatch {
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 / 1 5 4 c c 7 3 c a 4 d 3 5 9 6 2 1 2 0 2 3 9 9 c c 0 c 3 c 9 1 0 5 8 e 5 6 e 7 9 . p a t c h " ;
hash = " s h a 2 5 6 - B V Q Q X g B g 8 T 1 9 D G w 2 g m F k m 3 K K O u z z J J N O T f / i N I c n H a g = " ;
} )
( fetchpatch {
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 / e 1 3 1 0 7 1 7 6 9 e e 3 d f 5 1 b 5 6 b 0 5 3 b a 6 b f a 0 6 a e 9 e f f 2 5 . p a t c h " ;
hash = " s h a 2 5 6 - I f V / D D b 0 l u x E 1 l 6 T o f A b Q I e J E V x C x Z f Z q c O N G w Q E n d Y = " ;
} )
2021-05-20 23:08:51 +00:00
] ;
2020-04-24 23:36:52 +00:00
2023-03-15 16:39:30 +00:00
# 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 = s t r i n g o p - o v e r f l o w " ] ++
2023-11-16 04:20:00 +00:00
# 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 " ] ++
2023-03-15 16:39:30 +00:00
# Workaround for gcc-12 ICE when using -O3
# https://gcc.gnu.org/PR108854
lib . optionals ( stdenv . cc . isGNU && stdenv . isx86_32 ) [ " - O 2 " ] ;
2020-04-24 23:36:52 +00:00
2023-03-15 16:39:30 +00:00
# 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 ' conformance_resumable_tasks' " "
2021-05-20 23:08:51 +00:00
'' ;
2020-04-24 23:36:52 +00:00
2021-05-20 23:08:51 +00:00
meta = with lib ; {
2020-04-24 23:36:52 +00:00
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 .
'' ;
2021-05-20 23:08:51 +00:00
platforms = platforms . unix ;
2023-03-15 16:39:30 +00:00
maintainers = with maintainers ; [ thoughtpolice tmarkus ] ;
2020-04-24 23:36:52 +00:00
} ;
}