@@ -17,11 +17,13 @@ class Swift < Formula
1717 end
1818
1919 bottle do
20- sha256 cellar : :any , arm64_sonoma : "b2a5609befa41fda88043dfcbe18f28b10f553952c1761c48f958e10a0b0b4cb"
21- sha256 cellar : :any , arm64_ventura : "f99fe506177136aa446dc20c7cd1a6a464e0a54ac867a12a89e7f2947e7ab552"
22- sha256 cellar : :any , sonoma : "9d93e35da28ab6f93542a0ea02d7774d3fba94d13860731af55f40c4f435af7c"
23- sha256 cellar : :any , ventura : "3371b6dd437a89779900003c7a9978c4e5ba76d8e1851844cb465b44813f52f9"
24- sha256 cellar : :any_skip_relocation , x86_64_linux : "0e0d8a584a6377ddb83b362fbd2932a4a396f6db8dd30ae4bc519bcb9f182c8c"
20+ rebuild 1
21+ sha256 cellar : :any , arm64_sequoia : "a32040d74979d5364c75b8d630d149ee13cee52b24e683b009d0a2d577e1e298"
22+ sha256 cellar : :any , arm64_sonoma : "e7b49374fd31cb7cb7088b3e9d25a136dd4937c0522e0d62996284be6acf4e95"
23+ sha256 cellar : :any , arm64_ventura : "086917c9bdbed6e152f67aa8c3cdeaee988fcb95ab93cd43057fac1f7de06f52"
24+ sha256 cellar : :any , sonoma : "64a22002bbe10c05e05a49906eb6866ceb6ee9d049fb2b600b7576c9d6a05f8a"
25+ sha256 cellar : :any , ventura : "77083bae180de55072e3a7d0354af8f56ce9cc1d644879ad7a9817ee975995aa"
26+ sha256 cellar : :any_skip_relocation , x86_64_linux : "92ddf888e22eee066d4335770d89fe96f840cc9de79e15dd614bc455f15d0075"
2527 end
2628
2729 keg_only :provided_by_macos
@@ -35,7 +37,7 @@ class Swift < Formula
3537 # is higher then that is likely why.
3638 depends_on xcode : [ "14.3" , :build ]
3739
38- depends_on "python@3.12 "
40+ depends_on "python@3.13 "
3941
4042 # HACK: this should not be a test dependency but is due to a limitation with fails_with
4143 uses_from_macos "llvm" => [ :build , :test ]
@@ -104,6 +106,20 @@ class Swift < Formula
104106 resource "llvm-project" do
105107 url "https://github.com/swiftlang/llvm-project/archive/refs/tags/swift-6.0.1-RELEASE.tar.gz"
106108 sha256 "8f026177a2378e4fc141e9284a5b4567b92cd50070e29a3eab5cabb8252aa72a"
109+
110+ # Fix copmatibility with macOS 15 SDK.
111+ # Remove with Swift 6.0.3.
112+ patch do
113+ url "https://github.com/swiftlang/llvm-project/commit/a566c12aded130264a1e07e6c1718884ab1d9dc8.patch?full_index=1"
114+ sha256 "6f165b41390051098c0b4ea5bd333c49a7fd93740a015b99db72f096283ae434"
115+ end
116+
117+ # Support Python 3.13.
118+ # Remove with Swift 6.1.
119+ patch do
120+ url "https://github.com/swiftlang/llvm-project/commit/b202bacbaf2be144dfd51d083eb2e4fe687a3803.patch?full_index=1"
121+ sha256 "a7368e3b91a3dc4ebfd78f61e865a621eee37c176ac88bea68f1327151e695cc"
122+ end
107123 end
108124
109125 resource "cmark" do
@@ -270,6 +286,13 @@ class Swift < Formula
270286 sha256 "9ab1f0e347fad651ed5ccadc13d54c4306e6f5cd21908a4ba7d1334278a4cd55"
271287 end
272288
289+ # Fix build with Xcode 16.
290+ # Remove with Swift 6.1 (or earlier if it gets cherry-picked).
291+ patch do
292+ url "https://github.com/swiftlang/swift/commit/c8d7e94fdd2c8ceb276a6dc363861872f13104ba.patch?full_index=1"
293+ sha256 "aa012b9522ddbe92da9ab6a491dd43097b723e7807e813c57edd458f4baf3b12"
294+ end
295+
273296 # Homebrew-specific patch to make the default resource directory use opt rather than Cellar.
274297 # This fixes output binaries from `swiftc` having a runpath pointing to the Cellar.
275298 # This should only be removed if an alternative solution is implemented.
@@ -387,7 +410,7 @@ def install
387410 --swift-include-tests=0
388411 --llvm-include-tests=0
389412 --lldb-configure-tests=0
390- --lldb-extra-cmake-args=-DPython3_EXECUTABLE=#{ which ( "python3.12 " ) }
413+ --lldb-extra-cmake-args=-DPython3_EXECUTABLE=#{ which ( "python3.13 " ) }
391414 --skip-build-benchmarks
392415 --build-swift-private-stdlib=0
393416 --install-swift
@@ -406,6 +429,8 @@ def install
406429 --install-swift-testing-macros
407430 ]
408431
432+ extra_cmake_options << "-DSWIFT_INCLUDE_TEST_BINARIES=OFF"
433+
409434 if OS . mac?
410435 args += %W[
411436 --host-target=macosx-#{ Hardware ::CPU . arch }
@@ -417,10 +442,12 @@ def install
417442 args << "--swift-enable-backtracing=0" if MacOS . version < :sonoma
418443 extra_cmake_options += %W[
419444 -DSWIFT_STANDARD_LIBRARY_SWIFT_FLAGS=-disable-sandbox
420- -DSWIFT_INCLUDE_TEST_BINARIES=OFF
421445 -DLLDB_FRAMEWORK_COPY_SWIFT_RESOURCES=OFF
422- -DCMAKE_INSTALL_RPATH =#{ loader_path }
446+ -DSWIFT_HOST_LIBRARIES_RPATH =#{ loader_path }
423447 ]
448+
449+ ENV . remove "HOMEBREW_LIBRARY_PATHS" , Formula [ "sqlite" ] . opt_lib
450+ ENV . remove "PKG_CONFIG_PATH" , Formula [ "sqlite" ] . opt_lib /"pkgconfig"
424451 end
425452 if OS . linux?
426453 args += %W[
@@ -437,6 +464,8 @@ def install
437464 --install-libdispatch
438465 --install-xctest
439466 ]
467+
468+ # For XCTest (https://github.com/swiftlang/swift-corelibs-xctest/issues/432) and sourcekitd-repl
440469 rpaths = [ loader_path , rpath , rpath ( target : lib /"swift/linux" ) ]
441470 extra_cmake_options << "-DCMAKE_INSTALL_RPATH=#{ rpaths . join ( ":" ) } "
442471
@@ -520,8 +549,8 @@ def caveats
520549
521550 # Test compiler
522551 system bin /"swiftc" , "-module-cache-path" , module_cache , "-v" , "foundation-test.swift" , "-o" , "foundation-test"
523- output = shell_output ( "./foundation-test" )
524- assert_match "www.swift.org\n " , output
552+ output = shell_output ( "./foundation-test 2>&1" ) # check stderr too for dyld errors
553+ assert_equal "www.swift.org\n " , output
525554
526555 # Test Swift Package Manager
527556 ENV [ "SWIFTPM_MODULECACHE_OVERRIDE" ] = module_cache
0 commit comments