2024-12-09 17:47:00 +01:00
{
lib ,
stdenv ,
fetchFromGitHub ,
fetchpatch ,
cmake ,
2025-04-06 18:38:03 -04:00
ninja ,
2024-12-09 17:47:00 +01:00
} :
2025-06-18 16:55:20 +03:00
stdenv . mkDerivation ( finalAttrs : {
2024-12-09 17:47:00 +01:00
pname = " t b b " ;
2025-06-18 16:56:09 +03:00
version = " 2 0 2 2 . 1 . 0 " ;
2024-12-09 17:47:00 +01:00
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 " ;
2025-06-18 16:55:20 +03:00
tag = " v ${ finalAttrs . version } " ;
2025-06-18 16:56:09 +03:00
hash = " s h a 2 5 6 - D q J k N l C 9 4 c P J S X n h y F c E q W Y G C Q P u n M f I f b 0 5 U c F G y n w = " ;
2024-12-09 17:47:00 +01:00
} ;
nativeBuildInputs = [
cmake
2025-04-06 18:38:03 -04:00
ninja
2024-12-09 17:47:00 +01: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 = " ;
} )
2025-04-23 16:03:16 -06:00
# Fix tests on FreeBSD and Windows
( fetchpatch {
name = " f i x - t b b - f r e e b s d - a n d - w i n d o w s - t e s t s . p a t c h " ;
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 / u x l f o u n d a t i o n / o n e T B B / p u l l / 1 6 9 6 . p a t c h " ;
hash = " s h a 2 5 6 - y j X 2 F k O K 8 b z 2 9 a / X S A 7 q X g Q w 9 l x z x 8 V I g E B R E W 3 2 N N 4 = " ;
} )
2025-04-06 18:44:38 -04:00
] ;
2024-12-09 17:47:00 +01: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 = 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 "
]
++
# 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
lib . optionals ( stdenv . cc . isGNU && stdenv . hostPlatform . isx86_32 ) [ " - O 2 " ] ;
# 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 " ;
# 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 ' tbb_add_test ( SUBDIR conformance NAME conformance_resumable_tasks DEPENDENCIES TBB::tbb ) ' " "
'' ;
2025-04-06 18:38:03 -04:00
enableParallelBuilding = true ;
2025-06-18 16:55:20 +03:00
meta = {
2024-12-09 17:47:00 +01: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 / " ;
2025-06-18 16:55:20 +03:00
license = lib . licenses . asl20 ;
2024-12-09 17:47:00 +01:00
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 .
'' ;
2025-06-18 16:55:20 +03:00
platforms = lib . platforms . all ;
maintainers = with lib . maintainers ; [
2025-05-10 11:01:56 -06:00
silvanshade
2024-12-09 17:47:00 +01:00
thoughtpolice
tmarkus
] ;
} ;
2025-06-18 16:55:20 +03:00
} )