2021-04-15 18:41:38 +02:00
|
|
|
{ lib, stdenv, llvm_meta
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 10:23:57 +02:00
|
|
|
, buildLlvmTools
|
2021-04-01 11:27:57 +02:00
|
|
|
, fetch
|
2021-03-17 18:17:32 +01:00
|
|
|
, libunwind
|
2021-04-01 11:27:57 +02:00
|
|
|
, cmake
|
|
|
|
, libxml2
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 10:23:57 +02:00
|
|
|
, libllvm
|
2021-04-01 11:27:57 +02:00
|
|
|
, version
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lld";
|
|
|
|
inherit version;
|
|
|
|
|
2021-05-26 13:37:17 +02:00
|
|
|
src = fetch pname "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9";
|
2021-04-01 11:27:57 +02:00
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 10:23:57 +02:00
|
|
|
patches = [
|
|
|
|
./gnu-install-dirs.patch
|
|
|
|
];
|
|
|
|
|
2021-05-11 23:12:04 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace MachO/CMakeLists.txt --replace \
|
|
|
|
'(''${LLVM_MAIN_SRC_DIR}/' '('
|
|
|
|
mkdir -p libunwind/include
|
|
|
|
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
|
|
|
|
'';
|
|
|
|
|
2021-04-01 11:27:57 +02:00
|
|
|
nativeBuildInputs = [ cmake ];
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 10:23:57 +02:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" ];
|
2021-04-01 11:27:57 +02:00
|
|
|
|
2021-04-15 18:41:38 +02:00
|
|
|
meta = llvm_meta // {
|
|
|
|
homepage = "https://lld.llvm.org/";
|
|
|
|
description = "The LLVM linker";
|
|
|
|
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.
|
2021-05-11 23:12:04 +02:00
|
|
|
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
|
2021-04-15 18:41:38 +02:00
|
|
|
WebAssembly in descending order of completeness. Internally, LLD consists
|
|
|
|
of several different linkers.
|
|
|
|
'';
|
2021-04-01 11:27:57 +02:00
|
|
|
};
|
|
|
|
}
|