1{ lib, stdenv, fetch, cmake, libcxxabi, fixDarwinDylibNames, version }:
2
3stdenv.mkDerivation rec {
4 name = "libc++-${version}";
5
6 src = fetch "libcxx" "0i7iyzk024krda5spfpfi8jksh83yp3bxqkal0xp76ffi11bszrm";
7
8 postUnpack = ''
9 unpackFile ${libcxxabi.src}
10 '';
11
12 preConfigure = ''
13 # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
14 cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
15 '';
16
17 patches = [
18 ./darwin.patch
19 ./r242056.patch
20 # glibc 2.26 fix
21 ./xlocale-glibc-2.26.patch
22 ];
23
24 buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
25
26 cmakeFlags = [
27 "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
28 "-DLIBCXX_LIBCPPABI_VERSION=2"
29 "-DLIBCXX_CXX_ABI=libcxxabi"
30 ];
31
32 enableParallelBuilding = true;
33
34 linkCxxAbi = stdenv.isLinux;
35
36 setupHooks = [
37 ../../../../../build-support/setup-hooks/role.bash
38 ./setup-hook.sh
39 ];
40
41 meta = {
42 homepage = http://libcxx.llvm.org/;
43 description = "A new implementation of the C++ standard library, targeting C++11";
44 license = with stdenv.lib.licenses; [ ncsa mit ];
45 platforms = stdenv.lib.platforms.unix;
46 };
47}