This reflects upstream versioning change, and allows us to replace 4.0 with 4.1 (which is now a minor revision) without changing the attribute name. Thanks to @vcunat for the idea.
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ lib, stdenv, fetch, cmake, llvm, libcxxabi, fixDarwinDylibNames, version }:
 | 
						|
 | 
						|
stdenv.mkDerivation rec {
 | 
						|
  name = "libc++-${version}";
 | 
						|
 | 
						|
  src = fetch "libcxx" "15l6bcmwczspbqcq4m2lmzb23g11axr9m8dayn25iys26nn00q43";
 | 
						|
 | 
						|
  postUnpack = ''
 | 
						|
    unpackFile ${libcxxabi.src}
 | 
						|
    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
 | 
						|
  '';
 | 
						|
 | 
						|
  preConfigure = ''
 | 
						|
    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
 | 
						|
    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
 | 
						|
  '';
 | 
						|
 | 
						|
  patchPhase = ''
 | 
						|
    substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
 | 
						|
  '';
 | 
						|
 | 
						|
  buildInputs = [ cmake llvm libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 | 
						|
 | 
						|
  cmakeFlags = [
 | 
						|
      "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
 | 
						|
      "-DLIBCXX_LIBCPPABI_VERSION=2"
 | 
						|
      "-DLIBCXX_CXX_ABI=libcxxabi"
 | 
						|
    ];
 | 
						|
 | 
						|
  enableParallelBuilding = true;
 | 
						|
 | 
						|
  linkCxxAbi = stdenv.isLinux;
 | 
						|
 | 
						|
  setupHook = ./setup-hook.sh;
 | 
						|
 | 
						|
  meta = {
 | 
						|
    homepage = http://libcxx.llvm.org/;
 | 
						|
    description = "A new implementation of the C++ standard library, targeting C++11";
 | 
						|
    license = with stdenv.lib.licenses; [ ncsa mit ];
 | 
						|
    platforms = stdenv.lib.platforms.unix;
 | 
						|
  };
 | 
						|
}
 |