llvmPackages_{12,13,14,15,16,17,18,git}: use common lld
This commit is contained in:
parent
ded11d6ffe
commit
1572ec6bb1
|
@ -115,7 +115,11 @@ let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
src = fetch "lld" "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9";
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
inherit (libraries) libunwind;
|
inherit (libraries) libunwind;
|
||||||
};
|
};
|
||||||
|
|
|
@ -140,7 +140,10 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, src
|
|
||||||
, cmake
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
inherit src;
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
# On Darwin the llvm-config is perhaps not working fine as the
|
|
||||||
# LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as the
|
|
||||||
# include path is not correct.
|
|
||||||
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
||||||
substituteInPlace MachO/CMakeLists.txt --replace \
|
|
||||||
'(''${LLVM_MAIN_SRC_DIR}/' '(../'
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
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"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -136,7 +136,11 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
./lld/fix-root-src-dir.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
# On Darwin the llvm-config is perhaps not working fine as the
|
|
||||||
# LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as
|
|
||||||
# the include path is not correct.
|
|
||||||
./fix-root-src-dir.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -141,7 +141,10 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -141,7 +141,11 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
./lld/add-table-base.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
./add-table-base.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -136,7 +136,11 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
./lld/add-table-base.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
./add-table-base.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -136,7 +136,10 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,35 +1,58 @@
|
||||||
{ lib, stdenv, llvm_meta
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, llvm_meta
|
||||||
|
, release_version
|
||||||
|
, patches ? []
|
||||||
, buildLlvmTools
|
, buildLlvmTools
|
||||||
, fetch
|
, monorepoSrc ? null
|
||||||
, libunwind
|
, src ? null
|
||||||
|
, libunwind ? null
|
||||||
|
, runCommand
|
||||||
, cmake
|
, cmake
|
||||||
|
, ninja
|
||||||
, libxml2
|
, libxml2
|
||||||
, libllvm
|
, libllvm
|
||||||
, version
|
, version
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
pname = "lld";
|
||||||
inherit version;
|
src' =
|
||||||
|
if monorepoSrc != null then
|
||||||
|
runCommand "lld-src-${version}" {} ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
cp -r ${monorepoSrc}/cmake "$out"
|
||||||
|
cp -r ${monorepoSrc}/${pname} "$out"
|
||||||
|
mkdir -p "$out/libunwind"
|
||||||
|
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
||||||
|
mkdir -p "$out/llvm"
|
||||||
|
'' else src;
|
||||||
|
|
||||||
src = fetch pname "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9";
|
postPatch = lib.optionalString (lib.versions.major release_version == "12") ''
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
substituteInPlace MachO/CMakeLists.txt --replace \
|
substituteInPlace MachO/CMakeLists.txt --replace \
|
||||||
'(''${LLVM_MAIN_SRC_DIR}/' '('
|
'(''${LLVM_MAIN_SRC_DIR}/' '('
|
||||||
mkdir -p libunwind/include
|
mkdir -p libunwind/include
|
||||||
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
|
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
|
||||||
|
'' + lib.optionalString (lib.versions.major release_version == "13" && stdenv.isDarwin) ''
|
||||||
|
substituteInPlace MachO/CMakeLists.txt --replace \
|
||||||
|
'(''${LLVM_MAIN_SRC_DIR}/' '(../'
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (rec {
|
||||||
|
inherit pname version patches;
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
src = src';
|
||||||
|
|
||||||
|
sourceRoot =
|
||||||
|
if lib.versionOlder release_version "13" then null
|
||||||
|
else "${src.name}/${pname}";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake ] ++ lib.optional (lib.versionAtLeast release_version "15") ninja;
|
||||||
buildInputs = [ libllvm libxml2 ];
|
buildInputs = [ libllvm libxml2 ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = lib.optionals (lib.versionOlder release_version "14") [
|
||||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||||
|
] ++ lib.optionals (lib.versionAtLeast release_version "15") [
|
||||||
|
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
||||||
];
|
];
|
||||||
|
@ -51,4 +74,4 @@ stdenv.mkDerivation rec {
|
||||||
of several different linkers.
|
of several different linkers.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
} // (if (postPatch == "" && lib.versions.major release_version != "13") then {} else { inherit postPatch; }))
|
|
@ -141,7 +141,10 @@ in let
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {
|
lld = callPackage ../common/lld {
|
||||||
|
patches = [
|
||||||
|
./lld/gnu-install-dirs.patch
|
||||||
|
];
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
{ lib, stdenv, llvm_meta
|
|
||||||
, buildLlvmTools
|
|
||||||
, monorepoSrc, runCommand
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, libxml2
|
|
||||||
, libllvm
|
|
||||||
, version
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "lld";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
# Blank llvm dir just so relative path works
|
|
||||||
src = runCommand "${pname}-src-${version}" {} ''
|
|
||||||
mkdir -p "$out"
|
|
||||||
cp -r ${monorepoSrc}/cmake "$out"
|
|
||||||
cp -r ${monorepoSrc}/${pname} "$out"
|
|
||||||
mkdir -p "$out/libunwind"
|
|
||||||
cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
|
|
||||||
mkdir -p "$out/llvm"
|
|
||||||
'';
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/${pname}";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
buildInputs = [ libllvm libxml2 ];
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./gnu-install-dirs.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
|
||||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
||||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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" ];
|
|
||||||
|
|
||||||
meta = llvm_meta // {
|
|
||||||
homepage = "https://lld.llvm.org/";
|
|
||||||
description = "The LLVM linker (unwrapped)";
|
|
||||||
longDescription = ''
|
|
||||||
LLD is a linker from the LLVM project that is a drop-in replacement for
|
|
||||||
system linkers and runs much faster than them. It also provides features
|
|
||||||
that are useful for toolchain developers.
|
|
||||||
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
|
||||||
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
||||||
of several different linkers.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user