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
} )
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 " ] ++
# 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
} ;
}