2021-09-02 20:20:50 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-07-10 18:28:08 +01:00
|
|
|
, cmake
|
|
|
|
, libxml2
|
|
|
|
, llvm
|
|
|
|
|
|
|
|
, version
|
|
|
|
, src
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit version src;
|
|
|
|
|
|
|
|
pname = "lld";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2021-09-02 20:20:50 +01:00
|
|
|
buildInputs = [ libxml2 llvm ];
|
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 09:23:57 +01:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
2021-03-24 07:43:58 +00:00
|
|
|
|
2021-09-02 20:20:50 +01:00
|
|
|
cmakeFlags = [ "-DLLVM_MAIN_SRC_DIR=${llvm.src}" ];
|
|
|
|
|
2020-07-10 18:28:08 +01:00
|
|
|
postInstall = ''
|
|
|
|
moveToOutput include "$dev"
|
|
|
|
moveToOutput lib "$dev"
|
2020-11-03 06:29:45 +00:00
|
|
|
|
|
|
|
# Fix lld binary path for CMake.
|
|
|
|
substituteInPlace "$dev/lib/cmake/lld/LLDTargets-release.cmake" \
|
|
|
|
--replace "\''${_IMPORT_PREFIX}/bin/lld" "$out/bin/lld"
|
2020-07-10 18:28:08 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-07-10 18:28:08 +01:00
|
|
|
description = "ROCm fork of the LLVM Linker";
|
|
|
|
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
|
|
|
license = licenses.ncsa;
|
2021-09-12 15:42:12 +01:00
|
|
|
maintainers = with maintainers; [ acowley lovesegfault ];
|
2020-07-10 18:28:08 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|