Loading pkgs/development/compilers/swift/swift-driver/default.nix +1 −10 Original line number Diff line number Diff line Loading @@ -57,16 +57,7 @@ stdenv.mkDerivation { }) ]; configurePhase = generated.configure + '' swiftpmMakeMutable swift-tools-support-core patch -p1 -d .build/checkouts/swift-tools-support-core -i ${ fetchpatch { url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch"; hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE="; includes = [ "Sources/TSCBasic/FileSystem.swift" ]; } } ''; configurePhase = generated.configure; # TODO: Tests depend on indexstore-db being provided by an existing Swift # toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc. Loading pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch +6 −6 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ index a4a735f498..381522cc1f 100644 import SwiftOptions import func TSCBasic.lookupExecutablePath @@ -120,7 +121,18 @@ // just using `clang` and avoid a dependency on the C++ runtime. let clangTool: Tool = parsedOptions.hasArgument(.enableExperimentalCxxInterop) ? .clangxx : .clang @@ -130,7 +131,18 @@ } let clangTool: Tool = cxxCompatEnabled ? .clangxx : .clang - var clangPath = try getToolPath(clangTool) + + // For Nix, prefer linking using the wrapped Nixpkgs clang, instead of using Loading @@ -21,7 +21,7 @@ index a4a735f498..381522cc1f 100644 + // we still want to use it for other purposes (clang importer). + var clangPath: AbsolutePath + if let binPath = try? AbsolutePath(validating: "@clang@/bin"), + let tool = lookupExecutablePath(filename: parsedOptions.hasArgument(.enableExperimentalCxxInterop) + let tool = lookupExecutablePath(filename: cxxCompatEnabled + ? "clang++" : "clang", + searchPaths: [binPath]) { + clangPath = tool Loading @@ -30,7 +30,7 @@ index a4a735f498..381522cc1f 100644 if let toolsDirPath = parsedOptions.getLastArgument(.toolsDirectory) { // FIXME: What if this isn't an absolute path? let toolsDir = try AbsolutePath(validating: toolsDirPath.asSingle) @@ -136,6 +148,7 @@ @@ -146,6 +158,7 @@ commandLine.appendFlag("-B") commandLine.appendPath(toolsDir) } Loading Loading
pkgs/development/compilers/swift/swift-driver/default.nix +1 −10 Original line number Diff line number Diff line Loading @@ -57,16 +57,7 @@ stdenv.mkDerivation { }) ]; configurePhase = generated.configure + '' swiftpmMakeMutable swift-tools-support-core patch -p1 -d .build/checkouts/swift-tools-support-core -i ${ fetchpatch { url = "https://github.com/apple/swift-tools-support-core/commit/990afca47e75cce136d2f59e464577e68a164035.patch"; hash = "sha256-PLzWsp+syiUBHhEFS8+WyUcSae5p0Lhk7SSRdNvfouE="; includes = [ "Sources/TSCBasic/FileSystem.swift" ]; } } ''; configurePhase = generated.configure; # TODO: Tests depend on indexstore-db being provided by an existing Swift # toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc. Loading
pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch +6 −6 Original line number Diff line number Diff line Loading @@ -10,10 +10,10 @@ index a4a735f498..381522cc1f 100644 import SwiftOptions import func TSCBasic.lookupExecutablePath @@ -120,7 +121,18 @@ // just using `clang` and avoid a dependency on the C++ runtime. let clangTool: Tool = parsedOptions.hasArgument(.enableExperimentalCxxInterop) ? .clangxx : .clang @@ -130,7 +131,18 @@ } let clangTool: Tool = cxxCompatEnabled ? .clangxx : .clang - var clangPath = try getToolPath(clangTool) + + // For Nix, prefer linking using the wrapped Nixpkgs clang, instead of using Loading @@ -21,7 +21,7 @@ index a4a735f498..381522cc1f 100644 + // we still want to use it for other purposes (clang importer). + var clangPath: AbsolutePath + if let binPath = try? AbsolutePath(validating: "@clang@/bin"), + let tool = lookupExecutablePath(filename: parsedOptions.hasArgument(.enableExperimentalCxxInterop) + let tool = lookupExecutablePath(filename: cxxCompatEnabled + ? "clang++" : "clang", + searchPaths: [binPath]) { + clangPath = tool Loading @@ -30,7 +30,7 @@ index a4a735f498..381522cc1f 100644 if let toolsDirPath = parsedOptions.getLastArgument(.toolsDirectory) { // FIXME: What if this isn't an absolute path? let toolsDir = try AbsolutePath(validating: toolsDirPath.asSingle) @@ -136,6 +148,7 @@ @@ -146,6 +158,7 @@ commandLine.appendFlag("-B") commandLine.appendPath(toolsDir) } Loading