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 " ;
2024-04-21 15:54:59 +00:00
version = " 2 0 2 1 . 1 1 . 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 } " ;
2024-04-21 15:54:59 +00:00
hash = " s h a 2 5 6 - z G Z H M t A U V z B K F b C s h p e p m 3 c e 3 t W 6 w Q + F 3 0 k Y Y X A Q / T E = " ;
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
} )
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]',
2024-04-21 15:54:59 +00:00
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 " ] ++
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
} ;
}