blob: 8c24db5aad1d334e62bb35b334f5925916f48dc4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
Swift normally looks for the Clang resource dir in a subdir/symlink of its own
resource dir. We provide a symlink to the Swift build-time Clang as a default
there, but we also here patch a check to try locate it via NIX_CC.
--- a/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
+++ b/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+import Foundation
import SwiftOptions
import protocol TSCBasic.FileSystem
@@ -26,6 +27,13 @@ extension Toolchain {
for targetInfo: FrontendTargetInfo,
parsedOptions: inout ParsedOptions
) throws -> VirtualPath {
+ let env = ProcessInfo.processInfo.environment
+ if let nixCC = env["NIX_CC"] {
+ return try VirtualPath(path: nixCC)
+ .appending(components: "resource-root", "lib",
+ targetInfo.target.triple.platformName(conflatingDarwin: true)!)
+ }
+
return VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
.appending(components: "clang", "lib",
targetInfo.target.triple.platformName(conflatingDarwin: true)!)
|