1 { lib, stdenv, fetch, fetchpatch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
2 , enableShared ? !stdenv.hostPlatform.isStatic
9 src = fetch "libcxx" "1rgqsqpgi0vkga5d7hy0iyfsqgzfz7q1xy7afdfa1snp1qjks8xv";
12 unpackFile ${libcxxabi.src}
13 mv libcxxabi-* libcxxabi
14 unpackFile ${llvm.src}
20 # Backported from LLVM 12, avoids clashes with commonly used "block.h" header.
21 url = "https://github.com/llvm/llvm-project/commit/19bc9ea480b60b607a3e303f20c7a3a2ea553369.patch";
22 sha256 = "sha256-aWa66ogmPkG0xHzSfcpD0qZyZQcNKwLV44js4eiun78=";
25 ] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
27 preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
28 patchShebangs utils/cat_files.py
31 nativeBuildInputs = [ cmake python3 ]
32 ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
34 buildInputs = [ libcxxabi ];
37 "-DLIBCXX_CXX_ABI=libcxxabi"
38 ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
39 ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
40 ++ lib.optional stdenv.hostPlatform.isWasm [
41 "-DLIBCXX_ENABLE_THREADS=OFF"
42 "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
43 "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
44 ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
51 homepage = "https://libcxx.llvm.org/";
52 description = "A new implementation of the C++ standard library, targeting C++11";
53 license = with lib.licenses; [ ncsa mit ];
54 platforms = lib.platforms.all;