at 23.11-beta 57 lines 1.6 kB view raw
1{ lib, stdenv, llvm_meta 2, buildLlvmTools 3, monorepoSrc, runCommand 4, cmake 5, ninja 6, libxml2 7, libllvm 8, version 9}: 10 11stdenv.mkDerivation rec { 12 pname = "lld"; 13 inherit version; 14 15 # Blank llvm dir just so relative path works 16 src = runCommand "${pname}-src-${version}" {} '' 17 mkdir -p "$out" 18 cp -r ${monorepoSrc}/cmake "$out" 19 cp -r ${monorepoSrc}/${pname} "$out" 20 mkdir -p "$out/libunwind" 21 cp -r ${monorepoSrc}/libunwind/include "$out/libunwind" 22 mkdir -p "$out/llvm" 23 ''; 24 25 sourceRoot = "${src.name}/${pname}"; 26 27 patches = [ 28 ./gnu-install-dirs.patch 29 ]; 30 31 nativeBuildInputs = [ cmake ninja ]; 32 buildInputs = [ libllvm libxml2 ]; 33 34 cmakeFlags = [ 35 "-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld" 36 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 37 "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" 38 ]; 39 40 # Musl's default stack size is too small for lld to be able to link Firefox. 41 LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152"; 42 43 outputs = [ "out" "lib" "dev" ]; 44 45 meta = llvm_meta // { 46 homepage = "https://lld.llvm.org/"; 47 description = "The LLVM linker (unwrapped)"; 48 longDescription = '' 49 LLD is a linker from the LLVM project that is a drop-in replacement for 50 system linkers and runs much faster than them. It also provides features 51 that are useful for toolchain developers. 52 The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and 53 WebAssembly in descending order of completeness. Internally, LLD consists 54 of several different linkers. 55 ''; 56 }; 57}