about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/16/openmp/default.nix
blob: d51335436ad235c015bc4b2a6a1b835fb3b26124 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{ lib
, stdenv
, llvm_meta
, monorepoSrc
, runCommand
, cmake
, ninja
, llvm
, targetLlvm
, lit
, clang-unwrapped
, perl
, pkg-config
, xcbuild
, version
}:

stdenv.mkDerivation rec {
  pname = "openmp";
  inherit version;

  src = runCommand "${pname}-src-${version}" {} ''
    mkdir -p "$out"
    cp -r ${monorepoSrc}/cmake "$out"
    cp -r ${monorepoSrc}/${pname} "$out"
  '';

  sourceRoot = "${src.name}/${pname}";

  patches = [
    ./fix-find-tool.patch
    ./gnu-install-dirs.patch
    ./run-lit-directly.patch
  ];

  outputs = [ "out" "dev" ];

  nativeBuildInputs = [ cmake ninja perl pkg-config lit ];
  buildInputs = [
    (if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
  ];

  nativeCheckInputs = lib.optional stdenv.hostPlatform.isDarwin xcbuild.xcrun;

  # Unsup:Pass:XFail:Fail
  # 26:267:16:8
  doCheck = false;
  checkTarget = "check-openmp";

  preCheck = ''
    patchShebangs ../tools/archer/tests/deflake.bash
  '';

  cmakeFlags = [
    "-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
    "-DOPT_TOOL=${llvm}/bin/opt"
    "-DLINK_TOOL=${llvm}/bin/llvm-link"
  ];

  meta = llvm_meta // {
    homepage = "https://openmp.llvm.org/";
    description = "Support for the OpenMP language";
    longDescription = ''
      The OpenMP subproject of LLVM contains the components required to build an
      executable OpenMP program that are outside the compiler itself.
      Contains the code for the runtime library against which code compiled by
      "clang -fopenmp" must be linked before it can run and the library that
      supports offload to target devices.
    '';
    # "All of the code is dual licensed under the MIT license and the UIUC
    # License (a BSD-like license)":
    license = with lib.licenses; [ mit ncsa ];
  };
}