nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 70 lines 2.6 kB view raw
1{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version }: 2 3stdenv.mkDerivation { 4 pname = "libcxxabi"; 5 inherit version; 6 7 src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv"; 8 9 outputs = [ "out" "dev" ]; 10 11 postUnpack = '' 12 unpackFile ${libcxx.src} 13 unpackFile ${llvm.src} 14 export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)" 15 '' + lib.optionalString stdenv.isDarwin '' 16 export TRIPLE=x86_64-apple-darwin 17 '' + lib.optionalString stdenv.hostPlatform.isMusl '' 18 patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch} 19 ''; 20 21 patches = [ 22 ./gnu-install-dirs.patch 23 ]; 24 25 nativeBuildInputs = [ cmake ]; 26 buildInputs = lib.optional (!stdenv.isDarwin) libunwind; 27 28 preInstall = lib.optionalString stdenv.isDarwin '' 29 for file in lib/*.dylib; do 30 if [ -L "$file" ]; then continue; fi 31 32 # Fix up the install name. Preserve the basename, just replace the path. 33 installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))" 34 35 # this should be done in CMake, but having trouble figuring out 36 # the magic combination of necessary CMake variables 37 # if you fancy a try, take a look at 38 # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling 39 ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file 40 41 # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes 42 # libcxxabi to sometimes link against a different version of itself. 43 # Here we simply make that second reference point to ourselves. 44 for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do 45 ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file 46 done 47 done 48 ''; 49 50 postInstall = '' 51 mkdir -p "$dev/include" 52 install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include" 53 ''; 54 55 passthru = { 56 libName = "c++abi"; 57 }; 58 59 meta = llvm_meta // { 60 homepage = "https://libcxxabi.llvm.org/"; 61 description = "Provides C++ standard library support"; 62 longDescription = '' 63 libc++abi is a new implementation of low level support for a standard C++ library. 64 ''; 65 # "All of the code in libc++abi is dual licensed under the MIT license and 66 # the UIUC License (a BSD-like license)": 67 license = with lib.licenses; [ mit ncsa ]; 68 maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ]; 69 }; 70}