Skip to content

Commit

Permalink
swift: fix build with LLVM 15
Browse files Browse the repository at this point in the history
See here for context: #213202 (comment)
  • Loading branch information
rrbutani authored and RaitoBezarius committed Apr 16, 2023
1 parent 0ecb762 commit fc726d5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pkgs/development/compilers/swift/compiler/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,17 @@ in stdenv.mkDerivation {
sha256 = "1rma1al0rbm3s3ql6bnvbcighp74lri1lcrwbyacgdqp80fgw1b6";
}}
${lib.optionalString (!stdenv.isDarwin) ''
# Needed to build with clang 15+ without disabling warnings; can drop this
# once we update to 5.8.x.
patch -p1 -d swift-corelibs-libdispatch -i ${fetchpatch {
name = "swift-corelibs-libdispatch-fix-unused-but-set-warning";
url = "https://github.com/apple/swift-corelibs-libdispatch/commit/915f25141a7c57b6a2a3bc8697572644af181ec5.patch";
sha256 = "sha256-gxhMwSlE/y4LkOvmCaDMPjd7EcoX6xaacK4MLa3mOUM=";
includes = ["src/shims/yield.c"];
}}
''}
${lib.optionalString stdenv.isLinux ''
substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \
--replace 'SysRoot + "/lib' '"${glibc}/lib" "' \
Expand Down
14 changes: 13 additions & 1 deletion pkgs/development/compilers/swift/libdispatch/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, callPackage
, fetchpatch
, cmake
, ninja
, useSwift ? true, swift
Expand All @@ -19,7 +20,18 @@ in stdenv.mkDerivation {
nativeBuildInputs = [ cmake ]
++ lib.optionals useSwift [ ninja swift ];

patches = [ ./disable-swift-overlay.patch ];
patches = [
./disable-swift-overlay.patch

# Needed to build with clang 15+ without disabling warnings; can drop this
# once we update to 5.8.x.
(fetchpatch {
name = "swift-corelibs-libdispatch-fix-unused-but-set-warning";
url = "https://github.com/apple/swift-corelibs-libdispatch/commit/915f25141a7c57b6a2a3bc8697572644af181ec5.patch";
sha256 = "sha256-gxhMwSlE/y4LkOvmCaDMPjd7EcoX6xaacK4MLa3mOUM=";
includes = ["src/shims/yield.c"];
})
];

cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";

Expand Down

0 comments on commit fc726d5

Please sign in to comment.