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