about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/git/libcxxabi/default.nix')
-rw-r--r--pkgs/development/compilers/llvm/git/libcxxabi/default.nix51
1 files changed, 28 insertions, 23 deletions
diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
index d64708ab040a..8d8b4aa778fd 100644
--- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix
@@ -18,9 +18,11 @@ stdenv.mkDerivation rec {
     cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
     mkdir -p "$out/llvm"
     cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
+    cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
+    cp -r ${monorepoSrc}/runtimes "$out"
   '';
 
-  sourceRoot = "${src.name}/${pname}";
+  sourceRoot = "${src.name}/runtimes";
 
   outputs = [ "out" "dev" ];
 
@@ -30,14 +32,25 @@ stdenv.mkDerivation rec {
     patch -p1 -d llvm -i ${./wasm.patch}
   '';
 
+  prePatch = ''
+    cd ../${pname}
+    chmod -R u+w .
+  '';
+
   patches = [
     ./gnu-install-dirs.patch
+    ./skip-other-project-tests.patch
   ];
 
+  postPatch = ''
+    cd ../runtimes
+  '';
+
   nativeBuildInputs = [ cmake python3 ];
   buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
 
   cmakeFlags = [
+    "-DLLVM_ENABLE_RUNTIMES=libcxxabi"
     "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
   ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
     "-DLLVM_ENABLE_LIBCXX=ON"
@@ -49,28 +62,20 @@ stdenv.mkDerivation rec {
     "-DLIBCXXABI_ENABLE_SHARED=OFF"
   ];
 
-  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
-    '';
+  preInstall = lib.optionalString stdenv.isDarwin ''
+    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
+  '';
+
+  postInstall = ''
+    mkdir -p "$dev/include"
+    install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
+  '';
 
   meta = llvm_meta // {
     homepage = "https://libcxxabi.llvm.org/";