diff --git a/pkgs/development/compilers/llvm/git/libcxx/default.nix b/pkgs/development/compilers/llvm/git/libcxx/default.nix index 8fb6b4a7dbd4..f511eba81dc5 100644 --- a/pkgs/development/compilers/llvm/git/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxx/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, llvm_meta, src, cmake, python3, libcxxabi, fixDarwinDylibNames, version +{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version , enableShared ? !stdenv.hostPlatform.isStatic }: @@ -24,10 +24,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = [ libcxxabi ]; - cmakeFlags = [ - "-DLIBCXX_CXX_ABI=libcxxabi" ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON" ++ lib.optional stdenv.hostPlatform.isWasm [ diff --git a/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch index 1f9de00a9d56..f59d7f8dfafc 100644 --- a/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/git/libcxx/gnu-install-dirs.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9bf1a02f0908..612cd4aab76c 100644 +index 06ee1d74a03e..6c3c6f8f8d47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") @@ -9,92 +9,73 @@ index 9bf1a02f0908..612cd4aab76c 100644 + include(GNUInstallDirs) + set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 12.0.0) + set(PACKAGE_VERSION 13.0.0git) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -@@ -402,7 +404,7 @@ endif () - if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) -- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) -+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) +@@ -409,7 +411,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}) ++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}) + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1") if(LIBCXX_LIBDIR_SUBDIR) - string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) - string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) -@@ -410,11 +412,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - elseif(LLVM_LIBRARY_OUTPUT_INTDIR) +@@ -420,14 +422,14 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) + 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}) + set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}") else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") + set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}") - set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}) + set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1") + set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}") endif() - - file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake -index 5d2764e870e9..bb1ec5de6ca2 100644 +index 5a8a4a270a1a..c06bae0001aa 100644 --- a/cmake/Modules/HandleLibCXXABI.cmake +++ b/cmake/Modules/HandleLibCXXABI.cmake @@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs) if (LIBCXX_INSTALL_HEADERS) install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}" -- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir} -+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir} +- 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/include/CMakeLists.txt b/include/CMakeLists.txt -index 29a317b8ae9a..4747263cfd1b 100644 ---- a/include/CMakeLists.txt -+++ b/include/CMakeLists.txt -@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS) - foreach(file ${files}) - get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} -- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} -+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir} - COMPONENT cxx-headers - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - ) -@@ -260,7 +260,7 @@ if (LIBCXX_INSTALL_HEADERS) - - # Install the generated header as __config. - install(FILES ${LIBCXX_BINARY_DIR}/__generated_config -- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 -+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1 - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - RENAME __config - COMPONENT cxx-headers) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9965104cb5b2..9b55dbb1d822 100644 +index 87b71f7ba334..d20a783079b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -352,21 +352,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY) +@@ -369,21 +369,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY) install(TARGETS cxx_shared - ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx - LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx -- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) -+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) + ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx + LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx +- RUNTIME DESTINATION bin COMPONENT cxx) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx) endif() if (LIBCXX_INSTALL_STATIC_LIBRARY) install(TARGETS cxx_static - ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx - LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx -- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) -+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) + ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx + LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx +- RUNTIME DESTINATION bin COMPONENT cxx) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx) endif() if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) install(TARGETS cxx_experimental - LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx - ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx -- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx) -+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx) + LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx + ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx +- RUNTIME DESTINATION bin COMPONENT cxx) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx) endif() # NOTE: This install command must go after the cxx install command otherwise diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index 3bb82d651ec7..7fadc6d6dcac 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -1,5 +1,6 @@ { lib, stdenv, llvm_meta, cmake, python3, src, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic +, libcxx }: stdenv.mkDerivation rec { @@ -26,7 +27,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake python3 ]; buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; - cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ + cmakeFlags = [ + "-DLIBCXXABI_LIBCXX_INCLUDES=${libcxx.dev}/include/c++/v1" + ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" ] ++ lib.optionals stdenv.hostPlatform.isWasm [ diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch index b49b1685940f..45641acb0c74 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch +++ b/pkgs/development/compilers/llvm/git/libcxxabi/gnu-install-dirs.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 426c855288fc..a9812a994f53 100644 +index 1e8b73aa38cc..6f7b2a25d205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH @@ -9,26 +9,28 @@ index 426c855288fc..a9812a994f53 100644 + include(GNUInstallDirs) + set(PACKAGE_NAME libcxxabi) - set(PACKAGE_VERSION 11.0.0) + set(PACKAGE_VERSION 11.0.0git) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -@@ -180,17 +182,17 @@ set(CMAKE_MODULE_PATH - +@@ -196,7 +198,7 @@ set(CMAKE_MODULE_PATH if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) - set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) -- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) -+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) + 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}) ++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) - endif() +@@ -204,11 +206,11 @@ 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}) + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX}) else() + set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR}) set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX}) - set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX}) + set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX}) endif() - set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.") + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})