From 21df776a314b955d480bcd83dfbe0932f4aecf63 Mon Sep 17 00:00:00 2001 From: toonn Date: Tue, 23 Nov 2021 19:57:33 +0100 Subject: [PATCH] llvmPackages_13.libcxxabi: Align with 11 libcxxabi LLVM 11 libcxxabi has some flags to support usage in the Darwin stdenv, in particular, `standalone` and `withLibunwind`. Darwin stdenv needs the `standalone` flag because its `hostPlatform` set doesn't have `useLLVM` set to true. And it needs `withLibunwind` to explicitly disable including `libunwind` as a build input. We also prefix `install_name_tool` in case we're cross-compiling. --- .../compilers/llvm/13/libcxxabi/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 6267678c46d5..5ae92645c9c4 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -1,6 +1,7 @@ -{ lib, stdenv, llvm_meta, cmake, python3, src, libunwind, version +{ lib, stdenv, llvm_meta, cmake, python3, src, libunwind, libcxx, version , enableShared ? !stdenv.hostPlatform.isStatic -, libcxx +, standalone ? stdenv.hostPlatform.useLLVM or false +, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm }: stdenv.mkDerivation rec { @@ -23,12 +24,13 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional withLibunwind libunwind; cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${libcxx.dev}/include/c++/v1" - ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + ] ++ lib.optionals standalone [ "-DLLVM_ENABLE_LIBCXX=ON" + ] ++ lib.optionals (standalone && withLibunwind) [ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ "-DLIBCXXABI_ENABLE_THREADS=OFF"