at 23.05-pre 61 lines 1.7 kB view raw
1{ lib, stdenv, llvm_meta, version 2, monorepoSrc, runCommand 3, cmake 4, python3 5, enableShared ? !stdenv.hostPlatform.isStatic 6}: 7 8stdenv.mkDerivation rec { 9 pname = "libunwind"; 10 inherit version; 11 12 # I am not so comfortable giving libc++ and friends the whole monorepo as 13 # requested, so I filter it to what is needed. 14 src = runCommand "${pname}-src-${version}" {} '' 15 mkdir -p "$out" 16 cp -r ${monorepoSrc}/cmake "$out" 17 cp -r ${monorepoSrc}/${pname} "$out" 18 mkdir -p "$out/libcxx" 19 cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" 20 cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" 21 mkdir -p "$out/llvm" 22 cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" 23 cp -r ${monorepoSrc}/llvm/utils "$out/llvm" 24 cp -r ${monorepoSrc}/runtimes "$out" 25 ''; 26 27 sourceRoot = "${src.name}/runtimes"; 28 29 prePatch = '' 30 cd ../${pname} 31 chmod -R u+w . 32 ''; 33 34 patches = [ 35 ./gnu-install-dirs.patch 36 ]; 37 38 postPatch = '' 39 cd ../runtimes 40 ''; 41 42 outputs = [ "out" "dev" ]; 43 44 nativeBuildInputs = [ cmake python3 ]; 45 46 cmakeFlags = [ 47 "-DLLVM_ENABLE_RUNTIMES=libunwind" 48 ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; 49 50 meta = llvm_meta // { 51 # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst 52 homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; 53 description = "LLVM's unwinder library"; 54 longDescription = '' 55 The unwind library provides a family of _Unwind_* functions implementing 56 the language-neutral stack unwinding portion of the Itanium C++ ABI (Level 57 I). It is a dependency of the C++ ABI library, and sometimes is a 58 dependency of other runtimes. 59 ''; 60 }; 61}