diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2024-04-12 22:55:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 22:55:30 +0200 |
commit | ded11d6ffe086cddf31c7e17a70e26bb77e8797a (patch) | |
tree | 90acbde62641ac2c71e953d539dcc1bdb879da8b /pkgs/development/compilers/llvm | |
parent | da09de0e5f162ba00cbc60cb4938b740fd509531 (diff) | |
parent | ae92b08fd4369c0017cfb0df1890804d6324e20f (diff) |
Merge pull request #303447 from ExpidusOS/feat/llvm-git-commonify-libunwind
llvmPackages_{12,13,14,15,16,17,18,git}: use common libunwind
Diffstat (limited to 'pkgs/development/compilers/llvm')
17 files changed, 111 insertions, 431 deletions
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index d9b1b7bb83f50..d35d463f0bb65 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -259,9 +259,12 @@ let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + src = fetch "libunwind" "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb"; + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; - inherit (buildLlvmTools) llvm; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/12/libunwind/default.nix b/pkgs/development/compilers/llvm/12/libunwind/default.nix deleted file mode 100644 index 95e0962b46891..0000000000000 --- a/pkgs/development/compilers/llvm/12/libunwind/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib, stdenv, llvm_meta, version, fetch, libcxx, llvm, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - src = fetch pname "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb"; - - postUnpack = '' - ln -s ${libcxx.src}/libcxx . - ln -s ${libcxx.src}/llvm . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 48bd8fc3c3f19..2f314e67bf906 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -297,7 +297,10 @@ in let monorepoSrc = src; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/13/libunwind/default.nix b/pkgs/development/compilers/llvm/13/libunwind/default.nix deleted file mode 100644 index d837bc60de370..0000000000000 --- a/pkgs/development/compilers/llvm/13/libunwind/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, stdenv, llvm_meta, version, src, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - inherit src; - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index be67dd588a194..158cd60c03d2e 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -294,7 +294,10 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix deleted file mode 100644 index c6d9eda5e4749..0000000000000 --- a/pkgs/development/compilers/llvm/14/libunwind/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - ''; - - sourceRoot = "${src.name}/${pname}"; - - patches = [ - ./gnu-install-dirs.patch - ]; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ]; - - cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index 07b18c97c75c3..3c4d656a8f322 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -312,7 +312,10 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/15/libunwind/default.nix b/pkgs/development/compilers/llvm/15/libunwind/default.nix deleted file mode 100644 index 1b677a7a2c0d7..0000000000000 --- a/pkgs/development/compilers/llvm/15/libunwind/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix index 0d5d7365ea061..2028b48bd0803 100644 --- a/pkgs/development/compilers/llvm/16/default.nix +++ b/pkgs/development/compilers/llvm/16/default.nix @@ -327,7 +327,10 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { + patches = [ + ./libunwind/gnu-install-dirs.patch + ]; inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/16/libunwind/default.nix b/pkgs/development/compilers/llvm/16/libunwind/default.nix deleted file mode 100644 index 1b677a7a2c0d7..0000000000000 --- a/pkgs/development/compilers/llvm/16/libunwind/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/17/default.nix b/pkgs/development/compilers/llvm/17/default.nix index f004a1a0bc741..42888dcc951af 100644 --- a/pkgs/development/compilers/llvm/17/default.nix +++ b/pkgs/development/compilers/llvm/17/default.nix @@ -312,7 +312,7 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/17/libunwind/default.nix b/pkgs/development/compilers/llvm/17/libunwind/default.nix deleted file mode 100644 index a3c8e2594f5a7..0000000000000 --- a/pkgs/development/compilers/llvm/17/libunwind/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - prePatch = '' - cd ../${pname} - chmod -R u+w . - ''; - - postPatch = '' - cd ../runtimes - ''; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/18/default.nix b/pkgs/development/compilers/llvm/18/default.nix index 63667a513e4c4..f34d4f58a02a5 100644 --- a/pkgs/development/compilers/llvm/18/default.nix +++ b/pkgs/development/compilers/llvm/18/default.nix @@ -312,7 +312,7 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/18/libunwind/default.nix b/pkgs/development/compilers/llvm/18/libunwind/default.nix deleted file mode 100644 index e67823ffb85c2..0000000000000 --- a/pkgs/development/compilers/llvm/18/libunwind/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} diff --git a/pkgs/development/compilers/llvm/common/libunwind/default.nix b/pkgs/development/compilers/llvm/common/libunwind/default.nix new file mode 100644 index 0000000000000..515914e6acb64 --- /dev/null +++ b/pkgs/development/compilers/llvm/common/libunwind/default.nix @@ -0,0 +1,87 @@ +{ lib +, stdenv +, release_version +, patches ? [] +, src ? null +, llvm_meta +, version +, monorepoSrc ? null +, runCommand +, cmake +, ninja +, python3 +, libcxx +, enableShared ? !stdenv.hostPlatform.isStatic +}: +let + pname = "libunwind"; + src' = if monorepoSrc != null then + runCommand "${pname}-src-${version}" {} ('' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + mkdir -p "$out/libcxx" + cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" + cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" + mkdir -p "$out/llvm" + cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" + '' + lib.optionalString (lib.versionAtLeast release_version "15") '' + cp -r ${monorepoSrc}/llvm/utils "$out/llvm" + cp -r ${monorepoSrc}/runtimes "$out" + '') else src; + + hasPatches = builtins.length patches > 0; + + postUnpack = lib.optionalString (lib.versions.major release_version == "12") '' + ln -s ${libcxx.src}/libcxx . + ln -s ${libcxx.src}/llvm . + ''; + + prePatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' + cd ../${pname} + chmod -R u+w . + ''; + + postPatch = lib.optionalString (lib.versionAtLeast release_version "15" && (hasPatches || lib.versionOlder release_version "18")) '' + cd ../runtimes + ''; + + postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' + # libcxxabi wants to link to libunwind_shared.so (?). + ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so + ''; +in +stdenv.mkDerivation (rec { + inherit pname version patches; + + src = src'; + + sourceRoot = + if lib.versionOlder release_version "13" then null + else if lib.versionAtLeast release_version "15" then "${src.name}/runtimes" + else "${src.name}/${pname}"; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ cmake ] ++ lib.optionals (lib.versionAtLeast release_version "15") [ + ninja python3 + ]; + + cmakeFlags = lib.optional (lib.versionAtLeast release_version "15") "-DLLVM_ENABLE_RUNTIMES=libunwind" + ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; + + meta = llvm_meta // { + # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst + homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; + description = "LLVM's unwinder library"; + longDescription = '' + The unwind library provides a family of _Unwind_* functions implementing + the language-neutral stack unwinding portion of the Itanium C++ ABI (Level + I). It is a dependency of the C++ ABI library, and sometimes is a + dependency of other runtimes. + ''; + }; +} // (if postUnpack != "" then { inherit postUnpack; } else {}) + // (if (lib.versionAtLeast release_version "15") then { inherit postInstall; } else {}) + // (if prePatch != "" then { inherit prePatch; } else {}) + // (if postPatch != "" then { inherit postPatch; } else {})) diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 3122f2e73d70a..cbb380260dee9 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -317,7 +317,7 @@ in let stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; - libunwind = callPackage ./libunwind { + libunwind = callPackage ../common/libunwind { inherit llvm_meta; stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; }; diff --git a/pkgs/development/compilers/llvm/git/libunwind/default.nix b/pkgs/development/compilers/llvm/git/libunwind/default.nix deleted file mode 100644 index e67823ffb85c2..0000000000000 --- a/pkgs/development/compilers/llvm/git/libunwind/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib, stdenv, llvm_meta, version -, monorepoSrc, runCommand -, cmake -, ninja -, python3 -, enableShared ? !stdenv.hostPlatform.isStatic -}: - -stdenv.mkDerivation rec { - pname = "libunwind"; - inherit version; - - # I am not so comfortable giving libc++ and friends the whole monorepo as - # requested, so I filter it to what is needed. - src = runCommand "${pname}-src-${version}" {} '' - mkdir -p "$out" - cp -r ${monorepoSrc}/cmake "$out" - cp -r ${monorepoSrc}/${pname} "$out" - mkdir -p "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx" - cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx" - mkdir -p "$out/llvm" - cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" - cp -r ${monorepoSrc}/llvm/utils "$out/llvm" - cp -r ${monorepoSrc}/runtimes "$out" - ''; - - sourceRoot = "${src.name}/runtimes"; - - postInstall = lib.optionalString (enableShared && !stdenv.hostPlatform.isDarwin) '' - # libcxxabi wants to link to libunwind_shared.so (?). - ln -s $out/lib/libunwind.so $out/lib/libunwind_shared.so - ''; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ cmake ninja python3 ]; - - cmakeFlags = [ - "-DLLVM_ENABLE_RUNTIMES=libunwind" - ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; - - meta = llvm_meta // { - # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst - homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library"; - description = "LLVM's unwinder library"; - longDescription = '' - The unwind library provides a family of _Unwind_* functions implementing - the language-neutral stack unwinding portion of the Itanium C++ ABI (Level - I). It is a dependency of the C++ ABI library, and sometimes is a - dependency of other runtimes. - ''; - }; -} |