1{ lib
2, stdenv
3, llvm_meta
4, monorepoSrc
5, runCommand
6, cmake
7, ninja
8, llvm
9, targetLlvm
10, lit
11, clang-unwrapped
12, perl
13, pkg-config
14, version
15}:
16
17stdenv.mkDerivation rec {
18 pname = "openmp";
19 inherit version;
20
21 src = runCommand "${pname}-src-${version}" {} ''
22 mkdir -p "$out"
23 cp -r ${monorepoSrc}/cmake "$out"
24 cp -r ${monorepoSrc}/${pname} "$out"
25 '';
26
27 sourceRoot = "${src.name}/${pname}";
28
29 patches = [
30 ./fix-find-tool.patch
31 ./gnu-install-dirs.patch
32 ./run-lit-directly.patch
33 ];
34
35 outputs = [ "out" "dev" ];
36
37 nativeBuildInputs = [ cmake ninja perl pkg-config lit ];
38 buildInputs = [
39 (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
40 ];
41
42 # Unsup:Pass:XFail:Fail
43 # 26:267:16:8
44 doCheck = false;
45 checkTarget = "check-openmp";
46
47 preCheck = ''
48 patchShebangs ../tools/archer/tests/deflake.bash
49 '';
50
51 cmakeFlags = [
52 "-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
53 "-DOPT_TOOL=${llvm}/bin/opt"
54 "-DLINK_TOOL=${llvm}/bin/llvm-link"
55 ];
56
57 meta = llvm_meta // {
58 homepage = "https://openmp.llvm.org/";
59 description = "Support for the OpenMP language";
60 longDescription = ''
61 The OpenMP subproject of LLVM contains the components required to build an
62 executable OpenMP program that are outside the compiler itself.
63 Contains the code for the runtime library against which code compiled by
64 "clang -fopenmp" must be linked before it can run and the library that
65 supports offload to target devices.
66 '';
67 # "All of the code is dual licensed under the MIT license and the UIUC
68 # License (a BSD-like license)":
69 license = with lib.licenses; [ mit ncsa ];
70 };
71}