nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 79 lines 2.6 kB view raw
1{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version 2, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi 3, libcxxabi, libcxxrt 4}: 5 6assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi"; 7 8stdenv.mkDerivation { 9 pname = "libcxx"; 10 inherit version; 11 12 src = fetch "libcxx" "1672aaf95fgy4xsfra8pw24f6r93zwzpan1033hkcm8p2glqipvf"; 13 14 postUnpack = '' 15 unpackFile ${libcxxabi.src} 16 export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" 17 ''; 18 19 outputs = [ "out" "dev" ]; 20 21 patches = [ 22 ./gnu-install-dirs.patch 23 ] ++ lib.optionals stdenv.hostPlatform.isMusl [ 24 ../../libcxx-0001-musl-hacks.patch 25 ]; 26 27 prePatch = '' 28 substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" 29 ''; 30 31 preConfigure = '' 32 # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package 33 cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR") 34 '' + lib.optionalString stdenv.hostPlatform.isMusl '' 35 patchShebangs utils/cat_files.py 36 ''; 37 nativeBuildInputs = [ cmake ] 38 ++ lib.optional stdenv.hostPlatform.isMusl python3 39 ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; 40 41 buildInputs = [ cxxabi ]; 42 43 cmakeFlags = [ 44 "-DLIBCXX_LIBCPPABI_VERSION=2" 45 "-DLIBCXX_CXX_ABI=${cxxabi.pname}" 46 ] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1" 47 ++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"; 48 49 preInstall = lib.optionalString (stdenv.isDarwin) '' 50 for file in lib/*.dylib; do 51 if [ -L "$file" ]; then continue; fi 52 53 baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1)) 54 installName="$out/lib/$baseName" 55 abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/') 56 57 for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do 58 ${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file 59 done 60 done 61 ''; 62 63 passthru = { 64 isLLVM = true; 65 inherit cxxabi; 66 }; 67 68 meta = llvm_meta // { 69 homepage = "https://libcxx.llvm.org/"; 70 description = "C++ standard library"; 71 longDescription = '' 72 libc++ is an implementation of the C++ standard library, targeting C++11, 73 C++14 and above. 74 ''; 75 # "All of the code in libc++ is dual licensed under the MIT license and the 76 # UIUC License (a BSD-like license)": 77 license = with lib.licenses; [ mit ncsa ]; 78 }; 79}