Skip to content

Commit

Permalink
llvmPackages_git: apply #211230 to llvmPackages_git
Browse files Browse the repository at this point in the history
See the comments here for context: #194634 (comment)

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
  • Loading branch information
2 people authored and RaitoBezarius committed Mar 26, 2023
1 parent 6adac38 commit 2f0ae7f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkgs/development/compilers/llvm/git/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
basename = "libcxx";
in

assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";

stdenv.mkDerivation rec {
pname = basename + lib.optionalString headersOnly "-headers";
Expand Down Expand Up @@ -64,10 +64,16 @@ stdenv.mkDerivation rec {

buildInputs = lib.optionals (!headersOnly) [ cxxabi ];

cmakeFlags = [
cmakeFlags = let
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
libcxx_cxx_abi_opt = {
"c++abi" = "system-libcxxabi";
"cxxrt" = "libcxxrt";
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
in [
"-DLLVM_ENABLE_RUNTIMES=libcxx"
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
] ++ lib.optional (!headersOnly && cxxabi.pname == "libcxxabi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optionals stdenv.hostPlatform.isWasm [
Expand Down

0 comments on commit 2f0ae7f

Please sign in to comment.