2021-05-11 13:42:41 +00:00
{ lib
, stdenv
, fetchFromGitHub
2023-02-10 14:05:16 +00:00
, fetchpatch
, cmake
2021-05-11 13:42:41 +00:00
} :
2012-07-18 10:44:34 +00:00
2021-05-11 13:42:41 +00:00
stdenv . mkDerivation rec {
2019-08-15 12:41:18 +00:00
pname = " t b b " ;
2024-04-05 15:36:37 +00:00
version = " 2 0 2 1 . 1 1 . 0 " ;
2012-07-18 10:44:34 +00:00
2023-01-26 13:19:09 +00:00
outputs = [ " o u t " " d e v " ] ;
2017-10-28 22:48:47 +00:00
src = fetchFromGitHub {
2021-05-11 13:42:41 +00:00
owner = " o n e a p i - s r c " ;
repo = " o n e T B B " ;
rev = " v ${ version } " ;
2024-04-05 15:36:37 +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 = " ;
2012-07-18 10:44:34 +00:00
} ;
2023-02-10 14:05:16 +00:00
nativeBuildInputs = [
cmake
] ;
2022-05-20 06:55:35 +00:00
2023-02-10 14:05:16 +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-05-20 06:55:35 +00:00
} )
2021-05-11 13:42:41 +00:00
] ;
2020-09-05 07:11:16 +00:00
2023-02-10 14:05:16 +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-05 15:36:37 +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-10-27 21:39:26 +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-02-10 14:05:16 +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 " ] ;
2012-07-18 10:44:34 +00:00
2024-05-28 04:57:35 +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 " ;
2023-02-10 14:05:16 +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-11 14:00:03 +00:00
'' ;
2021-05-11 13:42:41 +00:00
meta = with lib ; {
2012-07-18 10:44:34 +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 " ;
2017-10-28 22:48:47 +00:00
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 ;
2012-07-18 10:44:34 +00: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 .
'' ;
2021-05-11 13:42:41 +00:00
platforms = platforms . unix ;
2023-02-10 14:05:16 +00:00
maintainers = with maintainers ; [ thoughtpolice tmarkus ] ;
2012-07-18 10:44:34 +00:00
} ;
}