From 942da65b07023a3a7c5f8a6c58e40781d0f1e748 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 8 Jun 2022 16:43:04 +0000 Subject: [PATCH] llvmPackages_14: Fix remaining broken gnu-install-dirs patches --- .../compilers/llvm/14/libcxx/default.nix | 9 --- .../llvm/14/libcxx/gnu-install-dirs.patch | 76 ++----------------- .../compilers/llvm/14/libcxxabi/default.nix | 1 - .../llvm/14/libcxxabi/gnu-install-dirs.patch | 36 ++------- .../compilers/llvm/14/libunwind/default.nix | 1 - .../llvm/14/libunwind/gnu-install-dirs.patch | 52 +------------ 6 files changed, 16 insertions(+), 159 deletions(-) diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix index 8891a69937aba..0a684782d490a 100644 --- a/pkgs/development/compilers/llvm/14/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix @@ -62,15 +62,6 @@ stdenv.mkDerivation rec { buildFlags = lib.optional headersOnly "generate-cxx-headers"; installTargets = lib.optional headersOnly "install-cxx-headers"; - # At this point, cxxabi headers would be installed in the dev output, which - # prevents moveToOutput from doing its job later in the build process. - postInstall = lib.optionalString (!headersOnly) '' - mv "$dev/include/c++/v1/"* "$out/include/c++/v1/" - pushd "$dev" - rmdir -p include/c++/v1 - popd - ''; - passthru = { isLLVM = true; }; diff --git a/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch index 0f1d5c411ab8f..bddf55d1e6051 100644 --- a/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch @@ -1,85 +1,21 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index b0569a4a54ca..7d665f5a3258 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -10,6 +10,8 @@ endif() - #=============================================================================== - cmake_minimum_required(VERSION 3.13.4) - -+include(GNUInstallDirs) -+ - set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") - - # Add path for custom modules -@@ -415,13 +417,13 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) +@@ -436,7 +436,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1") - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH + set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH "Path where built libc++ libraries should be installed.") -- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libc++ runtime libraries should be installed.") -- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH -+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") -- set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH -+ set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH "Path where target-specific libc++ headers should be installed.") - if(LIBCXX_LIBDIR_SUBDIR) - string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) -@@ -431,11 +433,11 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR) - set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") - set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}") -- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH -+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH - "Path where built libc++ libraries should be installed.") -- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}/c++/v1" CACHE PATH - "Path where built libc++ runtime libraries should be installed.") -- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH -+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") - set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH - "Path where target-specific libc++ headers should be installed.") -@@ -443,11 +445,11 @@ else() - set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") +@@ -453,7 +453,7 @@ else() + set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") + endif() set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}") - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH -+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH ++ set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" CACHE PATH "Path where built libc++ libraries should be installed.") -- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libc++ runtime libraries should be installed.") -- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH -+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH "Path where target-specific libc++ headers should be installed.") -diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake -index 5a8a4a270a1a..d69405ddeeac 100644 ---- a/cmake/Modules/HandleLibCXXABI.cmake -+++ b/cmake/Modules/HandleLibCXXABI.cmake -@@ -1,8 +1,9 @@ -- - #=============================================================================== - # Add an ABI library if appropriate - #=============================================================================== - -+include(GNUInstallDirs) -+ - # - # _setup_abi: Set up the build to use an ABI library - # -@@ -63,7 +64,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs) - - if (LIBCXX_INSTALL_HEADERS) - install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" -- DESTINATION include/c++/v1/${dstdir} -+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}" - COMPONENT cxx-headers - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - ) diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index 07aaa2737ceaf..d64708ab040ae 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix @@ -82,6 +82,5 @@ stdenv.mkDerivation rec { # the UIUC License (a BSD-like license)": license = with lib.licenses; [ mit ncsa ]; maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ]; - broken = true; # TODO: gnu-install-dirs.patch fails to apply }; } diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch index a93348ded0c10..bd25c903d5bcc 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch @@ -1,46 +1,22 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 858f5d5cfd7f..16c67d7062be 100644 +index ecbc7091864e..53ba2dbc3bd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -10,6 +10,8 @@ endif() - - cmake_minimum_required(VERSION 3.13.4) - -+include(GNUInstallDirs) -+ - set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") - - # Add path for custom modules -@@ -213,9 +215,9 @@ set(CMAKE_MODULE_PATH +@@ -216,7 +216,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR}) set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH "Path where built libc++abi libraries should be installed.") -- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libc++abi runtime libraries should be installed.") if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) -@@ -224,16 +226,16 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - elseif(LLVM_LIBRARY_OUTPUT_INTDIR) - set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR}) - set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) -- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH -+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH - "Path where built libc++abi libraries should be installed.") -- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libc++abi runtime libraries should be installed.") - else() - set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR}) - set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX}) +@@ -230,7 +230,7 @@ else() + set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR}) + set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX}) + endif() - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH "Path where built libc++abi libraries should be installed.") -- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libc++abi runtime libraries should be installed.") endif() diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix index 109b92f1e027e..c6d9eda5e4749 100644 --- a/pkgs/development/compilers/llvm/14/libunwind/default.nix +++ b/pkgs/development/compilers/llvm/14/libunwind/default.nix @@ -43,6 +43,5 @@ stdenv.mkDerivation rec { I). It is a dependency of the C++ ABI library, and sometimes is a dependency of other runtimes. ''; - broken = true; # TODO: gnu-install-dirs.patch fails to apply }; } diff --git a/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch index 3f05d2a87269c..3fce8bf903430 100644 --- a/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch @@ -1,65 +1,21 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index e3cc66dd2226..1299b596ce0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -8,6 +8,8 @@ endif() - - cmake_minimum_required(VERSION 3.13.4) - -+include(GNUInstallDirs) -+ - set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") - - # Add path for custom modules -@@ -139,25 +141,27 @@ set(CMAKE_MODULE_PATH +@@ -147,7 +147,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH -+ set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH -+ "Path where built libunwind headers should be installed.") + set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH "Path where built libunwind libraries should be installed.") -- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libunwind runtime libraries should be installed.") if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) - string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR}) +@@ -159,7 +159,7 @@ else() + else() + set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) endif() --elseif(LLVM_LIBRARY_OUTPUT_INTDIR) -- set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) -- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH -- "Path where built libunwind libraries should be installed.") -- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH -- "Path where built libunwind runtime libraries should be installed.") - else() -- set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) - set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH -+ if(LLVM_LIBRARY_OUTPUT_INTDIR) -+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) -+ else() -+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX}) -+ endif() -+ set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH -+ "Path where built libunwind headers should be installed.") + set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH "Path where built libunwind libraries should be installed.") -- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH -+ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH - "Path where built libunwind runtime libraries should be installed.") endif() -diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt -index c3bb1dd0f69f..adf1766c44cb 100644 ---- a/include/CMakeLists.txt -+++ b/include/CMakeLists.txt -@@ -14,7 +14,7 @@ if(LIBUNWIND_INSTALL_HEADERS) - foreach(file ${files}) - get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} -- DESTINATION "include/${dir}" -+ DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}" - COMPONENT unwind-headers - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - )