llvmPackages_{12,13,14,15,16,17,18,19,20,git}.lld: nixfmt
This commit is contained in:
committed by
Alyssa Ross
parent
436e809489
commit
80f5345be0
@@ -1,19 +1,20 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, llvm_meta
|
||||
, release_version
|
||||
, buildLlvmTools
|
||||
, monorepoSrc ? null
|
||||
, src ? null
|
||||
, runCommand
|
||||
, cmake
|
||||
, ninja
|
||||
, libxml2
|
||||
, libllvm
|
||||
, version
|
||||
, devExtraCmakeFlags ? []
|
||||
, getVersionFile
|
||||
, fetchpatch
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
llvm_meta,
|
||||
release_version,
|
||||
buildLlvmTools,
|
||||
monorepoSrc ? null,
|
||||
src ? null,
|
||||
runCommand,
|
||||
cmake,
|
||||
ninja,
|
||||
libxml2,
|
||||
libllvm,
|
||||
version,
|
||||
devExtraCmakeFlags ? [ ],
|
||||
getVersionFile,
|
||||
fetchpatch,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "lld";
|
||||
@@ -21,16 +22,22 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
src =
|
||||
if monorepoSrc != null then
|
||||
runCommand "lld-src-${version}" { inherit (monorepoSrc) passthru; } (''
|
||||
mkdir -p "$out"
|
||||
'' + lib.optionalString (lib.versionAtLeast release_version "14") ''
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
'' + ''
|
||||
cp -r ${monorepoSrc}/lld "$out"
|
||||
mkdir -p "$out/libunwind"
|
||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
||||
mkdir -p "$out/llvm"
|
||||
'') else src;
|
||||
runCommand "lld-src-${version}" { inherit (monorepoSrc) passthru; } (
|
||||
''
|
||||
mkdir -p "$out"
|
||||
''
|
||||
+ lib.optionalString (lib.versionAtLeast release_version "14") ''
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
''
|
||||
+ ''
|
||||
cp -r ${monorepoSrc}/lld "$out"
|
||||
mkdir -p "$out/libunwind"
|
||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
||||
mkdir -p "$out/llvm"
|
||||
''
|
||||
)
|
||||
else
|
||||
src;
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/lld";
|
||||
|
||||
@@ -39,9 +46,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
++ lib.optional (lib.versions.major release_version == "14") (
|
||||
getVersionFile "lld/fix-root-src-dir.patch"
|
||||
)
|
||||
++ lib.optional (
|
||||
lib.versionAtLeast release_version "16" && lib.versionOlder release_version "18"
|
||||
) (getVersionFile "lld/add-table-base.patch")
|
||||
++ lib.optional (lib.versionAtLeast release_version "16" && lib.versionOlder release_version "18") (
|
||||
getVersionFile "lld/add-table-base.patch"
|
||||
)
|
||||
++ lib.optional (lib.versions.major release_version == "18") (
|
||||
# https://github.com/llvm/llvm-project/pull/97122
|
||||
fetchpatch {
|
||||
@@ -53,15 +60,24 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
);
|
||||
|
||||
nativeBuildInputs = [ cmake ] ++ lib.optional (lib.versionAtLeast release_version "15") ninja;
|
||||
buildInputs = [ libllvm libxml2 ];
|
||||
buildInputs = [
|
||||
libllvm
|
||||
libxml2
|
||||
];
|
||||
|
||||
cmakeFlags = lib.optionals (lib.versionOlder release_version "14") [
|
||||
(lib.cmakeFeature "LLVM_CONFIG_PATH" "${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}")
|
||||
] ++ lib.optionals (lib.versionAtLeast release_version "15") [
|
||||
(lib.cmakeFeature "LLD_INSTALL_PACKAGE_DIR" "${placeholder "dev"}/lib/cmake/lld")
|
||||
] ++ [
|
||||
(lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.tblgen}/bin/llvm-tblgen")
|
||||
] ++ devExtraCmakeFlags;
|
||||
cmakeFlags =
|
||||
lib.optionals (lib.versionOlder release_version "14") [
|
||||
(lib.cmakeFeature "LLVM_CONFIG_PATH" "${libllvm.dev}/bin/llvm-config${
|
||||
lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"
|
||||
}")
|
||||
]
|
||||
++ lib.optionals (lib.versionAtLeast release_version "15") [
|
||||
(lib.cmakeFeature "LLD_INSTALL_PACKAGE_DIR" "${placeholder "dev"}/lib/cmake/lld")
|
||||
]
|
||||
++ [
|
||||
(lib.cmakeFeature "LLVM_TABLEGEN_EXE" "${buildLlvmTools.tblgen}/bin/llvm-tblgen")
|
||||
]
|
||||
++ devExtraCmakeFlags;
|
||||
|
||||
postPatch = lib.optionalString (lib.versionOlder release_version "14") ''
|
||||
substituteInPlace MachO/CMakeLists.txt --replace-fail \
|
||||
@@ -71,7 +87,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# Musl's default stack size is too small for lld to be able to link Firefox.
|
||||
LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
|
||||
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"lib"
|
||||
"dev"
|
||||
];
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://lld.llvm.org/";
|
||||
|
||||
Reference in New Issue
Block a user