about summary refs log tree commit diff
path: root/pkgs/development/compilers/swift/swift-driver
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/swift/swift-driver')
-rw-r--r--pkgs/development/compilers/swift/swift-driver/default.nix84
-rw-r--r--pkgs/development/compilers/swift/swift-driver/generated/default.nix11
-rw-r--r--pkgs/development/compilers/swift/swift-driver/generated/workspace-state.json93
-rw-r--r--pkgs/development/compilers/swift/swift-driver/patches/disable-catalyst.patch17
-rw-r--r--pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch40
-rw-r--r--pkgs/development/compilers/swift/swift-driver/patches/nix-resource-root.patch28
-rw-r--r--pkgs/development/compilers/swift/swift-driver/patches/prevent-sdk-dirs-warnings.patch16
7 files changed, 0 insertions, 289 deletions
diff --git a/pkgs/development/compilers/swift/swift-driver/default.nix b/pkgs/development/compilers/swift/swift-driver/default.nix
deleted file mode 100644
index 3245fa1d8787..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/default.nix
+++ /dev/null
@@ -1,84 +0,0 @@
-{ lib
-, stdenv
-, callPackage
-, fetchpatch
-, swift
-, swiftpm
-, swiftpm2nix
-, Foundation
-, XCTest
-, sqlite
-, ncurses
-, substituteAll
-}:
-let
-  sources = callPackage ../sources.nix { };
-  generated = swiftpm2nix.helpers ./generated;
-
-  # On Darwin, we only want ncurses in the linker search path, because headers
-  # are part of libsystem. Adding its headers to the search path causes strange
-  # mixing and errors.
-  # TODO: Find a better way to prevent this conflict.
-  ncursesInput = if stdenv.isDarwin then ncurses.out else ncurses;
-in
-stdenv.mkDerivation {
-  pname = "swift-driver";
-
-  inherit (sources) version;
-  src = sources.swift-driver;
-
-  nativeBuildInputs = [ swift swiftpm ];
-  buildInputs = [
-    Foundation
-    XCTest
-    sqlite
-    ncursesInput
-  ];
-
-  patches = [
-    ./patches/nix-resource-root.patch
-    ./patches/disable-catalyst.patch
-    ./patches/linux-fix-linking.patch
-    # TODO: Replace with branch patch once merged:
-    # https://github.com/apple/swift-driver/pull/1197
-    (fetchpatch {
-      url = "https://github.com/apple/swift-driver/commit/d3ef9cdf4871a58eddec7ff0e28fe611130da3f9.patch";
-      hash = "sha256-eVBaKN6uzj48ZnHtwGV0k5ChKjak1tDCyE+wTdyGq2c=";
-    })
-    # Prevent a warning about SDK directories we don't have.
-    (substituteAll {
-      src = ./patches/prevent-sdk-dirs-warnings.patch;
-      inherit (builtins) storeDir;
-    })
-  ];
-
-  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" ];
-    }}
-  '';
-
-  # TODO: Tests depend on indexstore-db being provided by an existing Swift
-  # toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.
-  #doCheck = true;
-
-  # TODO: Darwin-specific installation includes more, but not sure why.
-  installPhase = ''
-    binPath="$(swiftpmBinPath)"
-    mkdir -p $out/bin
-    for executable in swift-driver swift-help swift-build-sdk-interfaces; do
-      cp $binPath/$executable $out/bin/
-    done
-  '';
-
-  meta = {
-    description = "Swift compiler driver";
-    homepage = "https://github.com/apple/swift-driver";
-    platforms = with lib.platforms; linux ++ darwin;
-    license = lib.licenses.asl20;
-    maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
-  };
-}
diff --git a/pkgs/development/compilers/swift/swift-driver/generated/default.nix b/pkgs/development/compilers/swift/swift-driver/generated/default.nix
deleted file mode 100644
index cb6f3cca078e..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/generated/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file was generated by swiftpm2nix.
-{
-  workspaceStateFile = ./workspace-state.json;
-  hashes = {
-    "swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
-    "swift-llbuild" = "106vnssh6pgy5s9dnq1hi1c9v2wkfydqgncg5dy7c9n23iisjy3s";
-    "swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
-    "swift-tools-support-core" = "1qvblyiazv58qwyxgyk2dh5ymbab3y70vm2q81qs6rmv43hs8ciz";
-    "Yams" = "11abhcfkmqm3cmh7vp7rqzvxd1zj02j2866a2pp6v9m89456xb76";
-  };
-}
diff --git a/pkgs/development/compilers/swift/swift-driver/generated/workspace-state.json b/pkgs/development/compilers/swift/swift-driver/generated/workspace-state.json
deleted file mode 100644
index 09f0b7398d97..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/generated/workspace-state.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
-  "object": {
-    "artifacts": [],
-    "dependencies": [
-      {
-        "basedOn": null,
-        "packageRef": {
-          "identity": "swift-argument-parser",
-          "kind": "remoteSourceControl",
-          "location": "https://github.com/apple/swift-argument-parser.git",
-          "name": "swift-argument-parser"
-        },
-        "state": {
-          "checkoutState": {
-            "revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
-            "version": "1.0.3"
-          },
-          "name": "sourceControlCheckout"
-        },
-        "subpath": "swift-argument-parser"
-      },
-      {
-        "basedOn": null,
-        "packageRef": {
-          "identity": "swift-llbuild",
-          "kind": "remoteSourceControl",
-          "location": "https://github.com/apple/swift-llbuild.git",
-          "name": "llbuild"
-        },
-        "state": {
-          "checkoutState": {
-            "branch": "release/5.8",
-            "revision": "dccfc2e127a34b89a849407594cf2d604b598ba9"
-          },
-          "name": "sourceControlCheckout"
-        },
-        "subpath": "swift-llbuild"
-      },
-      {
-        "basedOn": null,
-        "packageRef": {
-          "identity": "swift-system",
-          "kind": "remoteSourceControl",
-          "location": "https://github.com/apple/swift-system.git",
-          "name": "swift-system"
-        },
-        "state": {
-          "checkoutState": {
-            "revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
-            "version": "1.1.1"
-          },
-          "name": "sourceControlCheckout"
-        },
-        "subpath": "swift-system"
-      },
-      {
-        "basedOn": null,
-        "packageRef": {
-          "identity": "swift-tools-support-core",
-          "kind": "remoteSourceControl",
-          "location": "https://github.com/apple/swift-tools-support-core.git",
-          "name": "swift-tools-support-core"
-        },
-        "state": {
-          "checkoutState": {
-            "branch": "release/5.8",
-            "revision": "ac4871e01ef338cb95b5d28328cab0ec1dfae935"
-          },
-          "name": "sourceControlCheckout"
-        },
-        "subpath": "swift-tools-support-core"
-      },
-      {
-        "basedOn": null,
-        "packageRef": {
-          "identity": "yams",
-          "kind": "remoteSourceControl",
-          "location": "https://github.com/jpsim/Yams.git",
-          "name": "Yams"
-        },
-        "state": {
-          "checkoutState": {
-            "revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6",
-            "version": "5.0.1"
-          },
-          "name": "sourceControlCheckout"
-        },
-        "subpath": "Yams"
-      }
-    ]
-  },
-  "version": 6
-}
diff --git a/pkgs/development/compilers/swift/swift-driver/patches/disable-catalyst.patch b/pkgs/development/compilers/swift/swift-driver/patches/disable-catalyst.patch
deleted file mode 100644
index b9eb23f21061..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/patches/disable-catalyst.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Tries to parse SDKSettings.plist looking for a Catalyst version map, but we
-don't currently support this.
-
---- a/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
-+++ b/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
-@@ -297,11 +297,7 @@ public final class DarwinToolchain: Toolchain {
-                                                debugDescription: "Malformed version string")
-       }
-       self.version = version
--      if self.canonicalName.hasPrefix("macosx") {
--        self.versionMap = try keyedContainer.decode(VersionMap.self, forKey: .versionMap)
--      } else {
-         self.versionMap = VersionMap()
--      }
-     }
- 
- 
diff --git a/pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch b/pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch
deleted file mode 100644
index 8f91b3a234b5..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/patches/linux-fix-linking.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
-+++ b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
-@@ -10,6 +10,7 @@
- //
- //===----------------------------------------------------------------------===//
- 
-+import Foundation
- import SwiftOptions
- 
- import func TSCBasic.lookupExecutablePath
-@@ -120,7 +121,20 @@ extension GenericUnixToolchain {
-       // just using `clang` and avoid a dependency on the C++ runtime.
-       let clangTool: Tool =
-         parsedOptions.hasArgument(.enableExperimentalCxxInterop) ? .clangxx : .clang
--      var clangPath = try getToolPath(clangTool)
-+
-+      // For Nix, prefer linking using the wrapped system clang, instead of using
-+      // the unwrapped clang packaged with swift. The latter is unable to link, but
-+      // we still want to use it for other purposes (clang importer).
-+      var clangPath: AbsolutePath
-+      let env = ProcessInfo.processInfo.environment
-+      if let nixCC = env["NIX_CC"],
-+         let binPath = try? AbsolutePath(validating: "\(nixCC)/bin"),
-+         let tool = lookupExecutablePath(filename: parsedOptions.hasArgument(.enableExperimentalCxxInterop)
-+                                                        ? "clang++" : "clang",
-+                                         searchPaths: [binPath]) {
-+        clangPath = tool
-+      } else {
-+      clangPath = try getToolPath(clangTool)
-       if let toolsDirPath = parsedOptions.getLastArgument(.toolsDirectory) {
-         // FIXME: What if this isn't an absolute path?
-         let toolsDir = try AbsolutePath(validating: toolsDirPath.asSingle)
-@@ -136,6 +150,7 @@ extension GenericUnixToolchain {
-         commandLine.appendFlag("-B")
-         commandLine.appendPath(toolsDir)
-       }
-+      } // nixCC
- 
-       // Executables on Linux get -pie
-       if targetTriple.os == .linux && linkerOutputType == .executable {
diff --git a/pkgs/development/compilers/swift/swift-driver/patches/nix-resource-root.patch b/pkgs/development/compilers/swift/swift-driver/patches/nix-resource-root.patch
deleted file mode 100644
index 8c24db5aad1d..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/patches/nix-resource-root.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-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)!)
diff --git a/pkgs/development/compilers/swift/swift-driver/patches/prevent-sdk-dirs-warnings.patch b/pkgs/development/compilers/swift/swift-driver/patches/prevent-sdk-dirs-warnings.patch
deleted file mode 100644
index 6080865ebe37..000000000000
--- a/pkgs/development/compilers/swift/swift-driver/patches/prevent-sdk-dirs-warnings.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Prevents a user-visible warning on every compilation:
-
-  ld: warning: directory not found for option '-L.../MacOSX11.0.sdk/usr/lib/swift'
-
---- a/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
-+++ b/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
-@@ -50,7 +50,9 @@ extension Toolchain {
-         result.append(sdkPath.appending(components: "System", "iOSSupport", "usr", "lib", "swift"))
-       }
- 
-+      if sdkPath.absolutePath?.pathString.starts(with: "@storeDir@") == false {
-       result.append(sdkPath.appending(components: "usr", "lib", "swift"))
-+      }
-     }
- 
-     return result