about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/llvm/rocm/lld/default.nix
blob: ef60747b01385139e02c67d3f8ba3d2e9ba024dc (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
{ lib, stdenv
, buildLlvmTools
, cmake
, libxml2
, llvm

, version
, src
}:

stdenv.mkDerivation rec {
  inherit version src;

  pname = "lld";

  nativeBuildInputs = [ cmake ];
  buildInputs = [ libxml2 llvm ];


  cmakeFlags = [
    "-DLLVM_MAIN_SRC_DIR=${llvm.src}"
  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
    "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
    "-DLLVM_CONFIG_PATH=${llvm.dev}/bin/llvm-config-native"
  ];

  outputs = [ "out" "dev" ];

  postInstall = ''
    moveToOutput include "$dev"
    moveToOutput lib "$dev"

    # Fix lld binary path for CMake.
    substituteInPlace "$dev/lib/cmake/lld/LLDTargets-release.cmake" \
      --replace "\''${_IMPORT_PREFIX}/bin/lld" "$out/bin/lld"
  '';

  meta = with lib; {
    description = "ROCm fork of the LLVM Linker";
    homepage = "https://github.com/RadeonOpenCompute/llvm-project";
    license = licenses.ncsa;
    maintainers = with maintainers; [ danieldk ];
    platforms = platforms.linux;
  };
}