diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/swift')
9 files changed, 155 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/compilers/swift/compiler/default.nix b/nixpkgs/pkgs/development/compilers/swift/compiler/default.nix index 30fb18db8fd2..76c2da0a656a 100644 --- a/nixpkgs/pkgs/development/compilers/swift/compiler/default.nix +++ b/nixpkgs/pkgs/development/compilers/swift/compiler/default.nix @@ -311,6 +311,13 @@ in stdenv.mkDerivation { sha256 = "1rma1al0rbm3s3ql6bnvbcighp74lri1lcrwbyacgdqp80fgw1b6"; }} + # gcc-13 build fixes + patch -p2 -d llvm-project/llvm -i ${fetchpatch { + name = "gcc-13.patch"; + url = "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch"; + hash = "sha256-nkRPWx8gNvYr7mlvEUiOAb1rTrf+skCZjAydJVUHrcI="; + }} + ${lib.optionalString stdenv.isLinux '' substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \ --replace 'SysRoot + "/lib' '"${glibc}/lib" "' \ diff --git a/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/default.nix b/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/default.nix index 5cf928dc424b..caba3e3441f3 100644 --- a/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/default.nix +++ b/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/default.nix @@ -40,6 +40,9 @@ stdenv.mkDerivation { swiftpmMakeMutable indexstore-db patch -p1 -d .build/checkouts/indexstore-db -i ${./patches/indexstore-db-macos-target.patch} + swiftpmMakeMutable swift-tools-support-core + patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch} + # This toggles a section specific to Xcode XCTest, which doesn't work on # Darwin, where we also use swift-corelibs-xctest. substituteInPlace Sources/LSPTestSupport/PerfTestCase.swift \ diff --git a/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch b/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch new file mode 100644 index 000000000000..a2f2d38c37c8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch @@ -0,0 +1,33 @@ +From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev <paveloom@riseup.net> +Date: Tue, 21 Nov 2023 20:53:33 +0300 +Subject: [PATCH] Force-unwrap file handles. + +--- + Sources/TSCBasic/FileSystem.swift | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift +index 3a63bdf..a1f3d9d 100644 +--- a/Sources/TSCBasic/FileSystem.swift ++++ b/Sources/TSCBasic/FileSystem.swift +@@ -425,7 +425,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Read the data one block at a time. + let data = BufferedOutputByteStream() +@@ -455,7 +455,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Write the data in one chunk. + var contents = bytes.contents +-- +2.42.0 diff --git a/nixpkgs/pkgs/development/compilers/swift/swift-driver/default.nix b/nixpkgs/pkgs/development/compilers/swift/swift-driver/default.nix index 60fe2aeb9c92..d69a4da0eb3e 100644 --- a/nixpkgs/pkgs/development/compilers/swift/swift-driver/default.nix +++ b/nixpkgs/pkgs/development/compilers/swift/swift-driver/default.nix @@ -52,7 +52,10 @@ stdenv.mkDerivation { }) ]; - configurePhase = generated.configure; + configurePhase = generated.configure + '' + swiftpmMakeMutable swift-tools-support-core + patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch} + ''; # TODO: Tests depend on indexstore-db being provided by an existing Swift # toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc. diff --git a/nixpkgs/pkgs/development/compilers/swift/swift-driver/patches/force-unwrap-file-handles.patch b/nixpkgs/pkgs/development/compilers/swift/swift-driver/patches/force-unwrap-file-handles.patch new file mode 100644 index 000000000000..a2f2d38c37c8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/swift/swift-driver/patches/force-unwrap-file-handles.patch @@ -0,0 +1,33 @@ +From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev <paveloom@riseup.net> +Date: Tue, 21 Nov 2023 20:53:33 +0300 +Subject: [PATCH] Force-unwrap file handles. + +--- + Sources/TSCBasic/FileSystem.swift | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift +index 3a63bdf..a1f3d9d 100644 +--- a/Sources/TSCBasic/FileSystem.swift ++++ b/Sources/TSCBasic/FileSystem.swift +@@ -425,7 +425,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Read the data one block at a time. + let data = BufferedOutputByteStream() +@@ -455,7 +455,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Write the data in one chunk. + var contents = bytes.contents +-- +2.42.0 diff --git a/nixpkgs/pkgs/development/compilers/swift/swift-format/default.nix b/nixpkgs/pkgs/development/compilers/swift/swift-format/default.nix index d68801aac6e2..2f7e630e6804 100644 --- a/nixpkgs/pkgs/development/compilers/swift/swift-format/default.nix +++ b/nixpkgs/pkgs/development/compilers/swift/swift-format/default.nix @@ -19,7 +19,10 @@ stdenv.mkDerivation { nativeBuildInputs = [ swift swiftpm ]; buildInputs = [ Foundation ]; - configurePhase = generated.configure; + configurePhase = generated.configure + '' + swiftpmMakeMutable swift-tools-support-core + patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch} + ''; # We only install the swift-format binary, so don't need the other products. swiftpmFlags = [ "--product swift-format" ]; diff --git a/nixpkgs/pkgs/development/compilers/swift/swift-format/patches/force-unwrap-file-handles.patch b/nixpkgs/pkgs/development/compilers/swift/swift-format/patches/force-unwrap-file-handles.patch new file mode 100644 index 000000000000..a2f2d38c37c8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/swift/swift-format/patches/force-unwrap-file-handles.patch @@ -0,0 +1,33 @@ +From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev <paveloom@riseup.net> +Date: Tue, 21 Nov 2023 20:53:33 +0300 +Subject: [PATCH] Force-unwrap file handles. + +--- + Sources/TSCBasic/FileSystem.swift | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift +index 3a63bdf..a1f3d9d 100644 +--- a/Sources/TSCBasic/FileSystem.swift ++++ b/Sources/TSCBasic/FileSystem.swift +@@ -425,7 +425,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Read the data one block at a time. + let data = BufferedOutputByteStream() +@@ -455,7 +455,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Write the data in one chunk. + var contents = bytes.contents +-- +2.42.0 diff --git a/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix b/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix index e98d82d0d796..4a7a4ab63cce 100644 --- a/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix +++ b/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix @@ -199,6 +199,10 @@ let name = "swift-tools-support-core"; src = generated.sources.swift-tools-support-core; + patches = [ + ./patches/force-unwrap-file-handles.patch + ]; + buildInputs = [ swift-system sqlite @@ -385,6 +389,7 @@ in stdenv.mkDerivation (commonAttrs // { swiftpmMakeMutable swift-tools-support-core substituteInPlace .build/checkouts/swift-tools-support-core/Sources/TSCTestSupport/XCTestCasePerf.swift \ --replace 'canImport(Darwin)' 'false' + patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch} # Prevent a warning about SDK directories we don't have. swiftpmMakeMutable swift-driver diff --git a/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch b/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch new file mode 100644 index 000000000000..a2f2d38c37c8 --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch @@ -0,0 +1,33 @@ +From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev <paveloom@riseup.net> +Date: Tue, 21 Nov 2023 20:53:33 +0300 +Subject: [PATCH] Force-unwrap file handles. + +--- + Sources/TSCBasic/FileSystem.swift | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift +index 3a63bdf..a1f3d9d 100644 +--- a/Sources/TSCBasic/FileSystem.swift ++++ b/Sources/TSCBasic/FileSystem.swift +@@ -425,7 +425,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Read the data one block at a time. + let data = BufferedOutputByteStream() +@@ -455,7 +455,7 @@ private class LocalFileSystem: FileSystem { + if fp == nil { + throw FileSystemError(errno: errno, path) + } +- defer { fclose(fp) } ++ defer { fclose(fp!) } + + // Write the data in one chunk. + var contents = bytes.contents +-- +2.42.0 |