Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 67 lines 2.5 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, fetchpatch 5, cmake 6}: 7 8stdenv.mkDerivation rec { 9 pname = "tbb"; 10 version = "2021.11.0"; 11 12 outputs = [ "out" "dev" ]; 13 14 src = fetchFromGitHub { 15 owner = "oneapi-src"; 16 repo = "oneTBB"; 17 rev = "v${version}"; 18 hash = "sha256-zGZHMtAUVzBKFbCshpepm3ce3tW6wQ+F30kYYXAQ/TE="; 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 33 # Fix build with modern gcc 34 # In member function 'void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]', 35 NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-error=array-bounds" "-Wno-error=stringop-overflow" ] ++ 36 # error: variable 'val' set but not used 37 lib.optionals stdenv.cc.isClang [ "-Wno-error=unused-but-set-variable" ] ++ 38 # Workaround for gcc-12 ICE when using -O3 39 # https://gcc.gnu.org/PR108854 40 lib.optionals (stdenv.cc.isGNU && stdenv.isx86_32) [ "-O2" ]; 41 42 # Fix undefined reference errors with version script under LLVM. 43 NIX_LDFLAGS = lib.optionalString (stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17") "--undefined-version"; 44 45 # Disable failing test on musl 46 # 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’? 47 postPatch = lib.optionalString stdenv.hostPlatform.isMusl '' 48 substituteInPlace test/CMakeLists.txt \ 49 --replace 'conformance_resumable_tasks' "" 50 ''; 51 52 meta = with lib; { 53 description = "Intel Thread Building Blocks C++ Library"; 54 homepage = "http://threadingbuildingblocks.org/"; 55 license = licenses.asl20; 56 longDescription = '' 57 Intel Threading Building Blocks offers a rich and complete approach to 58 expressing parallelism in a C++ program. It is a library that helps you 59 take advantage of multi-core processor performance without having to be a 60 threading expert. Intel TBB is not just a threads-replacement library. It 61 represents a higher-level, task-based parallelism that abstracts platform 62 details and threading mechanisms for scalability and performance. 63 ''; 64 platforms = platforms.unix; 65 maintainers = with maintainers; [ thoughtpolice tmarkus ]; 66 }; 67}