diff options
author | Michael Weiss <dev.primeos@gmail.com> | 2021-04-15 16:25:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-15 16:25:17 +0200 |
commit | 978fa19ae2541c98e7ca34b5e882149a1cc9d275 (patch) | |
tree | 390a8c077321f3a8e31faa61796884ac666f6210 /pkgs/development/compilers/llvm/12/libc++abi/default.nix | |
parent | f21304cfa5913a9e117c4a531fd05f55e19564b3 (diff) | |
parent | 781e69d19c45c9acb1c3dc4b5bd2f981b78895cf (diff) |
Merge pull request #119528 from sternenseemann/llvmPackages_12-reorganize-files
llvmPackages_12: reorganize files
Diffstat (limited to 'pkgs/development/compilers/llvm/12/libc++abi/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/12/libc++abi/default.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/compilers/llvm/12/libc++abi/default.nix b/pkgs/development/compilers/llvm/12/libc++abi/default.nix new file mode 100644 index 0000000000000..c5e9aa954b3bb --- /dev/null +++ b/pkgs/development/compilers/llvm/12/libc++abi/default.nix @@ -0,0 +1,67 @@ +{ lib, stdenv, cmake, python3, fetch, libcxx, libunwind, llvm, version +, enableShared ? !stdenv.hostPlatform.isStatic +}: + +stdenv.mkDerivation { + pname = "libc++abi"; + inherit version; + + src = fetch "libcxxabi" "0mjj4f63ix4j1b72bgzpcki7mzf3qszrq7snqhiq0c5s73skkwx0"; + + nativeBuildInputs = [ cmake python3 ]; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + + cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + "-DLLVM_ENABLE_LIBCXX=ON" + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" + ] ++ lib.optionals stdenv.hostPlatform.isWasm [ + "-DLIBCXXABI_ENABLE_THREADS=OFF" + "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" + ] ++ lib.optionals (!enableShared) [ + "-DLIBCXXABI_ENABLE_SHARED=OFF" + ]; + + postUnpack = '' + unpackFile ${libcxx.src} + mv libcxx-* libcxx + unpackFile ${llvm.src} + mv llvm-* llvm + '' + lib.optionalString stdenv.isDarwin '' + export TRIPLE=x86_64-apple-darwin + '' + lib.optionalString stdenv.hostPlatform.isMusl '' + patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch} + '' + lib.optionalString stdenv.hostPlatform.isWasm '' + patch -p1 -d llvm -i ${./libcxxabi-wasm.patch} + ''; + + installPhase = if stdenv.isDarwin + then '' + for file in lib/*.dylib; do + # this should be done in CMake, but having trouble figuring out + # the magic combination of necessary CMake variables + # if you fancy a try, take a look at + # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling + install_name_tool -id $out/$file $file + done + make install + install -d 755 $out/include + install -m 644 ../include/*.h $out/include + '' + else '' + install -d -m 755 $out/include $out/lib + install -m 644 lib/libc++abi.a $out/lib + install -m 644 ../include/cxxabi.h $out/include + '' + lib.optionalString enableShared '' + install -m 644 lib/libc++abi.so.1.0 $out/lib + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so + ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1 + ''; + + meta = { + homepage = "https://libcxxabi.llvm.org/"; + description = "A new implementation of low level support for a standard C++ library"; + license = with lib.licenses; [ ncsa mit ]; + maintainers = with lib.maintainers; [ vlstill ]; + platforms = lib.platforms.all; + }; +} |