{ lib, stdenv , buildLlvmTools , fetch , cmake , libllvm , version }: stdenv.mkDerivation { pname = "lld"; inherit version; src = fetch "lld" "1ah75rjly6747jk1zbwca3z0svr9b09ylgxd4x9ns721xir6sia6"; patches = [ ./gnu-install-dirs.patch ]; nativeBuildInputs = [ cmake ]; buildInputs = [ libllvm ]; cmakeFlags = [ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" ]; outputs = [ "out" "lib" "dev" ]; meta = { description = "The LLVM Linker"; homepage = "https://lld.llvm.org/"; license = lib.licenses.ncsa; platforms = lib.platforms.all; badPlatforms = [ "x86_64-darwin" ]; }; }