llvmPackages_16.libcxxabi: fix wasi32 build

This commit is contained in:
Randy Eckenrode 2023-10-27 18:20:51 -04:00
parent 485ae91fbf
commit 9b77925762
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
postUnpack = lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
'';
prePatch = ''
@ -65,7 +63,7 @@ stdenv.mkDerivation rec {
# CMake however checks for this anyways; this flag tells it not to. See:
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
@ -74,8 +72,11 @@ stdenv.mkDerivation rec {
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];