nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 107 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 llvm_meta, 5 release_version, 6 monorepoSrc ? null, 7 src ? null, 8 runCommand, 9 cmake, 10 ninja, 11 llvm, 12 lit, 13 clang-unwrapped, 14 perl, 15 pkg-config, 16 python3, 17 version, 18 devExtraCmakeFlags ? [ ], 19 ompdSupport ? true, 20 ompdGdbSupport ? ompdSupport, 21 getVersionFile, 22 fetchpatch, 23}: 24 25assert lib.assertMsg (ompdGdbSupport -> ompdSupport) "OMPD GDB support requires OMPD support!"; 26 27stdenv.mkDerivation (finalAttrs: { 28 pname = "openmp"; 29 inherit version; 30 31 src = 32 if monorepoSrc != null then 33 runCommand "openmp-src-${version}" { inherit (monorepoSrc) passthru; } '' 34 mkdir -p "$out" 35 cp -r ${monorepoSrc}/cmake "$out" 36 cp -r ${monorepoSrc}/openmp "$out" 37 '' 38 else 39 src; 40 41 sourceRoot = "${finalAttrs.src.name}/openmp"; 42 43 outputs = [ 44 "out" 45 "dev" 46 ]; 47 48 patches = 49 lib.optional (lib.versionOlder release_version "19") (getVersionFile "openmp/fix-find-tool.patch") 50 ++ [ 51 (getVersionFile "openmp/run-lit-directly.patch") 52 ]; 53 54 nativeBuildInputs = [ 55 cmake 56 python3 57 perl 58 ninja 59 pkg-config 60 lit 61 ]; 62 63 buildInputs = [ 64 llvm 65 ] 66 ++ lib.optionals (ompdSupport && ompdGdbSupport) [ 67 python3 68 ]; 69 70 cmakeFlags = [ 71 (lib.cmakeBool "LIBOMP_ENABLE_SHARED" ( 72 !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.hasSharedLibraries 73 )) 74 (lib.cmakeBool "LIBOMP_OMPD_SUPPORT" ompdSupport) 75 (lib.cmakeBool "LIBOMP_OMPD_GDB_SUPPORT" ompdGdbSupport) 76 (lib.cmakeFeature "CLANG_TOOL" "${clang-unwrapped}/bin/clang") 77 (lib.cmakeFeature "OPT_TOOL" "${llvm}/bin/opt") 78 (lib.cmakeFeature "LINK_TOOL" "${llvm}/bin/llvm-link") 79 ] 80 ++ devExtraCmakeFlags; 81 82 doCheck = false; 83 84 checkTarget = "check-openmp"; 85 86 preCheck = '' 87 patchShebangs ../tools/archer/tests/deflake.bash 88 ''; 89 90 meta = llvm_meta // { 91 homepage = "https://openmp.llvm.org/"; 92 description = "Support for the OpenMP language"; 93 longDescription = '' 94 The OpenMP subproject of LLVM contains the components required to build an 95 executable OpenMP program that are outside the compiler itself. 96 Contains the code for the runtime library against which code compiled by 97 "clang -fopenmp" must be linked before it can run and the library that 98 supports offload to target devices. 99 ''; 100 # "All of the code is dual licensed under the MIT license and the UIUC 101 # License (a BSD-like license)": 102 license = with lib.licenses; [ 103 mit 104 ncsa 105 ]; 106 }; 107})