nixpkgs/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
Michael Roitzsch 29098a81b3 swift: refactor phases and patch documentation
* simplify versioning
* uniform patch documentation
* reorder phases so they read in order
* reorder scripts for readability
* GNU toolchain dir:
  handle sysroot for GNU toolchain like for C headers, so that
  GCC_INSTALL_PREFIX is actually used correctly
2020-01-15 13:19:35 +01:00

25 lines
1 KiB
Diff

Use the Nix include dirs and gcc runtime dir, when no sysroot is configured.
--- clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:01:15.731109551 +0200
+++ clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:00:27.959509924 +0200
@@ -665,7 +665,7 @@
// Check for configure-time C include directories.
StringRef CIncludeDirs(C_INCLUDE_DIRS);
- if (CIncludeDirs != "") {
+ if (CIncludeDirs != "" && (SysRoot.empty() || SysRoot == "/")) {
SmallVector<StringRef, 5> dirs;
CIncludeDirs.split(dirs, ":");
for (StringRef dir : dirs) {
--- clang/lib/Driver/ToolChains/Gnu.cpp 2019-10-26 09:49:27.003752743 +0200
+++ clang/lib/Driver/ToolChains/Gnu.cpp 2019-10-26 09:50:49.067236497 +0200
@@ -1743,7 +1743,7 @@
// If we have a SysRoot, ignore GCC_INSTALL_PREFIX.
// GCC_INSTALL_PREFIX specifies the gcc installation for the default
// sysroot and is likely not valid with a different sysroot.
- if (!SysRoot.empty())
+ if (!(SysRoot.empty() || SysRoot == "/"))
return "";
return GCC_INSTALL_PREFIX;