nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 88 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 release_version, 5 src ? null, 6 llvm_meta, 7 version, 8 monorepoSrc ? null, 9 runCommand, 10 cmake, 11 ninja, 12 python3, 13 libcxx, 14 enableShared ? !stdenv.hostPlatform.isStatic, 15 doFakeLibgcc ? stdenv.hostPlatform.useLLVM && !stdenv.hostPlatform.isStatic, 16 devExtraCmakeFlags ? [ ], 17 getVersionFile, 18}: 19stdenv.mkDerivation (finalAttrs: { 20 pname = "libunwind"; 21 22 inherit version; 23 24 src = 25 if monorepoSrc != null then 26 runCommand "libunwind-src-${version}" { inherit (monorepoSrc) passthru; } '' 27 mkdir -p "$out" 28 cp -r ${monorepoSrc}/cmake "$out" 29 cp -r ${monorepoSrc}/libunwind "$out" 30 mkdir -p "$out/libcxx" 31 cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" 32 cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" 33 mkdir -p "$out/llvm" 34 cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" 35 cp -r ${monorepoSrc}/llvm/utils "$out/llvm" 36 cp -r ${monorepoSrc}/runtimes "$out" 37 '' 38 else 39 src; 40 41 sourceRoot = "${finalAttrs.src.name}/runtimes"; 42 43 outputs = [ 44 "out" 45 "dev" 46 ]; 47 48 nativeBuildInputs = [ 49 cmake 50 ninja 51 python3 52 ]; 53 54 cmakeFlags = [ 55 (lib.cmakeBool "LIBUNWIND_ENABLE_SHARED" enableShared) 56 (lib.cmakeFeature "LLVM_ENABLE_RUNTIMES" "libunwind") 57 ] 58 ++ devExtraCmakeFlags; 59 60 postInstall = 61 lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isWindows) 62 '' 63 # libcxxabi wants to link to libunwind_shared.so (?). 64 ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so 65 '' 66 + lib.optionalString (enableShared && stdenv.hostPlatform.isWindows) '' 67 ln -s $out/lib/libunwind.dll.a $out/lib/libunwind_shared.dll.a 68 '' 69 + lib.optionalString (doFakeLibgcc && !stdenv.hostPlatform.isWindows) '' 70 ln -s $out/lib/libunwind.so $out/lib/libgcc_s.so 71 ln -s $out/lib/libunwind.so $out/lib/libgcc_s.so.1 72 '' 73 + lib.optionalString (doFakeLibgcc && stdenv.hostPlatform.isWindows) '' 74 ln -s $out/lib/libunwind.dll.a $out/lib/libgcc_s.dll.a 75 ''; 76 77 meta = llvm_meta // { 78 # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst 79 homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; 80 description = "LLVM's unwinder library"; 81 longDescription = '' 82 The unwind library provides a family of _Unwind_* functions implementing 83 the language-neutral stack unwinding portion of the Itanium C++ ABI (Level 84 I). It is a dependency of the C++ ABI library, and sometimes is a 85 dependency of other runtimes. 86 ''; 87 }; 88})