llvmPackages: use libcxxrt on FreeBSD

FreeBSD doesn't use LLVM's cxxabi implementation, for backwards
compatibility reasons.  Software expects the libcxxrt API when
building on FreeBSD.  This fixes the build of
pkgsCross.x86_64-freebsd.boost.
This commit is contained in:
Alyssa Ross 2023-01-13 20:03:29 +00:00
parent c672de3080
commit 2ae30c9f45
36 changed files with 179 additions and 76 deletions

View File

@ -372,11 +372,11 @@ stdenv.mkDerivation {
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
done
''
+ optionalString (libcxx.isLLVM or false) (''
+ optionalString (libcxx.isLLVM or false) ''
echo "-isystem ${lib.getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
'')
echo "-l${libcxx.cxxabi.libName}" >> $out/nix-support/libcxx-ldflags
''
##
## Initial CFLAGS

View File

@ -110,7 +110,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
@ -147,7 +147,7 @@ let
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -37,13 +41,13 @@ stdenv.mkDerivation {
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXX_ENABLE_THREADS=OFF"
@ -60,13 +64,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -67,6 +67,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -125,7 +125,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
@ -162,7 +162,7 @@ let
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, fetchpatch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, fetchpatch, cmake, python3, llvm, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -42,10 +46,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ 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 [
@ -76,13 +80,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -71,6 +71,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -113,7 +113,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

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, llvm, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -30,10 +34,10 @@ stdenv.mkDerivation {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ 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 [
@ -51,13 +55,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -69,6 +69,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -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

View File

@ -1,5 +1,6 @@
{ lib, stdenv, llvm_meta, src, 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.
@ -10,6 +11,8 @@
, headersOnly ? false
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation rec {
pname = if headersOnly then "cxx-headers" else "libcxx";
inherit version;
@ -32,9 +35,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
buildInputs = lib.optionals (!headersOnly) [ cxxabi ];
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
cmakeFlags = [ "-DLIBCXX_CXX_ABI=${cxxabi.pname}" ]
++ 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 [
@ -55,7 +58,7 @@ stdenv.mkDerivation rec {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
@ -71,6 +74,7 @@ stdenv.mkDerivation rec {
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -66,6 +66,10 @@ stdenv.mkDerivation rec {
install -m 644 ../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";

View File

@ -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

View File

@ -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.pname == "libcxxabi";
stdenv.mkDerivation rec {
pname = basename + lib.optionalString headersOnly "-headers";
inherit version;
@ -48,9 +51,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
buildInputs = lib.optionals (!headersOnly) [ cxxabi ];
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
cmakeFlags = [ "-DLIBCXX_CXX_ABI=${cxxabi.pname}" ]
++ 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 [
@ -71,13 +74,14 @@ stdenv.mkDerivation rec {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -85,6 +85,10 @@ stdenv.mkDerivation rec {
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
'';
passthru = {
libName = "c++abi";
};
meta = llvm_meta // {
homepage = "https://libcxxabi.llvm.org/";
description = "Provides C++ standard library support";

View File

@ -86,7 +86,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;

View File

@ -1,4 +1,9 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version }:
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
@ -33,13 +38,13 @@ stdenv.mkDerivation {
++ lib.optional stdenv.hostPlatform.isMusl python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib";
preInstall = lib.optionalString (stdenv.isDarwin) ''
for file in lib/*.dylib; do
@ -50,13 +55,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -52,6 +52,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -87,7 +87,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;

View File

@ -1,4 +1,9 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version }:
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
@ -39,13 +44,13 @@ stdenv.mkDerivation {
++ lib.optional stdenv.hostPlatform.isMusl python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib";
preInstall = lib.optionalString (stdenv.isDarwin) ''
for file in lib/*.dylib; do
@ -56,13 +61,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -52,6 +52,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -117,7 +117,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

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -42,13 +46,13 @@ stdenv.mkDerivation {
++ lib.optional stdenv.hostPlatform.isMusl python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" ;
@ -61,13 +65,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -71,6 +71,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -118,7 +118,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
@ -155,7 +155,7 @@ let
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -41,13 +45,13 @@ stdenv.mkDerivation {
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXX_ENABLE_THREADS=OFF"
@ -64,13 +68,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -67,6 +67,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -118,7 +118,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
@ -155,7 +155,7 @@ let
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind

View File

@ -1,7 +1,11 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
@ -37,13 +41,13 @@ stdenv.mkDerivation {
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libcxxabi ];
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXX_ENABLE_THREADS=OFF"
@ -60,13 +64,14 @@ stdenv.mkDerivation {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -67,6 +67,10 @@ stdenv.mkDerivation {
install -m 644 ../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";

View File

@ -113,7 +113,7 @@ let
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
@ -153,7 +153,7 @@ let
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.libcxxabi
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind

View File

@ -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.pname == "libcxxabi";
stdenv.mkDerivation rec {
pname = basename + lib.optionalString headersOnly "-headers";
inherit version;
@ -59,12 +62,12 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
buildInputs = lib.optionals (!headersOnly) [ cxxabi ];
cmakeFlags = [
"-DLLVM_ENABLE_RUNTIMES=libcxx"
"-DLIBCXX_CXX_ABI=${lib.optionalString (!headersOnly) "system-"}libcxxabi"
] ++ lib.optional (!headersOnly) "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${libcxxabi.dev}/include/c++/v1"
"-DLIBCXX_CXX_ABI=${lib.optionalString (!headersOnly) "system-"}${cxxabi.pname}"
] ++ lib.optional (!headersOnly && cxxabi.pname == "libcxxabi") "-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 [
@ -85,13 +88,14 @@ stdenv.mkDerivation rec {
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${libcxxabi}/lib/$abiName $file
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {

View File

@ -95,6 +95,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";

View File

@ -20,6 +20,7 @@ stdenv.mkDerivation {
'';
passthru = {
libName = "cxxrt";
updateScript = unstableGitUpdater { };
};

View File

@ -339,6 +339,7 @@ rec {
'';
passthru = {
isLLVM = true;
cxxabi = self."${finalLlvmPackages}".libcxxabi;
};
};
@ -348,6 +349,9 @@ rec {
mkdir -p $out/lib
ln -s ${bootstrapTools}/lib/libc++abi.dylib $out/lib/libc++abi.dylib
'';
passthru = {
libName = "c++abi";
};
};
compiler-rt = stdenv.mkDerivation {