llvmPackages_15: apply #211230 to llvmPackages_15
See the comments here for context: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r1089389188 Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
This commit is contained in:
co-authored by
Weijia Wang
parent
3b6d98d2b0
commit
4fabcf4945
@@ -114,7 +114,7 @@ let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.libcxxabi
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -154,7 +154,7 @@ let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.libcxxabi
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -167,7 +167,7 @@ let
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, python3, fixDarwinDylibNames, version
|
||||
, libcxxabi
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
@@ -16,6 +17,8 @@ let
|
||||
basename = "libcxx";
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
@@ -59,12 +62,18 @@ stdenv.mkDerivation rec {
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
|
||||
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 "system-libcxxabi"}"
|
||||
] ++ lib.optional (!headersOnly) "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${libcxxabi.dev}/include/c++/v1"
|
||||
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
|
||||
] ++ 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 [
|
||||
@@ -78,6 +87,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -83,6 +83,10 @@ stdenv.mkDerivation rec {
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
|
||||
Reference in New Issue
Block a user