at 18.09-beta 54 lines 1.9 kB view raw
1{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }: 2 3stdenv.mkDerivation rec { 4 name = "libc++-${version}"; 5 6 src = fetch "libcxx" "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"; 7 8 postUnpack = '' 9 unpackFile ${libcxxabi.src} 10 export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" 11 ''; 12 13 # on next rebuild, this can be replaced with optionals; for now set to null to avoid 14 # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ 15 patches = if stdenv.hostPlatform.isMusl then [ 16 ../../libcxx-0001-musl-hacks.patch 17 ] else null; 18 19 prePatch = '' 20 substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" 21 ''; 22 23 preConfigure = '' 24 # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package 25 cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") 26 '' + lib.optionalString stdenv.hostPlatform.isMusl '' 27 patchShebangs utils/cat_files.py 28 ''; 29 nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python; 30 31 buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; 32 33 cmakeFlags = [ 34 "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" 35 "-DLIBCXX_LIBCPPABI_VERSION=2" 36 "-DLIBCXX_CXX_ABI=libcxxabi" 37 ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"; 38 39 enableParallelBuilding = true; 40 41 linkCxxAbi = stdenv.isLinux; 42 43 setupHooks = [ 44 ../../../../../build-support/setup-hooks/role.bash 45 ./setup-hook.sh 46 ]; 47 48 meta = { 49 homepage = http://libcxx.llvm.org/; 50 description = "A new implementation of the C++ standard library, targeting C++11"; 51 license = with stdenv.lib.licenses; [ ncsa mit ]; 52 platforms = stdenv.lib.platforms.unix; 53 }; 54}