about summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/12
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/12')
-rw-r--r--pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch235
-rw-r--r--pkgs/development/compilers/llvm/12/clang/purity.patch28
-rw-r--r--pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch21
-rw-r--r--pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch32
-rw-r--r--pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch129
-rw-r--r--pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch16
-rw-r--r--pkgs/development/compilers/llvm/12/default.nix400
-rw-r--r--pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch34
-rw-r--r--pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch68
-rw-r--r--pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch110
-rw-r--r--pkgs/development/compilers/llvm/12/lldb/procfs.patch31
-rw-r--r--pkgs/development/compilers/llvm/12/lldb/resource-dir.patch13
-rw-r--r--pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch13
-rw-r--r--pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch105
-rw-r--r--pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch417
15 files changed, 0 insertions, 1652 deletions
diff --git a/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch
deleted file mode 100644
index b834d386b4eb..000000000000
--- a/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9e74014134a0..976e6a1757fd 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
- if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
-   project(Clang)
- 
-+  include(GNUInstallDirs)
-+
-   set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
-   set(CMAKE_CXX_STANDARD_REQUIRED YES)
-   set(CMAKE_CXX_EXTENSIONS NO)
-@@ -416,7 +418,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/clang include/clang-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT clang-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -425,7 +427,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT clang-headers
-     FILES_MATCHING
-     PATTERN "CMakeFiles" EXCLUDE
-@@ -445,7 +447,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
-   install(PROGRAMS utils/bash-autocomplete.sh
--          DESTINATION share/clang
-+          DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-           COMPONENT bash-autocomplete)
-   if(NOT LLVM_ENABLE_IDE)
-     add_llvm_install_targets(install-bash-autocomplete
-diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
-index 704278a0e93b..d25c8d325c71 100644
---- a/cmake/modules/AddClang.cmake
-+++ b/cmake/modules/AddClang.cmake
-@@ -123,9 +123,9 @@ macro(add_clang_library name)
-         install(TARGETS ${lib}
-           COMPONENT ${lib}
-           ${export_to_clangtargets}
--          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--          RUNTIME DESTINATION bin)
-+          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-         if (NOT LLVM_ENABLE_IDE)
-           add_llvm_install_targets(install-${lib}
-@@ -170,7 +170,7 @@ macro(add_clang_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_clangtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT LLVM_ENABLE_IDE)
-@@ -185,7 +185,7 @@ endmacro()
- macro(add_clang_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
- 
- function(clang_target_link_libraries target type)
-diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
-index b2c0ce8dd4a0..19e5443d8c25 100644
---- a/lib/Headers/CMakeLists.txt
-+++ b/lib/Headers/CMakeLists.txt
-@@ -215,7 +215,7 @@ set_target_properties(clang-resource-headers PROPERTIES
-   FOLDER "Misc"
-   RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
- 
--set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
-+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
- 
- install(
-   FILES ${files} ${generated_files}
-diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
-index ceef4b08637c..8efad5520ca4 100644
---- a/tools/c-index-test/CMakeLists.txt
-+++ b/tools/c-index-test/CMakeLists.txt
-@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
-        "@executable_path/../../lib")
-   else()
--    set(INSTALL_DESTINATION bin)
-+    set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
-   endif()
- 
-   install(TARGETS c-index-test
-diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
-index 35ecdb11253c..d77d75de0094 100644
---- a/tools/clang-format/CMakeLists.txt
-+++ b/tools/clang-format/CMakeLists.txt
-@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
- endif()
- 
- install(PROGRAMS clang-format-bbedit.applescript
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-diff.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format-sublime.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS clang-format.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-format)
- install(PROGRAMS git-clang-format
--  DESTINATION bin
-+  DESTINATION ${CMAKE_INSTALL_BINDIR}
-   COMPONENT clang-format)
-diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
-index cda8e29ec5b1..0134d8ccd70b 100644
---- a/tools/clang-rename/CMakeLists.txt
-+++ b/tools/clang-rename/CMakeLists.txt
-@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
-   )
- 
- install(PROGRAMS clang-rename.py
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
- install(PROGRAMS clang-rename.el
--  DESTINATION share/clang
-+  DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
-   COMPONENT clang-rename)
-diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
-index 51ff2e7e1565..1ed5f8a079a1 100644
---- a/tools/libclang/CMakeLists.txt
-+++ b/tools/libclang/CMakeLists.txt
-@@ -166,7 +166,7 @@ endif()
- if(INTERNAL_INSTALL_PREFIX)
-   set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
- else()
--  set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
-+  set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
- endif()
- 
- install(DIRECTORY ../../include/clang-c
-@@ -196,7 +196,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
-           COMPONENT
-             libclang-python-bindings
-           DESTINATION
--            "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
-+            "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
- endforeach()
- if(NOT LLVM_ENABLE_IDE)
-   add_custom_target(libclang-python-bindings)
-diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
-index ec0702d76f18..d25d982f51da 100644
---- a/tools/scan-build/CMakeLists.txt
-+++ b/tools/scan-build/CMakeLists.txt
-@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-     install(PROGRAMS bin/${BinFile}
--            DESTINATION bin
-+            DESTINATION ${CMAKE_INSTALL_BINDIR}
-             COMPONENT scan-build)
-   endforeach()
- 
-@@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
-     install(PROGRAMS libexec/${LibexecFile}
--            DESTINATION libexec
-+            DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
-             COMPONENT scan-build)
-   endforeach()
- 
-@@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
-     install(FILES share/scan-build/${ShareFile}
--            DESTINATION share/scan-build
-+            DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
-             COMPONENT scan-build)
-   endforeach()
- 
-diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
-index dd3d33439299..fea19c12ce70 100644
---- a/tools/scan-view/CMakeLists.txt
-+++ b/tools/scan-view/CMakeLists.txt
-@@ -19,7 +19,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-     install(PROGRAMS bin/${BinFile}
--            DESTINATION bin
-+            DESTINATION ${CMAKE_INSTALL_BINDIR}
-             COMPONENT scan-view)
-   endforeach()
- 
-@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
-                        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
-     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
-     install(FILES share/${ShareFile}
--            DESTINATION share/scan-view
-+            DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
-             COMPONENT scan-view)
-   endforeach()
- 
-diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
-index 62f2de0cb15c..6aa66825b6ec 100644
---- a/utils/hmaptool/CMakeLists.txt
-+++ b/utils/hmaptool/CMakeLists.txt
-@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
- 
- list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
- install(PROGRAMS ${CLANG_HMAPTOOL}
--        DESTINATION bin
-+        DESTINATION ${CMAKE_INSTALL_BINDIR}
-         COMPONENT hmaptool)
- 
- add_custom_target(hmaptool ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/12/clang/purity.patch b/pkgs/development/compilers/llvm/12/clang/purity.patch
deleted file mode 100644
index deb230a36c5b..000000000000
--- a/pkgs/development/compilers/llvm/12/clang/purity.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 18 May 2017 11:56:12 -0500
-Subject: [PATCH] "purity" patch for 5.0
-
----
- lib/Driver/ToolChains/Gnu.cpp | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index fe3c0191bb..c6a482bece 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-   if (!IsStatic) {
-     if (Args.hasArg(options::OPT_rdynamic))
-       CmdArgs.push_back("-export-dynamic");
--
--    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
--      CmdArgs.push_back("-dynamic-linker");
--      CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
--                                           ToolChain.getDynamicLinker(Args)));
--    }
-   }
- 
-   CmdArgs.push_back("-o");
--- 
-2.11.0
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch b/pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch
deleted file mode 100644
index 66742e5b1498..000000000000
--- a/pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
-index 3a66dd9c3fb..7efc85d9f9f 100644
---- a/lib/builtins/CMakeLists.txt
-+++ b/lib/builtins/CMakeLists.txt
-@@ -345,4 +345,8 @@ if (NOT MSVC)
- 
-+  set(i486_SOURCES ${i386_SOURCES})
-+  set(i586_SOURCES ${i386_SOURCES})
-+  set(i686_SOURCES ${i386_SOURCES})
-+
-   if (WIN32)
-     set(i386_SOURCES
-       ${i386_SOURCES}
-@@ -608,6 +612,7 @@ else ()
-   endif()
- 
-   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
-+      message("arch: ${arch}")
-     if (CAN_TARGET_${arch})
-       # For ARM archs, exclude any VFP builtins if VFP is not supported
-       if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch b/pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch
deleted file mode 100644
index 120cfe6feb2a..000000000000
--- a/pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -ur compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake
---- compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake	2020-03-24 00:01:02.000000000 +0900
-+++ compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake	2020-05-10 03:42:00.883450706 +0900
-@@ -24,7 +24,7 @@
- 
- 
- set(ARM64 aarch64)
--set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
-+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l)
- set(HEXAGON hexagon)
- set(X86 i386)
- set(X86_64 x86_64)
-diff -ur compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt
---- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt	2020-03-24 00:01:02.000000000 +0900
-+++ compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt	2020-05-10 03:44:49.468579650 +0900
-@@ -474,6 +474,7 @@
- set(armv7_SOURCES ${arm_SOURCES})
- set(armv7s_SOURCES ${arm_SOURCES})
- set(armv7k_SOURCES ${arm_SOURCES})
-+set(armv7l_SOURCES ${arm_SOURCES})
- set(arm64_SOURCES ${aarch64_SOURCES})
- 
- # macho_embedded archs
-@@ -595,7 +596,7 @@
-   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
-     if (CAN_TARGET_${arch})
-       # For ARM archs, exclude any VFP builtins if VFP is not supported
--      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
-+      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
-         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
-         check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
-         if(NOT COMPILER_RT_HAS_${arch}_VFP)
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch
deleted file mode 100644
index 5f025764de1c..000000000000
--- a/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b44ad2c2118e..d42f5664d448 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.13.4)
- # Check if compiler-rt is built as a standalone project.
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
-   project(CompilerRT C CXX ASM)
-+  include(GNUInstallDirs)
-   set(COMPILER_RT_STANDALONE_BUILD TRUE)
-   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
- endif()
-diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
-index 361538a58e47..f0d8d9ab80f1 100644
---- a/cmake/Modules/AddCompilerRT.cmake
-+++ b/cmake/Modules/AddCompilerRT.cmake
-@@ -495,7 +495,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
-   add_custom_target(${target_name} DEPENDS ${dst_file})
-   # Install in Clang resource directory.
-   install(FILES ${file_name}
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
-     COMPONENT ${component})
-   add_dependencies(${component} ${target_name})
- 
-@@ -512,7 +512,7 @@ macro(add_compiler_rt_script name)
-   add_custom_target(${name} DEPENDS ${dst})
-   install(FILES ${dst}
-     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
--    DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
-+    DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
- endmacro(add_compiler_rt_script src name)
- 
- # Builds custom version of libc++ and installs it in <prefix>.
-diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
-index 456a8dcda59f..7a09e74c7c79 100644
---- a/cmake/Modules/CompilerRTDarwinUtils.cmake
-+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
-@@ -508,7 +508,7 @@ macro(darwin_add_embedded_builtin_libraries)
-     set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-       ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
-     set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
--      ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
-+      ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
-       
-     set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
-     set(CFLAGS_i386 "-march=pentium")
-diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
-index f61d487e93a0..f1f46fb9599c 100644
---- a/cmake/Modules/CompilerRTUtils.cmake
-+++ b/cmake/Modules/CompilerRTUtils.cmake
-@@ -378,7 +378,7 @@ endfunction()
- function(get_compiler_rt_install_dir arch install_dir)
-   if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-     get_compiler_rt_target(${arch} target)
--    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
-+    set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
-   else()
-     set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
-   endif()
-diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index 1edab43e7c0d..1aac6b73ff82 100644
---- a/cmake/base-config-ix.cmake
-+++ b/cmake/base-config-ix.cmake
-@@ -65,11 +65,11 @@ if (LLVM_TREE_AVAILABLE)
- else()
-     # Take output dir and install path from the user.
-   set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
--    "Path where built compiler-rt libraries should be stored.")
-+    "Path where built compiler-rt build artifacts should be stored.")
-   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
-     "Path where built compiler-rt executables should be stored.")
--  set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
--    "Path where built compiler-rt libraries should be installed.")
-+  set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
-+    "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
-   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
-   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
-   # Use a host compiler to compile/link tests.
-@@ -97,7 +97,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
-   set(COMPILER_RT_LIBRARY_OUTPUT_DIR
-     ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
-   set(COMPILER_RT_LIBRARY_INSTALL_DIR
--    ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
-+    ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
- endif()
- 
- if(APPLE)
-diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
-index b00e8caa1ddd..0fe64e4862c9 100644
---- a/include/CMakeLists.txt
-+++ b/include/CMakeLists.txt
-@@ -69,22 +69,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
- install(FILES ${SANITIZER_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
- # Install fuzzer headers.
- install(FILES ${FUZZER_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
- # Install xray headers.
- install(FILES ${XRAY_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
- # Install profile headers.
- install(FILES ${PROFILE_HEADERS}
-   COMPONENT compiler-rt-headers
-   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
--  DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
-+  DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
- 
- if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
-   add_custom_target(install-compiler-rt-headers
-diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
-index a29de8deff1b..d39ff01613d2 100644
---- a/lib/dfsan/CMakeLists.txt
-+++ b/lib/dfsan/CMakeLists.txt
-@@ -57,4 +57,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
-                    DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
- add_dependencies(dfsan dfsan_abilist)
- install(FILES ${dfsan_abilist_filename}
--        DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
-+        DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch
deleted file mode 100644
index 135cf625ef78..000000000000
--- a/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
-index f1f46fb9599c..6f19e69507ba 100644
---- a/cmake/Modules/CompilerRTUtils.cmake
-+++ b/cmake/Modules/CompilerRTUtils.cmake
-@@ -302,8 +302,9 @@ macro(load_llvm_config)
-     # Get some LLVM variables from LLVMConfig.
-     include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
- 
--    set(LLVM_LIBRARY_OUTPUT_INTDIR
--      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-+    get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
-+      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
-+      REALPATH)
-   endif()
- endmacro()
- 
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix
deleted file mode 100644
index 0e498aa30356..000000000000
--- a/pkgs/development/compilers/llvm/12/default.nix
+++ /dev/null
@@ -1,400 +0,0 @@
-{ lowPrio, newScope, pkgs, lib, stdenv
-, preLibcCrossHeaders
-, substitute, substituteAll, fetchFromGitHub, fetchpatch, fetchurl
-, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildLlvmTools # tools, but from the previous stage, for cross
-, targetLlvmLibraries # libraries, but from the next stage, for cross
-, targetLlvm
-# This is the default binutils, but with *this* version of LLD rather
-# than the default LLVM version's, if LLD is the choice. We use these for
-# the `useLLVM` bootstrapping below.
-, bootBintoolsNoLibc ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintoolsNoLibc
-, bootBintools ?
-    if stdenv.targetPlatform.linker == "lld"
-    then null
-    else pkgs.bintools
-, darwin
-# Allows passthrough to packages via newScope. This makes it possible to
-# do `(llvmPackages.override { <someLlvmDependency> = bar; }).clang` and get
-# an llvmPackages whose packages are overridden in an internally consistent way.
-, ...
-}@args:
-
-let
-  candidate = ""; # empty or "rcN"
-  dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
-
-  metadata = rec {
-    release_version = "12.0.1";
-    version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs
-    inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
-    fetch = name: sha256: fetchurl {
-      url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${metadata.version}/${name}-${metadata.release_version}${candidate}.src.tar.xz";
-      inherit sha256;
-    };
-    clang-tools-extra_src = fetch "clang-tools-extra" "1r9a4fdz9ci58b5z2inwvm4z4cdp6scrivnaw05dggkxz7yrwrb5";
-  };
-
-  inherit (metadata) fetch;
-
-
-  tools = lib.makeExtensible (tools: let
-    callPackage = newScope (tools // args // metadata);
-    mkExtraBuildCommands0 = cc: ''
-      rsrc="$out/resource-root"
-      mkdir "$rsrc"
-      ln -s "${cc.lib}/lib/clang/${metadata.release_version}/include" "$rsrc"
-      echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
-    '';
-    mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
-      ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
-    '';
-
-  bintoolsNoLibc' =
-    if bootBintoolsNoLibc == null
-    then tools.bintoolsNoLibc
-    else bootBintoolsNoLibc;
-  bintools' =
-    if bootBintools == null
-    then tools.bintools
-    else bootBintools;
-
-  in {
-
-    libllvm = callPackage ../common/llvm {
-      src = fetch "llvm" "1pzx9zrmd7r3481sbhwvkms68fwhffpp4mmz45dgrkjpyl2q96kx";
-      polly_src = fetch "polly" "1yfm9ixda4a2sx7ak5vswijx4ydk5lv1c1xh39xmd2kh299y4m12";
-      patches = [
-        # When cross-compiling we configure llvm-config-native with an approximation
-        # of the flags used for the normal LLVM build. To avoid the need for building
-        # a native libLLVM.so (which would fail) we force llvm-config to be linked
-        # statically against the necessary LLVM components always.
-        ../common/llvm/llvm-config-link-static.patch
-        # Fix llvm being miscompiled by some gccs. See llvm/llvm-project#49955
-        # Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955
-        ./llvm/fix-llvm-issue-49955.patch
-
-        ./llvm/gnu-install-dirs.patch
-        # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
-        (fetchpatch {
-          name = "uops-CMOV16rm-noreg.diff";
-          url = "https://github.com/llvm/llvm-project/commit/9e9f991ac033.diff";
-          sha256 = "sha256:12s8vr6ibri8b48h2z38f3afhwam10arfiqfy4yg37bmc054p5hi";
-          stripLen = 1;
-        })
-
-        # Fix musl build.
-        (fetchpatch {
-          url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch";
-          relative = "llvm";
-          hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA=";
-        })
-
-        # Backport gcc-13 fixes with missing includes.
-        (fetchpatch {
-          name = "signals-gcc-13.patch";
-          url = "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch";
-          hash = "sha256-CXwYxQezTq5vdmc8Yn88BUAEly6YZ5VEIA6X3y5NNOs=";
-          stripLen = 1;
-        })
-        (fetchpatch {
-          name = "base64-gcc-13.patch";
-          url = "https://github.com/llvm/llvm-project/commit/5e9be93566f39ee6cecd579401e453eccfbe81e5.patch";
-          hash = "sha256-PAwrVrvffPd7tphpwCkYiz+67szPRzRB2TXBvKfzQ7U=";
-          stripLen = 1;
-        })
-      ];
-      pollyPatches = [
-        ./llvm/gnu-install-dirs-polly.patch
-      ];
-    };
-
-    # `llvm` historically had the binaries.  When choosing an output explicitly,
-    # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
-    llvm = tools.libllvm;
-
-    libclang = callPackage ../common/clang {
-      src = fetch "clang" "0px4gl27az6cdz6adds89qzdwb1cqpjsfvrldbz9qvpmphrj34bf";
-      patches = [
-        ./clang/purity.patch
-        # https://reviews.llvm.org/D51899
-        ./clang/gnu-install-dirs.patch
-        (substituteAll {
-          src = ../common/clang/clang-11-15-LLVMgold-path.patch;
-          libllvmLibdir = "${tools.libllvm.lib}/lib";
-        })
-      ];
-    };
-
-    clang-unwrapped = tools.libclang;
-
-    # disabled until recommonmark supports sphinx 3
-    #Llvm-manpages = lowPrio (tools.libllvm.override {
-    #  enableManpages = true;
-    #  python3 = pkgs.python3;  # don't use python-boot
-    #});
-
-    clang-manpages = lowPrio (tools.libclang.override {
-      enableManpages = true;
-      python3 = pkgs.python3;  # don't use python-boot
-    });
-
-    # disabled until recommonmark supports sphinx 3
-    # lldb-manpages = lowPrio (tools.lldb.override {
-    #   enableManpages = true;
-    #   python3 = pkgs.python3;  # don't use python-boot
-    # });
-
-    # pick clang appropriate for package set we are targeting
-    clang =
-      /**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
-      else if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
-      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
-      else tools.libcxxClang;
-
-    libstdcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
-      libcxx = null;
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    libcxxClang = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = mkExtraBuildCommands cc;
-    };
-
-    lld = callPackage ../common/lld {
-      src = fetch "lld" "0qg3fgc7wj34hdkqn21y03zcmsdd01szhhm1hfki63iifrm3y2v9";
-      patches = [
-        ./lld/gnu-install-dirs.patch
-      ];
-      inherit (libraries) libunwind;
-    };
-
-    lldb = callPackage ../common/lldb.nix {
-      src = fetch "lldb" "0g3pj1m3chafavpr35r9fynm85y2hdyla6klj0h28khxs2613i78";
-      patches =
-        let
-          resourceDirPatch = callPackage
-            ({ substituteAll, libclang }: substituteAll
-              {
-                src = ./lldb/resource-dir.patch;
-                clangLibDir = "${libclang.lib}/lib";
-              })
-            { };
-        in
-        [
-          ./lldb/procfs.patch
-          resourceDirPatch
-          ./lldb/gnu-install-dirs.patch
-        ];
-    };
-
-    # Below, is the LLVM bootstrapping logic. It handles building a
-    # fully LLVM toolchain from scratch. No GCC toolchain should be
-    # pulled in. As a consequence, it is very quick to build different
-    # targets provided by LLVM and we can also build for what GCC
-    # doesn’t support like LLVM. Probably we should move to some other
-    # file.
-
-    bintools-unwrapped = callPackage ../common/bintools.nix { };
-
-    bintoolsNoLibc = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-      libc = preLibcCrossHeaders;
-    };
-
-    bintools = wrapBintoolsWith {
-      bintools = tools.bintools-unwrapped;
-    };
-
-    clangUseLLVM = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = targetLlvmLibraries.libcxx;
-      bintools = bintools';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
-        targetLlvmLibraries.libunwind
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
-        echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
-        echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
-      '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
-        echo "-lunwind" >> $out/nix-support/cc-ldflags
-      '' + lib.optionalString stdenv.targetPlatform.isWasm ''
-        echo "-fno-exceptions" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibcxx = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-        echo "-nostdlib++" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [
-        targetLlvmLibraries.compiler-rt
-      ];
-      extraBuildCommands = ''
-        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
-        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands cc;
-    };
-
-    clangNoCompilerRt = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintoolsNoLibc';
-      extraPackages = [ ];
-      extraBuildCommands = ''
-        echo "-nostartfiles" >> $out/nix-support/cc-cflags
-      '' + mkExtraBuildCommands0 cc;
-    };
-
-    clangNoCompilerRtWithLibc = wrapCCWith rec {
-      cc = tools.clang-unwrapped;
-      libcxx = null;
-      bintools = bintools';
-      extraPackages = [ ];
-      extraBuildCommands = mkExtraBuildCommands0 cc;
-    };
-
-  });
-
-  libraries = lib.makeExtensible (libraries: let
-    callPackage = newScope (libraries // buildLlvmTools // args // metadata);
-  in {
-
-    compiler-rt-libc = callPackage ../common/compiler-rt {
-      src = fetch "compiler-rt" "1950rg294izdwkaasi7yjrmadc9mzdd5paf0q63jjcq2m3rdbj5l";
-      patches = [
-        ../common/compiler-rt/7-12-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
-        ./compiler-rt/gnu-install-dirs.patch
-        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
-        # extra `/`.
-        ./compiler-rt/normalize-var.patch
-        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
-        ./compiler-rt/armv7l.patch
-        # Fix build on armv6l
-        ../common/compiler-rt/armv6-mcr-dmb.patch
-        ../common/compiler-rt/armv6-sync-ops-no-thumb.patch
-        ../common/compiler-rt/armv6-no-ldrexd-strexd.patch
-      ];
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
-               else stdenv;
-    };
-
-    compiler-rt-no-libc = callPackage ../common/compiler-rt {
-      src = fetch "compiler-rt" "1950rg294izdwkaasi7yjrmadc9mzdd5paf0q63jjcq2m3rdbj5l";
-      patches = [
-        ../common/compiler-rt/7-12-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
-        ./compiler-rt/X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
-        ./compiler-rt/gnu-install-dirs.patch
-        # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
-        # extra `/`.
-        ./compiler-rt/normalize-var.patch
-        ../common/compiler-rt/darwin-plistbuddy-workaround.patch
-        ./compiler-rt/armv7l.patch
-        # Fix build on armv6l
-        ../common/compiler-rt/armv6-mcr-dmb.patch
-        ../common/compiler-rt/armv6-sync-ops-no-thumb.patch
-        ../common/compiler-rt/armv6-no-ldrexd-strexd.patch
-      ];
-      stdenv = if stdenv.hostPlatform.useLLVM or false
-               then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
-               else stdenv;
-    };
-
-    # N.B. condition is safe because without useLLVM both are the same.
-    compiler-rt = if stdenv.hostPlatform.isAndroid
-      then libraries.compiler-rt-libc
-      else libraries.compiler-rt-no-libc;
-
-    stdenv = overrideCC stdenv buildLlvmTools.clang;
-
-    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
-
-    libcxx = callPackage ../common/libcxx {
-      src = fetchFromGitHub {
-        owner = "llvm";
-        repo = "llvm-project";
-        rev = "refs/tags/llvmorg-${metadata.version}";
-        sparseCheckout = [
-          "libcxx"
-          "libcxxabi"
-          "llvm/cmake"
-          "llvm/utils"
-          "runtimes"
-        ];
-        hash = "sha256-etxgXIdWxMTmbZ83Hsc0w6Jt5OSQSUEPVEWqLkHsNBY=";
-      };
-      patches = [
-        (substitute {
-          src = ../common/libcxxabi/wasm.patch;
-          replacements = [
-            "--replace-fail" "/cmake/" "/llvm/cmake/"
-          ];
-        })
-      ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-        (substitute {
-          src = ../common/libcxx/libcxx-0001-musl-hacks.patch;
-          replacements = [
-            "--replace-fail" "/include/" "/libcxx/include/"
-          ];
-        })
-      ];
-      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
-    };
-
-    libunwind = callPackage ../common/libunwind {
-      src = fetch "libunwind" "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb";
-      patches = [
-        ./libunwind/gnu-install-dirs.patch
-      ];
-      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
-    };
-
-    openmp = callPackage ../common/openmp {
-      src = fetch "openmp" "14dh0r6h2xh747ffgnsl4z08h0ri04azi9vf79cbz7ma1r27kzk0";
-      patches = [
-        # Fix cross.
-        (fetchpatch {
-          url = "https://github.com/llvm/llvm-project/commit/5e2358c781b85a18d1463fd924d2741d4ae5e42e.patch";
-          hash = "sha256-UxIlAifXnexF/MaraPW0Ut6q+sf3e7y1fMdEv1q103A=";
-        })
-      ];
-    };
-  });
-  noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
-
-in { inherit tools libraries; inherit (metadata) release_version; } // (noExtend libraries) // (noExtend tools)
diff --git a/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch
deleted file mode 100644
index a791d6c43231..000000000000
--- a/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 48cb8e004e08..fec8144fb95a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -23,6 +23,8 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
-   project(libunwind LANGUAGES C CXX ASM)
- 
-+  include(GNUInstallDirs)
-+
-   set(PACKAGE_NAME libunwind)
-   set(PACKAGE_VERSION 12.0.0)
-   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-@@ -115,17 +117,17 @@ set(CMAKE_MODULE_PATH
- 
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
-   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
-   if(LIBCXX_LIBDIR_SUBDIR)
-     string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-     string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
-   endif()
- elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
-   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
- else()
-   set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
--  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
-+  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
- endif()
- 
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch
deleted file mode 100644
index 61e2f0e48653..000000000000
--- a/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d4e561b50d8f..cfa5bdd79c2a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-   set(LLD_BUILT_STANDALONE TRUE)
- 
-+  include(GNUInstallDirs)
-+
-   find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
-   if(NOT LLVM_CONFIG_PATH)
-     message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
-@@ -179,7 +181,7 @@ include_directories(BEFORE
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     )
-diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
-index 23df41312403..d62372c88de7 100644
---- a/cmake/modules/AddLLD.cmake
-+++ b/cmake/modules/AddLLD.cmake
-@@ -20,9 +20,9 @@ macro(add_lld_library name)
-     install(TARGETS ${name}
-       COMPONENT ${name}
-       ${export_to_lldtargets}
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      RUNTIME DESTINATION bin)
-+      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
-     if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
-       add_llvm_install_targets(install-${name}
-@@ -54,7 +54,7 @@ macro(add_lld_tool name)
- 
-     install(TARGETS ${name}
-       ${export_to_lldtargets}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       COMPONENT ${name})
- 
-     if(NOT CMAKE_CONFIGURATION_TYPES)
-@@ -69,5 +69,5 @@ endmacro()
- macro(add_lld_symlink name dest)
-   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
-   # Always generate install targets
--  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
-+  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
- endmacro()
-diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
-index 5cff736ff57f..64e775c771b9 100644
---- a/tools/lld/CMakeLists.txt
-+++ b/tools/lld/CMakeLists.txt
-@@ -21,7 +21,7 @@ target_link_libraries(lld
-   )
- 
- install(TARGETS lld
--  RUNTIME DESTINATION bin)
-+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
- 
- if(NOT LLD_SYMLINKS_TO_CREATE)
-   set(LLD_SYMLINKS_TO_CREATE
diff --git a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
deleted file mode 100644
index 9a4d2b272acb..000000000000
--- a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b5633e21c56a..f2f1035e9238 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -10,6 +10,8 @@ set(CMAKE_MODULE_PATH
- # If we are not building as part of LLVM, build LLDB as a standalone project,
- # using LLVM as an external library.
- if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-+  include(GNUInstallDirs)
-+
-   project(lldb)
-   include(LLDBStandalone)
- 
-diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
-index 4ed5c647c5d2..89f96e710d55 100644
---- a/cmake/modules/AddLLDB.cmake
-+++ b/cmake/modules/AddLLDB.cmake
-@@ -107,13 +107,13 @@ function(add_lldb_library name)
-   endif()
- 
-   if(PARAM_SHARED)
--    set(install_dest lib${LLVM_LIBDIR_SUFFIX})
-+    set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-     if(PARAM_INSTALL_PREFIX)
-       set(install_dest ${PARAM_INSTALL_PREFIX})
-     endif()
-     # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
-     install(TARGETS ${name} COMPONENT ${name}
--      RUNTIME DESTINATION bin
-+      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-       LIBRARY DESTINATION ${install_dest}
-       ARCHIVE DESTINATION ${install_dest}
-       FRAMEWORK DESTINATION ${install_dest})
-diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
-index 2fdf1502d055..37364341ff8b 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -225,7 +225,7 @@ include_directories(BEFORE
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".cmake" EXCLUDE
-@@ -233,7 +233,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
-     COMPONENT lldb-headers
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN ".cmake" EXCLUDE
-diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
-index 734167e51bc5..f95761b5df58 100644
---- a/tools/intel-features/CMakeLists.txt
-+++ b/tools/intel-features/CMakeLists.txt
-@@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
- endif()
- 
- install(TARGETS lldbIntelFeatures
--  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
-index 752113b..010f187 100644
---- a/cmake/modules/LLDBStandalone.cmake
-+++ b/cmake/modules/LLDBStandalone.cmake
-@@ -62,7 +62,7 @@ endif()
-
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
--set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-+set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
- if(WIN32 OR CYGWIN)
-   # DLL platform -- put DLLs into bin.
-   set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b5633e2..86e4738 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -79,7 +79,7 @@ if (LLDB_ENABLE_PYTHON)
-   if(LLDB_BUILD_FRAMEWORK)
-     set(lldb_python_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
-   else()
--    set(lldb_python_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
-+    set(lldb_python_target_dir "${CMAKE_INSTALL_LIBDIR}/../${LLDB_PYTHON_RELATIVE_PATH}/lldb")
-   endif()
-   get_target_property(lldb_python_bindings_dir swig_wrapper_python BINARY_DIR)
-   finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
-diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt
-index b5633e2..86e4738 100644
---- a/source/API/CMakeLists.txt	2024-05-30 19:08:14.241656491 -0700
-+++ b/source/API/CMakeLists.txt	2024-05-30 19:08:48.218219667 -0700
-@@ -113,14 +113,6 @@
-   ${option_install_prefix}
- )
- 
--# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
--# which depends on lib/libLLVM*.so (BUILD_SHARED_LIBS) or lib/libLLVM-10git.so
--# (LLVM_LINK_LLVM_DYLIB). Add an additional rpath $ORIGIN/../../../../lib so
--# that _lldb.so can be loaded from Python.
--if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX AND NOT APPLE)
--  set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
--endif()
--
- if(Python3_RPATH)
-   set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
-   set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH   "${Python3_RPATH}")
diff --git a/pkgs/development/compilers/llvm/12/lldb/procfs.patch b/pkgs/development/compilers/llvm/12/lldb/procfs.patch
deleted file mode 100644
index b075dbaeee0a..000000000000
--- a/pkgs/development/compilers/llvm/12/lldb/procfs.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/source/Plugins/Process/Linux/Procfs.h
-+++ b/source/Plugins/Process/Linux/Procfs.h
-@@ -11,21 +11,12 @@
- // sys/procfs.h on Android/Linux for all supported architectures.
- 
- #include <sys/ptrace.h>
-+#include <asm/ptrace.h>
- 
--#ifdef __ANDROID__
--#if defined(__arm64__) || defined(__aarch64__)
--typedef unsigned long elf_greg_t;
--typedef elf_greg_t
--    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
--typedef struct user_fpsimd_state elf_fpregset_t;
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#elif defined(__mips__)
--#ifndef NT_FPREGSET
--#define NT_FPREGSET NT_PRFPREG
--#endif // NT_FPREGSET
--#endif
--#else // __ANDROID__
-+#if !defined(__GLIBC__) && defined(__powerpc__)
-+#define pt_regs musl_pt_regs
-+#include <sys/procfs.h>
-+#undef pt_regs
-+#else
- #include <sys/procfs.h>
--#endif // __ANDROID__
-+#endif
diff --git a/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch
deleted file mode 100644
index e0db80afeb9f..000000000000
--- a/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
-index 37364341ff8b..7f74c1a3e257 100644
---- a/cmake/modules/LLDBConfig.cmake
-+++ b/cmake/modules/LLDBConfig.cmake
-@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
-   # Iterate over the possible places where the external resource directory
-   # could be and pick the first that exists.
-   foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
--                    "${LLVM_BUILD_LIBRARY_DIR}"
-+                    "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
-                     "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
-     # Build the resource directory path by appending 'clang/<version number>'.
-     set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
diff --git a/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch b/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch
deleted file mode 100644
index b515583a0c42..000000000000
--- a/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt
-index eb924282..c77c140b 100644
---- a/lib/CodeGen/AsmPrinter/CMakeLists.txt
-+++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt
-@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter
-   Support
-   Target
-   )
-+
-+if (CMAKE_COMPILER_IS_GNUCXX)
-+  set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES
-+                              COMPILE_FLAGS -fno-strict-aliasing)
-+endif()
diff --git a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch
deleted file mode 100644
index 68f3c45396f6..000000000000
--- a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
-index ca7c04c565bb..6ed5db5dd4f8 100644
---- a/tools/polly/CMakeLists.txt
-+++ b/tools/polly/CMakeLists.txt
-@@ -2,7 +2,11 @@
- if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   project(Polly)
-   cmake_minimum_required(VERSION 3.13.4)
-+endif()
-+
-+include(GNUInstallDirs)
- 
-+if (NOT DEFINED LLVM_MAIN_SRC_DIR)
-   # Where is LLVM installed?
-   find_package(LLVM CONFIG REQUIRED)
-   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
-@@ -122,13 +126,13 @@ include_directories(
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     )
- 
-   install(DIRECTORY ${POLLY_BINARY_DIR}/include/
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     FILES_MATCHING
-     PATTERN "*.h"
-     PATTERN "CMakeFiles" EXCLUDE
-diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
-index 7cc129ba2e90..137be25e4b80 100644
---- a/tools/polly/cmake/CMakeLists.txt
-+++ b/tools/polly/cmake/CMakeLists.txt
-@@ -79,18 +79,18 @@ file(GENERATE
- 
- # Generate PollyConfig.cmake for the install tree.
- unset(POLLY_EXPORTS)
--set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
-+set(POLLY_INSTALL_PREFIX "")
- set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
--set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
-+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-+set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
- if (POLLY_BUNDLED_ISL)
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
--    "${POLLY_INSTALL_PREFIX}/include/polly"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
-     )
- else()
-   set(POLLY_CONFIG_INCLUDE_DIRS
--    "${POLLY_INSTALL_PREFIX}/include"
-+    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
-     ${ISL_INCLUDE_DIRS}
-     )
- endif()
-@@ -100,12 +100,12 @@ endif()
- foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
-   get_target_property(tgt_type ${tgt} TYPE)
-   if (tgt_type STREQUAL "EXECUTABLE")
--    set(tgt_prefix "bin/")
-+    set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
-   else()
--    set(tgt_prefix "lib/")
-+    set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
-   endif()
- 
--  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-+  set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
-   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
- 
-   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
-diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
-index 518a09b45a42..bd9d6f5542ad 100644
---- a/tools/polly/cmake/polly_macros.cmake
-+++ b/tools/polly/cmake/polly_macros.cmake
-@@ -44,8 +44,8 @@ macro(add_polly_library name)
-   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
-     install(TARGETS ${name}
-       EXPORT LLVMExports
--      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
--      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-+	  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
-+      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   endif()
-   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- endmacro(add_polly_library)
-diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
-index 8991094d92c7..178d8ad606bb 100644
---- a/tools/polly/lib/External/CMakeLists.txt
-+++ b/tools/polly/lib/External/CMakeLists.txt
-@@ -275,7 +275,7 @@ if (POLLY_BUNDLED_ISL)
-     install(DIRECTORY
-       ${ISL_SOURCE_DIR}/include/
-       ${ISL_BINARY_DIR}/include/
--      DESTINATION include/polly
-+      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
-       FILES_MATCHING
-       PATTERN "*.h"
-       PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch
deleted file mode 100644
index da8dc1445171..000000000000
--- a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch
+++ /dev/null
@@ -1,417 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 277d0fe54d7b..af69c8be8745 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -256,15 +256,21 @@ if (CMAKE_BUILD_TYPE AND
-   message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
- endif()
- 
-+include(GNUInstallDirs)
-+
- set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
- 
--set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
-+set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
-+    "Path for binary subdirectory (defaults to 'bin')")
- mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
- 
- set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
-     "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
- mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
- 
-+set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
-+	"Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
-+
- # They are used as destination of target generators.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-@@ -567,9 +573,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
- option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
- option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
- 
--set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
-+set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
-     CACHE STRING "Doxygen-generated HTML documentation install directory")
--set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
-+set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
-     CACHE STRING "OCamldoc-generated HTML documentation install directory")
- 
- option (LLVM_BUILD_EXTERNAL_COMPILER_RT
-@@ -1027,7 +1033,7 @@ endif()
- 
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-   install(DIRECTORY include/llvm include/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -1038,7 +1044,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-     )
- 
-   install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
--    DESTINATION include
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-     COMPONENT llvm-headers
-     FILES_MATCHING
-     PATTERN "*.def"
-@@ -1052,13 +1058,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- 
-   if (LLVM_INSTALL_MODULEMAPS)
-     install(DIRECTORY include/llvm include/llvm-c
--            DESTINATION include
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-             COMPONENT llvm-headers
-             FILES_MATCHING
-             PATTERN "module.modulemap"
-             )
-     install(FILES include/llvm/module.install.modulemap
--            DESTINATION include/llvm
-+            DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
-             COMPONENT llvm-headers
-             RENAME "module.extern.modulemap"
-             )
-diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
-index 97c9980c7de3..409e8b615f75 100644
---- a/cmake/modules/AddLLVM.cmake
-+++ b/cmake/modules/AddLLVM.cmake
-@@ -804,9 +804,9 @@ macro(add_llvm_library name)
- 
-       install(TARGETS ${name}
-               ${export_to_llvmexports}
--              LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
--              ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
--              RUNTIME DESTINATION bin COMPONENT ${name})
-+              LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
-+              ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
-+              RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
- 
-       if (NOT LLVM_ENABLE_IDE)
-         add_llvm_install_targets(install-${name}
-@@ -1022,7 +1022,7 @@ function(process_llvm_pass_plugins)
-           "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
-       install(FILES
-           ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
--          DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
-+          DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
-           COMPONENT cmake-exports)
- 
-       set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
-@@ -1242,7 +1242,7 @@ macro(add_llvm_example name)
-   endif()
-   add_llvm_executable(${name} ${ARGN})
-   if( LLVM_BUILD_EXAMPLES )
--    install(TARGETS ${name} RUNTIME DESTINATION examples)
-+    install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
-   endif()
-   set_target_properties(${name} PROPERTIES FOLDER "Examples")
- endmacro(add_llvm_example name)
-@@ -1854,7 +1854,7 @@ function(llvm_install_library_symlink name dest type)
-   set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
-   set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
- 
--  set(output_dir lib${LLVM_LIBDIR_SUFFIX})
-+  set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
-   if(WIN32 AND "${type}" STREQUAL "SHARED")
-     set(output_dir bin)
-   endif()
-@@ -1871,7 +1871,7 @@ function(llvm_install_library_symlink name dest type)
-   endif()
- endfunction()
- 
--function(llvm_install_symlink name dest)
-+function(llvm_install_symlink name dest output_dir)
-   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
-   foreach(path ${CMAKE_MODULE_PATH})
-     if(EXISTS ${path}/LLVMInstallSymlink.cmake)
-@@ -1894,7 +1894,7 @@ function(llvm_install_symlink name dest)
-   set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
- 
-   install(SCRIPT ${INSTALL_SYMLINK}
--          CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
-+          CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
-           COMPONENT ${component})
- 
-   if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
-@@ -1977,7 +1977,8 @@ function(add_llvm_tool_symlink link_name target)
-     endif()
- 
-     if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
--      llvm_install_symlink(${link_name} ${target})
-+      GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
-+      llvm_install_symlink(${link_name} ${target} ${output_dir})
-     endif()
-   endif()
- endfunction()
-@@ -2100,9 +2101,9 @@ function(llvm_setup_rpath name)
- 
-   if (APPLE)
-     set(_install_name_dir INSTALL_NAME_DIR "@rpath")
--    set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-   elseif(UNIX)
--    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-+    set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
-       set_property(TARGET ${name} APPEND_STRING PROPERTY
-                    LINK_FLAGS " -Wl,-z,origin ")
-diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
-index 554046b20edf..4d1ad980641e 100644
---- a/cmake/modules/AddOCaml.cmake
-+++ b/cmake/modules/AddOCaml.cmake
-@@ -144,9 +144,9 @@ function(add_ocaml_library name)
-   endforeach()
- 
-   if( APPLE )
--    set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   elseif( UNIX )
--    set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
-   endif()
-   list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
- 
-diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
-index e80c3b5c1cac..482f6d715ef5 100644
---- a/cmake/modules/AddSphinxTarget.cmake
-+++ b/cmake/modules/AddSphinxTarget.cmake
-@@ -90,7 +90,7 @@ function (add_sphinx_target builder project)
-         endif()
-       elseif (builder STREQUAL html)
-         string(TOUPPER "${project}" project_upper)
--        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
-+        set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
-             CACHE STRING "HTML documentation install directory for ${project}")
- 
-         # '/.' indicates: copy the contents of the directory directly into
-diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
-index 505dc9a29d70..36e6c63af3f4 100644
---- a/cmake/modules/CMakeLists.txt
-+++ b/cmake/modules/CMakeLists.txt
-@@ -1,4 +1,4 @@
--set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
-+set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
- set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
- 
- # First for users who use an installed LLVM, create the LLVMExports.cmake file.
-@@ -107,13 +107,13 @@ foreach(p ${_count})
-   set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
- get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
- endforeach(p)
--set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
-+set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
- set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
- set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
--set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
-+set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
- set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
- set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
--set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
-+set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
- 
- # Generate a default location for lit
- if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
-diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
-index 09fed8085c23..aa79f192abf0 100644
---- a/cmake/modules/LLVMInstallSymlink.cmake
-+++ b/cmake/modules/LLVMInstallSymlink.cmake
-@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
-     set(LINK_OR_COPY copy)
-   endif()
- 
--  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
-+  set(bindir "${DESTDIR}${outdir}/")
- 
-   message(STATUS "Creating ${name}")
- 
-diff --git a/docs/CMake.rst b/docs/CMake.rst
-index bb821b417ad9..6a528f7c2ad3 100644
---- a/docs/CMake.rst
-+++ b/docs/CMake.rst
-@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
- **LLVM_LIBDIR_SUFFIX**:STRING
-   Extra suffix to append to the directory where libraries are to be
-   installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
--  to install libraries to ``/usr/lib64``.
-+  to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
- 
- **CMAKE_C_FLAGS**:STRING
-   Extra flags to use when compiling C source files.
-@@ -550,8 +550,8 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
-   The path to install Doxygen-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/doxygen-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
- 
- **LLVM_ENABLE_SPHINX**:BOOL
-   If specified, CMake will search for the ``sphinx-build`` executable and will make
-@@ -582,13 +582,33 @@ LLVM-specific variables
- 
- **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
-   The path to install Sphinx-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
- 
- **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
-   The path to install OCamldoc-generated HTML documentation to. This path can
--  either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
--  `share/doc/llvm/ocaml-html`.
-+  either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
-+  `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
-+
-+**CMAKE_INSTALL_BINDIR**:STRING
-+  The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `bin`.
-+
-+**CMAKE_INSTALL_LIBDIR**:STRING
-+  The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `lib`.
-+
-+**CMAKE_INSTALL_INCLUDEDIR**:STRING
-+  The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `include`.
-+
-+**CMAKE_INSTALL_DOCDIR**:STRING
-+  The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/doc`.
-+
-+**CMAKE_INSTALL_MANDIR**:STRING
-+  The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
-+  Defaults to `share/man`.
- 
- **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
-   macOS Only: If enabled CMake will generate a target named
-@@ -786,9 +806,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
- 
- This file is available in two different locations.
- 
--* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
--  ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
--  On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
-+* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where
-+  ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
-+  installed as part of an installed version of LLVM. This is typically
-+  ``cmake/llvm/`` within the lib directory. On Linux, this is typically
-+  ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
- 
- * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
-   ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
-diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
-index bb96edb4b4bf..678c22fb43c8 100644
---- a/examples/Bye/CMakeLists.txt
-+++ b/examples/Bye/CMakeLists.txt
-@@ -14,6 +14,6 @@ if (NOT WIN32)
-     BUILDTREE_ONLY
-    )
- 
--  install(TARGETS ${name} RUNTIME DESTINATION examples)
-+  install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
-   set_target_properties(${name} PROPERTIES FOLDER "Examples")
- endif()
-diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
-index b46319f24fc8..2feabd1954e4 100644
---- a/include/llvm/CMakeLists.txt
-+++ b/include/llvm/CMakeLists.txt
-@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
- # If we're doing an out-of-tree build, copy a module map for generated
- # header files into the build area.
- if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
--  configure_file(module.modulemap.build module.modulemap COPYONLY)
-+  configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
- endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
-diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
-index ebe5b73a5c65..70c497be12f5 100644
---- a/tools/llvm-config/BuildVariables.inc.in
-+++ b/tools/llvm-config/BuildVariables.inc.in
-@@ -23,6 +23,10 @@
- #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
- #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
- #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
-+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
-+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
-+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
-+#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
- #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
- #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
- #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 1a2f04552d13..44fa7d3eec6b 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -357,12 +357,26 @@ int main(int argc, char **argv) {
-         ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
-   } else {
-     ActivePrefix = CurrentExecPrefix;
--    ActiveIncludeDir = ActivePrefix + "/include";
--    SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
--    sys::fs::make_absolute(ActivePrefix, path);
--    ActiveBinDir = std::string(path.str());
--    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
--    ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveIncludeDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveBinDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveLibDir = std::string(path.str());
-+    }
-+    {
-+      SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
-+      sys::fs::make_absolute(ActivePrefix, path);
-+      ActiveCMakeDir = std::string(path.str());
-+    }
-     ActiveIncludeOption = "-I" + ActiveIncludeDir;
-   }
- 
-diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
-index 2963f97cad88..69d66c9c9ca1 100644
---- a/tools/lto/CMakeLists.txt
-+++ b/tools/lto/CMakeLists.txt
-@@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
-     intrinsics_gen)
- 
- install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
--  DESTINATION include/llvm-c
-+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-   COMPONENT LTO)
- 
- if (APPLE)
-diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
-index ead73ec13a8f..250362021f17 100644
---- a/tools/opt-viewer/CMakeLists.txt
-+++ b/tools/opt-viewer/CMakeLists.txt
-@@ -8,7 +8,7 @@ set (files
- 
- foreach (file ${files})
-   install(PROGRAMS ${file}
--    DESTINATION share/opt-viewer
-+    DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
-     COMPONENT opt-viewer)
- endforeach (file)
- 
-diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
-index 865436247270..ce1daa62f6ab 100644
---- a/tools/remarks-shlib/CMakeLists.txt
-+++ b/tools/remarks-shlib/CMakeLists.txt
-@@ -19,7 +19,7 @@ if(LLVM_ENABLE_PIC)
-   endif()
-   
-   install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
--    DESTINATION include/llvm-c
-+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
-     COMPONENT Remarks)
- 
-   if (APPLE)