diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/13')
6 files changed, 104 insertions, 286 deletions
diff --git a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix index b6a9c13ba943..3c83e4e58a17 100644 --- a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, llvm_meta, version, src -, cmake, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt +, cmake, python3, xcbuild, libllvm, linuxHeaders, libxcrypt , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD }: @@ -22,8 +22,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake python3 libllvm.dev ] ++ lib.optional stdenv.isDarwin xcbuild.xcrun; buildInputs = - lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders - ++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi; + lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders; env.NIX_CFLAGS_COMPILE = toString [ "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0" @@ -120,6 +119,7 @@ stdenv.mkDerivation { meta = llvm_meta // { homepage = "https://compiler-rt.llvm.org/"; description = "Compiler runtime libraries"; + mainProgram = "hwasan_symbolize"; longDescription = '' The compiler-rt project provides highly tuned implementations of the low-level code generator support routines like "__fixunsdfdi" and other diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index c811b24c48ef..cd96231e62c3 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -137,7 +137,6 @@ in let cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; extraPackages = [ - libcxx.cxxabi targetLlvmLibraries.compiler-rt ]; extraBuildCommands = mkExtraBuildCommands cc; @@ -203,7 +202,6 @@ in let libcxx = targetLlvmLibraries.libcxx; bintools = bintools'; extraPackages = [ - libcxx.cxxabi targetLlvmLibraries.compiler-rt ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [ targetLlvmLibraries.libunwind @@ -297,28 +295,8 @@ in let libcxx = callPackage ./libcxx { inherit llvm_meta; - stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.clangNoLibcxx - else ( - # libcxx >= 13 does not build on gcc9 - if stdenv.cc.isGNU && lib.versionOlder stdenv.cc.version "10" - then pkgs.gcc10Stdenv - else stdenv - ); - }; - - libcxxabi = let - stdenv_ = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.clangNoLibcxx - else stdenv; - cxx-headers = callPackage ./libcxx { - inherit llvm_meta; - stdenv = stdenv_; - headersOnly = true; - }; - in callPackage ./libcxxabi { - stdenv = stdenv_; - inherit llvm_meta cxx-headers; + stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx; + monorepoSrc = src; }; libunwind = callPackage ./libunwind { diff --git a/pkgs/development/compilers/llvm/13/libcxx/default.nix b/pkgs/development/compilers/llvm/13/libcxx/default.nix index 2974fc80e191..b39b4f37ff1c 100644 --- a/pkgs/development/compilers/llvm/13/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxx/default.nix @@ -1,80 +1,124 @@ -{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version -, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi -, libcxxabi, libcxxrt +{ lib, stdenv, llvm_meta +, monorepoSrc, runCommand, substitute +, cmake, lndir, ninja, python3, fixDarwinDylibNames, version +, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null +, libcxxrt, libunwind , enableShared ? !stdenv.hostPlatform.isStatic - -# If headersOnly is true, the resulting package would only include the headers. -# Use this to break the circular dependency between libcxx and libcxxabi. -# -# Some context: -# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb -, headersOnly ? false }: -assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi"; +# external cxxabi is not supported on Darwin as the build will not link libcxx +# properly and not re-export the cxxabi symbols into libcxx +# https://github.com/NixOS/nixpkgs/issues/166205 +# https://github.com/NixOS/nixpkgs/issues/269548 +assert cxxabi == null || !stdenv.hostPlatform.isDarwin; +let + basename = "libcxx"; + cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}"; + runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi"; + + # Note: useLLVM is likely false for Darwin but true under pkgsLLVM + useLLVM = stdenv.hostPlatform.useLLVM or false; + + cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ + "-DLIBCXXABI_USE_COMPILER_RT=ON" + "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" + ] ++ lib.optionals stdenv.hostPlatform.isWasm [ + "-DLIBCXXABI_ENABLE_THREADS=OFF" + "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" + ] ++ lib.optionals (!enableShared) [ + "-DLIBCXXABI_ENABLE_SHARED=OFF" + ]; + + cxxCMakeFlags = [ + "-DLIBCXX_CXX_ABI=${cxxabiName}" + ] ++ lib.optionals (cxxabi != null) [ + "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include" + ] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [ + "-DLIBCXX_HAS_MUSL_LIBC=1" + ] ++ lib.optionals useLLVM [ + "-DLIBCXX_USE_COMPILER_RT=ON" + ] ++ lib.optionals stdenv.hostPlatform.isWasm [ + "-DLIBCXX_ENABLE_THREADS=OFF" + "-DLIBCXX_ENABLE_FILESYSTEM=OFF" + "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" + ] ++ lib.optionals (!enableShared) [ + "-DLIBCXX_ENABLE_SHARED=OFF" + ]; + + cmakeFlags = [ + "-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}" + ] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ + # libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib, + # but that does not appear to be the case for example when building + # pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc). + "-DCMAKE_EXE_LINKER_FLAGS=-nostdlib" + "-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib" + ] ++ lib.optionals stdenv.hostPlatform.isWasm [ + "-DCMAKE_C_COMPILER_WORKS=ON" + "-DCMAKE_CXX_COMPILER_WORKS=ON" + "-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker + ] ++ cxxCMakeFlags + ++ lib.optionals (cxxabi == null) cxxabiCMakeFlags; + +in stdenv.mkDerivation rec { - pname = if headersOnly then "cxx-headers" else "libcxx"; - inherit version; + pname = basename; + inherit version cmakeFlags; - inherit src; - sourceRoot = "${src.name}/libcxx"; + src = runCommand "${pname}-src-${version}" {} ('' + mkdir -p "$out/llvm" + cp -r ${monorepoSrc}/libcxx "$out" + cp -r ${monorepoSrc}/llvm/cmake "$out/llvm" + cp -r ${monorepoSrc}/llvm/utils "$out/llvm" + cp -r ${monorepoSrc}/runtimes "$out" + '' + lib.optionalString (cxxabi == null) '' + cp -r ${monorepoSrc}/libcxxabi "$out" + ''); - outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev"; + outputs = [ "out" "dev" ]; patches = [ - ./gnu-install-dirs.patch + (substitute { + src = ../../common/libcxxabi/wasm.patch; + replacements = [ + "--replace-fail" "/cmake/" "/llvm/cmake/" + ]; + }) ] ++ lib.optionals stdenv.hostPlatform.isMusl [ - ../../common/libcxx/libcxx-0001-musl-hacks.patch + (substitute { + src = ../../common/libcxx/libcxx-0001-musl-hacks.patch; + replacements = [ + "--replace-fail" "/include/" "/libcxx/include/" + ]; + }) ]; + postPatch = '' + cd runtimes + ''; + preConfigure = lib.optionalString stdenv.hostPlatform.isMusl '' patchShebangs utils/cat_files.py ''; - nativeBuildInputs = [ cmake python3 ] - ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + nativeBuildInputs = [ cmake ninja python3 ] + ++ lib.optional stdenv.isDarwin fixDarwinDylibNames + ++ lib.optional (cxxabi != null) lndir; - buildInputs = lib.optionals (!headersOnly) [ cxxabi ]; + buildInputs = [ cxxabi ] + ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ]; - cmakeFlags = [ "-DLIBCXX_CXX_ABI=${cxxabi.pname}" ] - ++ 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.optionals stdenv.hostPlatform.isWasm [ - "-DLIBCXX_ENABLE_THREADS=OFF" - "-DLIBCXX_ENABLE_FILESYSTEM=OFF" - "-DLIBCXX_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"; - - buildFlags = lib.optional headersOnly "generate-cxx-headers"; - installTargets = lib.optional headersOnly "install-cxx-headers"; - - preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) '' - for file in lib/*.dylib; do - if [ -L "$file" ]; then continue; fi - - baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1)) - installName="$out/lib/$baseName" - abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/') - - for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do - ${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file - done - done - ''; - - # 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 + # libc++.so is a linker script which expands to multiple libraries, + # libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't + # support linker scripts so the external cxxabi needs to be symlinked in + postInstall = lib.optionalString (cxxabi != null) '' + lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1 + lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib ''; passthru = { isLLVM = true; - inherit cxxabi; }; meta = llvm_meta // { @@ -84,7 +128,6 @@ stdenv.mkDerivation rec { libc++ is an implementation of the C++ standard library, targeting C++11, C++14 and above. ''; - # "All of the code in libc++ is dual licensed under the MIT license and the # UIUC License (a BSD-like license)": license = with lib.licenses; [ mit ncsa ]; diff --git a/pkgs/development/compilers/llvm/13/libcxx/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/13/libcxx/gnu-install-dirs.patch deleted file mode 100644 index 744967a6ee0b..000000000000 --- a/pkgs/development/compilers/llvm/13/libcxx/gnu-install-dirs.patch +++ /dev/null @@ -1,82 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b1e25358d41a..7fe1f4d85401 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -26,6 +26,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") - if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD) - project(libcxx CXX C) - -+ include(GNUInstallDirs) -+ - set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 13.0.0git) - set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -@@ -412,7 +414,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_INCLUDE_DIR "include/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") -@@ -426,7 +428,7 @@ 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_INCLUDE_DIR "include/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") -@@ -436,7 +438,7 @@ else() - set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) - 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} 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_INCLUDE_DIR "include/c++/v1" CACHE PATH - "Path where target-agnostic libc++ headers should be installed.") -diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake -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 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/src/CMakeLists.txt b/src/CMakeLists.txt -index 496429f3841e..1a0c9c0a3159 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -376,21 +376,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY) - install(TARGETS cxx_shared - 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_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_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/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix deleted file mode 100644 index 50f09831e974..000000000000 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ lib, stdenv, llvm_meta, cmake, python3, src, cxx-headers, libunwind, version -, enableShared ? !stdenv.hostPlatform.isStatic -, standalone ? stdenv.hostPlatform.useLLVM or false -, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm -}: - -stdenv.mkDerivation rec { - pname = "libcxxabi"; - inherit version; - - inherit src; - sourceRoot = "${src.name}/${pname}"; - - outputs = [ "out" "dev" ]; - - postUnpack = lib.optionalString stdenv.isDarwin '' - export TRIPLE=x86_64-apple-darwin - '' + lib.optionalString stdenv.hostPlatform.isWasm '' - patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch} - ''; - - patches = [ - ./gnu-install-dirs.patch - ]; - - nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional withLibunwind libunwind; - - cmakeFlags = [ - "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" - ] ++ lib.optionals standalone [ - "-DLLVM_ENABLE_LIBCXX=ON" - ] ++ lib.optionals (standalone && withLibunwind) [ - "-DLIBCXXABI_USE_LLVM_UNWINDER=ON" - ] ++ lib.optionals stdenv.hostPlatform.isWasm [ - "-DLIBCXXABI_ENABLE_THREADS=OFF" - "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF" - ] ++ lib.optionals (!enableShared) [ - "-DLIBCXXABI_ENABLE_SHARED=OFF" - ]; - - preInstall = lib.optionalString stdenv.isDarwin '' - for file in lib/*.dylib; do - if [ -L "$file" ]; then continue; fi - - # Fix up the install name. Preserve the basename, just replace the path. - installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))" - - # this should be done in CMake, but having trouble figuring out - # the magic combination of necessary CMake variables - # if you fancy a try, take a look at - # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling - ${stdenv.cc.targetPrefix}install_name_tool -id $installName $file - - # cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes - # libcxxabi to sometimes link against a different version of itself. - # Here we simply make that second reference point to ourselves. - for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do - ${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file - done - done - ''; - - postInstall = '' - mkdir -p "$dev/include" - install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include" - ''; - - passthru = { - libName = "c++abi"; - }; - - meta = llvm_meta // { - homepage = "https://libcxxabi.llvm.org/"; - description = "Provides C++ standard library support"; - longDescription = '' - libc++abi is a new implementation of low level support for a standard C++ library. - ''; - # "All of the code in libc++abi is dual licensed under the MIT license and - # the UIUC License (a BSD-like license)": - license = with lib.licenses; [ mit ncsa ]; - maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ]; - }; -} diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/13/libcxxabi/gnu-install-dirs.patch deleted file mode 100644 index 5d562dd59a99..000000000000 --- a/pkgs/development/compilers/llvm/13/libcxxabi/gnu-install-dirs.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9fb35860d483..5739d9e8af62 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH - if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD) - project(libcxxabi CXX C) - -+ include(GNUInstallDirs) -+ - set(PACKAGE_NAME libcxxabi) - set(PACKAGE_VERSION 11.0.0git) - set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -@@ -195,7 +197,7 @@ set(CMAKE_MODULE_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.") - if(LIBCXX_LIBDIR_SUBDIR) - string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR}) -@@ -204,12 +206,12 @@ 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.") - 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} CACHE PATH -+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH - "Path where built libc++abi libraries should be installed.") - endif() - |