summary refs log tree commit diff
path: root/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch')
-rw-r--r--pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch b/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
new file mode 100644
index 00000000000..c22b5c820c8
--- /dev/null
+++ b/pkgs/development/compilers/swift/patches/llvm-toolchain-dir.patch
@@ -0,0 +1,24 @@
+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;