Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchFromGitHub 4, fetchpatch 5, cmake 6}: 7 8stdenv.mkDerivation rec { 9 pname = "tbb"; 10 version = "2021.8.0"; 11 12 outputs = [ "out" "dev" ]; 13 14 src = fetchFromGitHub { 15 owner = "oneapi-src"; 16 repo = "oneTBB"; 17 rev = "v${version}"; 18 hash = "sha256-7MjUdPB1GsPt7ZkYj7DCisq20X8psljsVCjDpCSTYT4="; 19 }; 20 21 nativeBuildInputs = [ 22 cmake 23 ]; 24 25 patches = [ 26 # Fix musl build from https://github.com/oneapi-src/oneTBB/pull/899 27 (fetchpatch { 28 url = "https://patch-diff.githubusercontent.com/raw/oneapi-src/oneTBB/pull/899.patch"; 29 hash = "sha256-kU6RRX+sde0NrQMKlNtW3jXav6J4QiVIUmD50asmBPU="; 30 }) 31 32 # Fix/suppress warnings on gcc12.1 from https://github.com/oneapi-src/oneTBB/pull/866 33 (fetchpatch { 34 url = "https://patch-diff.githubusercontent.com/raw/oneapi-src/oneTBB/pull/866.patch"; 35 hash = "sha256-e44Yv84Hfl5xoxWWTnLJLSGeNA1RBbah4/L43gPLS+c="; 36 }) 37 ]; 38 39 # Fix build with modern gcc 40 # In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]', 41 NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-error=stringop-overflow" ] ++ 42 # Workaround for gcc-12 ICE when using -O3 43 # https://gcc.gnu.org/PR108854 44 lib.optionals (stdenv.cc.isGNU && stdenv.isx86_32) [ "-O2" ]; 45 46 # Disable failing test on musl 47 # 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’? 48 postPatch = lib.optionalString stdenv.hostPlatform.isMusl '' 49 substituteInPlace test/CMakeLists.txt \ 50 --replace 'conformance_resumable_tasks' "" 51 ''; 52 53 meta = with lib; { 54 description = "Intel Thread Building Blocks C++ Library"; 55 homepage = "http://threadingbuildingblocks.org/"; 56 license = licenses.asl20; 57 longDescription = '' 58 Intel Threading Building Blocks offers a rich and complete approach to 59 expressing parallelism in a C++ program. It is a library that helps you 60 take advantage of multi-core processor performance without having to be a 61 threading expert. Intel TBB is not just a threads-replacement library. It 62 represents a higher-level, task-based parallelism that abstracts platform 63 details and threading mechanisms for scalability and performance. 64 ''; 65 platforms = platforms.unix; 66 maintainers = with maintainers; [ thoughtpolice tmarkus ]; 67 }; 68}