Skip to content

Commit

Permalink
Merge pull request #157113 from razvanazamfirei/bump-swift-5.9.2
Browse files Browse the repository at this point in the history
swift 5.9.2
  • Loading branch information
BrewTestBot authored Feb 22, 2024
2 parents 5f710b8 + 21c3194 commit d443fa4
Showing 1 changed file with 111 additions and 96 deletions.
207 changes: 111 additions & 96 deletions Formula/s/swift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ class Swift < Formula
desc "High-performance system programming language"
homepage "https://www.swift.org"
# NOTE: Keep version in sync with resources below
url "https://github.com/apple/swift/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "f65381a9dfea4579323e5aff04d4224f2d8f505fcc6e3e83022e734d4f54575f"
url "https://github.com/apple/swift/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "5b93c737c24ba7d861e0777800740eaa9ccddfa2a6a4326bd47dbc5aa9ae8379"
license "Apache-2.0"
revision 1

# This uses the `GithubLatest` strategy because a `-RELEASE` tag is often
# created several days before the version is officially released.
Expand All @@ -18,24 +17,25 @@ class Swift < Formula
end

bottle do
sha256 cellar: :any, arm64_ventura: "35b2ce7246acacfeea4a7a377c865c9185e059eeb0d5a3d39133cbf13021963c"
sha256 cellar: :any, arm64_monterey: "914cd349b8f0cb6f0c2c984f606a744a431f874f22a670f4d04b8249ed3819f7"
sha256 cellar: :any, arm64_big_sur: "2e165fd763a602bce118aaae3a92d7edf719c61de8ad41aeccad553d6df8da73"
sha256 cellar: :any, ventura: "b89f0ae6fc3736acb146fc6f91e500c1a044d6ee0947475c20b22326abdacbe5"
sha256 cellar: :any, monterey: "dc265ad2bdf088e34bd9d0ca826ccf59ede6a5538d4fd485908e3e7ec467b728"
sha256 cellar: :any, big_sur: "6db009f0cedd51ed5355046870ec843b2c9a71eb5c37b41d0b4bfcb23cc024f8"
sha256 cellar: :any_skip_relocation, x86_64_linux: "5856963e79848044fa78280760a45bfb494a868fb21dd9d1d06d7a19564cf7e8"
sha256 cellar: :any, arm64_sonoma: "323c4d0ce66fa558941a41aa233773fd0ffbb5a64e83ecbb651f4c1b89a96b5f"
sha256 cellar: :any, arm64_ventura: "5dc9fcfc4fbea5548131615a47dbd6fc5e0c8ccece4b44d1a492602c6cd3916a"
sha256 cellar: :any, arm64_monterey: "92c46e35c501b6c7452e348d72f20cd9f07b8a87c44d3d4d5040af7fe02304f0"
sha256 cellar: :any, sonoma: "d8e792df249a4cab6c363db50b59590d5640f0f1ada93934f1c735a70381a1a9"
sha256 cellar: :any, ventura: "f682957f907edd64b3c71949e045448236fe576e11f5d2ad46b4e29d9a093e47"
sha256 cellar: :any, monterey: "6d40e3001405c4494851e0b981ab5878f07ac1a94f7ec42a1bf5de9a10d99d76"
sha256 cellar: :any_skip_relocation, x86_64_linux: "b4d1ed851dd2248a74db363f67f63c3e40b448a653f559bdfb1c826934ad3186"
end

keg_only :provided_by_macos

depends_on "cmake" => :build
depends_on "ninja" => :build

# Has strict requirements on the minimum version of Xcode. See _SUPPORTED_XCODE_BUILDS:
# As a starting point, check `minimum_version` in `validate_xcode_compatibility`:
# https://github.com/apple/swift/tree/swift-#{version}-RELEASE/utils/build-script
# This is mostly community sourced, so may be not necessarily be accurate.
depends_on xcode: ["13.0", :build]
# This is community-sourced so may not be accurate. If the version in this formula
# is higher then that is likely why.
depends_on xcode: ["13.3", :build]

depends_on "[email protected]"

Expand All @@ -52,112 +52,147 @@ class Swift < Formula
on_linux do
depends_on "icu4c" # Used in swift-corelibs-foundation

# Doesn't have to be in sync but does need to be no older than X.(Y - 1).0
resource "bootstrap" do
on_intel do
url "https://download.swift.org/swift-5.9.2-release/ubuntu2204/swift-5.9.2-RELEASE/swift-5.9.2-RELEASE-ubuntu22.04.tar.gz"
sha256 "6407e39eed7eaefcf7837d192d71765fb0f7cf8bf282c35b021171e8b15617c1"
end

on_arm do
url "https://download.swift.org/swift-5.9.2-release/ubuntu2204-aarch64/swift-5.9.2-RELEASE/swift-5.9.2-RELEASE-ubuntu22.04-aarch64.tar.gz"
sha256 "942e58de3384c9ca57f9e136be4fab7a7e799ee3269c70f35d60b3fee0f1e2fe"
end
end

resource "swift-corelibs-foundation" do
url "https://github.com/apple/swift-corelibs-foundation/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "b71505ae557a15481c05bbfaaeee83047e109c285ce4c4c7e06ba79b1aea3f2c"
url "https://github.com/apple/swift-corelibs-foundation/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "e58c529ababd547cf0b205fc0820ccce38a033664625c271110b564f2554dd44"
end

resource "swift-corelibs-libdispatch" do
url "https://github.com/apple/swift-corelibs-libdispatch/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "ec27aabf9b0500ad2abcc53b8902a7673d9871106097851ce226e2aa817d1b0e"
url "https://github.com/apple/swift-corelibs-libdispatch/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "b1f3e46ed248df6a3456d20bc23b2d8a12b740a40185d81b668b1d31735cadf2"
end

resource "swift-corelibs-xctest" do
url "https://github.com/apple/swift-corelibs-xctest/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "194180362ba8a18f60f4cc371ada705be2a51d317364055b17024bf9ae405e26"
url "https://github.com/apple/swift-corelibs-xctest/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "7f0d21ce0bb15ed5275b0d6e5ee1747344d9756c9f1913a644a0b2142ee1fb19"
end
end

# Currently requires Clang to build successfully.
fails_with :gcc

resource "llvm-project" do
url "https://github.com/apple/llvm-project/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "f4b6a4b1589d48fa2295d2709b99d1bfbbc6bfb2778dc72a4d72da3c25ff5d92"
url "https://github.com/apple/llvm-project/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "9df7cacc0107202dcdee8025d5cec9fe413f164e28921372acc61fddd78ed473"

# Fix finding Homebrew Python executable on Linux.
# Remove with Swift 5.10+.
patch do
url "https://github.com/apple/llvm-project/commit/9e84e038447e283d020ae01aebb15e0e66ef3642.patch?full_index=1"
sha256 "a46a6e9bf5309c1cb9c387e9648c6604a60f9cb3880463993ed72df4404f14ca"
end

# Fix compile with unpatched bootstrap Swift.
# Remove with Swift 5.10+.
patch do
url "https://github.com/apple/llvm-project/commit/8c76a69c00a8ca5fb9c063ff99c7d91511865bf2.patch?full_index=1"
sha256 "62c4e296983a4bf14e94302bfd3292e232c54badb86e4b2cac02e8d495eece78"
end
end

resource "cmark" do
url "https://github.com/apple/swift-cmark/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "89ad876b686192b806c61b390b076cf3cbb6459af6acdd3e93cd1e3d8a74c7f6"
url "https://github.com/apple/swift-cmark/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "658f4eb94f271e68af4ae07f4214f58d36dfc8edd7fc17ac44e8c85bec984337"
end

resource "llbuild" do
url "https://github.com/apple/swift-llbuild/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "2df6fa3d92a351df97f228148405462e3aebcd4f0077b17e0ee5f5514575aa68"
url "https://github.com/apple/swift-llbuild/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "44bcb0f8c6fa6cccdc16b7e75c996987568d8fde3caf8bc83c24a2e10383406f"

# Workaround Homebrew sqlite3 not being found.
# Needs paired inreplace for @@HOMEBREW_PREFIX@@.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/0080c7317c51d16b17671640c5db665516402d2f/swift/llbuild-sqlite3.patch"
sha256 "97329a525dabf4a7a13d3e3237965e66ae456887776e0101e82b6ca125a97591"
end
end

resource "swiftpm" do
url "https://github.com/apple/swift-package-manager/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "51967163d971aac66f9667d2a9387da3c25b70118bc1e82cef309759f7b1d272"
url "https://github.com/apple/swift-package-manager/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "132ae4908fa9c8f10265585f593dc748a021a18b11d6a1881e22d2db2dd1e162"
end

resource "indexstore-db" do
url "https://github.com/apple/indexstore-db/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "d9ff209be9a43109a80f1b2948fd34f203e1d55a944b1a2ea34439a75e218dc1"
url "https://github.com/apple/indexstore-db/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "a907c8fce27e718c179f6a92b73df62675e44b86612116468ff6ebd3f2997b31"
end

resource "sourcekit-lsp" do
url "https://github.com/apple/sourcekit-lsp/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "abc341ac3e05c01fe93949cdd72ee9aefc3b785a9f91ead32169764a1af6625e"
url "https://github.com/apple/sourcekit-lsp/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "0db3e5c56f2889a3be2ff4e9b5a285085459dee6f821c0cdf513eb5c9cc94ae4"
end

resource "swift-driver" do
url "https://github.com/apple/swift-driver/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "576ba0b330f2dc1fde6979dcecfccbb13c43d76b118bc8b43ecef9e62332df84"
url "https://github.com/apple/swift-driver/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "e4db5194e99ebbd605a14b86965b301b5a060482ecd1c5c94a4a099de5754e35"
end

resource "swift-tools-support-core" do
url "https://github.com/apple/swift-tools-support-core/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "914c697ded28be930f5afc844bc5712d2f47c14c83fae945ecca0f49af200f70"
url "https://github.com/apple/swift-tools-support-core/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "e0ab6f07998865549ad4bff34c91a3947a50a0085890d2d32605dfff296980c8"

# Fix "close error" when compiling SwiftPM.
# https://github.com/apple/swift-tools-support-core/pull/456
# Remove with Swift 5.11?
patch do
url "https://github.com/Bo98/swift-tools-support-core/commit/151e8fbd599a440c9931eae2a92221dd6d448dc6.patch?full_index=1"
sha256 "d17f14ac12abcad3169d736665f43e3fef0c7a15a4812bb04c3b2237da0dfa19"
end
end

resource "swift-docc" do
url "https://github.com/apple/swift-docc/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "95ba75c40eaa3571250f7f0769b6784a50a3a45796be9c71362635f88a5d09b7"
url "https://github.com/apple/swift-docc/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "5c2f2a68280d476b0d5559b38ffd46cb2f04d3d2e7436d9e2ddccf6555a9888f"
end

resource "swift-lmdb" do
url "https://github.com/apple/swift-lmdb/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "75d7760749e9d7a263aa428ef5867026a07f6baf290e190f440115a4faf55e56"
url "https://github.com/apple/swift-lmdb/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "0bafb61c6d8924626a9b130f3bcf9b92139f52a86aa1fa04539b83bc668c4b58"
end

resource "swift-docc-render-artifact" do
url "https://github.com/apple/swift-docc-render-artifact/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "024bb04690a49654b9bf901c42eb406d1ff255add45cc2655e31819eea841b4a"
url "https://github.com/apple/swift-docc-render-artifact/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "be134a7655345544eec00b52d097f4ca4a88333b17d32f3fb72f367aca335f96"
end

resource "swift-docc-symbolkit" do
url "https://github.com/apple/swift-docc-symbolkit/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "0d478cd7ba78e28175e93d1cf195c876fd97ae816f99d6981a398577be723a41"
url "https://github.com/apple/swift-docc-symbolkit/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "fb95cecf2de170066d9529dafe0a74781b94c4262891e4f0751693662c48e30d"
end

resource "swift-markdown" do
url "https://github.com/apple/swift-markdown/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "49aee3b5f2a90cda656191de41752d21b62e170ed5abbabd8078a82c67554e71"
url "https://github.com/apple/swift-markdown/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "5b00363c4704e8b77bf78f127a734cfaf6fcda9e8898f3340fc4c8745e37e2c5"
end

resource "swift-experimental-string-processing" do
url "https://github.com/apple/swift-experimental-string-processing/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "83714d2178d2a02de35e75dbe11ff2443695a65aaf1136e5a7b9f152716e75a6"
url "https://github.com/apple/swift-experimental-string-processing/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "3abc4225789e19defae966f7d9a712c77a5c0366f1d44d37df671048fe62daf6"
end

resource "swift-syntax" do
url "https://github.com/apple/swift-syntax/archive/refs/tags/swift-5.8.1-RELEASE.tar.gz"
sha256 "5885ad4e0ac448c6d4be85b17c5dd28e825aedf3664cf1b928017fb81938f52a"
url "https://github.com/apple/swift-syntax/archive/refs/tags/swift-5.9.2-RELEASE.tar.gz"
sha256 "b1918519f5bc6c7820f14242adfe26d9520a91896349a486359d9809b4e89351"
end

# To find the version to use, check the release/#{version.major_minor} entry of:
# https://github.com/apple/swift/blob/swift-#{version}-RELEASE/utils/update_checkout/update-checkout-config.json
resource "swift-argument-parser" do
url "https://github.com/apple/swift-argument-parser/archive/refs/tags/1.0.3.tar.gz"
sha256 "a4d4c08cf280615fe6e00752ef60e28e76f07c25eb4706a9269bf38135cd9c3f"
url "https://github.com/apple/swift-argument-parser/archive/refs/tags/1.2.2.tar.gz"
sha256 "44782ba7180f924f72661b8f457c268929ccd20441eac17301f18eff3b91ce0c"
end

# As above: refer to update-checkout-config.json
Expand All @@ -174,8 +209,20 @@ class Swift < Formula

# As above: refer to update-checkout-config.json
resource "swift-crypto" do
url "https://github.com/apple/swift-crypto/archive/refs/tags/2.2.3.tar.gz"
sha256 "84cec042505e1c5bf3dd14a1bb18d0c06c5a9435b7b10a69709101b602285ff5"
url "https://github.com/apple/swift-crypto/archive/refs/tags/2.5.0.tar.gz"
sha256 "a7b2f5c4887ccd728cdff5d1162b4d4d36bd6c2df9c0c31d5b9b73d341c5c1bb"
end

# As above: refer to update-checkout-config.json
resource "swift-certificates" do
url "https://github.com/apple/swift-certificates/archive/refs/tags/0.4.1.tar.gz"
sha256 "d7699ce91d65a622c1b9aaa0235cbbbd1be4ddc42a90fce007ff74bef50e8985"
end

# As above: refer to update-checkout-config.json
resource "swift-asn1" do
url "https://github.com/apple/swift-asn1/archive/refs/tags/0.7.0.tar.gz"
sha256 "d4470d61788194abbd60ed73965ee0722cc25037e83d41226a8a780088ba524e"
end

# As above: refer to update-checkout-config.json
Expand Down Expand Up @@ -208,13 +255,6 @@ class Swift < Formula
sha256 "9ab1f0e347fad651ed5ccadc13d54c4306e6f5cd21908a4ba7d1334278a4cd55"
end

# Fix Linux build on CMake 3.25+
# https://github.com/apple/swift/issues/65028
patch do
url "https://github.com/apple/swift/commit/112681f7f5927588569b225d926ca9f5f9ec98b3.patch?full_index=1"
sha256 "8e4f0fd946f40726d0d14745f3dba888a0f334599589f1817002df54e91684ac"
end

# Homebrew-specific patch to make the default resource directory use opt rather than Cellar.
# This fixes output binaries from `swiftc` having a runpath pointing to the Cellar.
# This should only be removed if an alternative solution is implemented.
Expand Down Expand Up @@ -269,40 +309,22 @@ def install
"-DCMAKE_BUILD_TYPE:=Debug",
"-DCMAKE_BUILD_TYPE:=Release"

if OS.mac?
# String processing is only available on macOS 13+ SDK, concurrency on macOS 12+ SDK
swiftpm_interface_build_scripts = [
workspace/"swiftpm/Sources/PackageDescription/CMakeLists.txt",
workspace/"swiftpm/Sources/PackagePlugin/CMakeLists.txt",
]
inreplace swiftpm_interface_build_scripts,
"-enable-library-evolution>",
"\\0 " \
'"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>" ' \
'"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"'

inreplace workspace/"swiftpm/Package.swift",
'"999.0"]),',
'\\0 ' \
'.unsafeFlags(["-Xfrontend", ' \
'"-disable-implicit-concurrency-module-import"], .when(platforms: [.macOS])), ' \
'.unsafeFlags(["-Xfrontend", ' \
'"-disable-implicit-string-processing-module-import"], .when(platforms: [.macOS])),'
end

# Fix lldb Python module not being installed (needed for `swift repl`)
lldb_cmake_caches = [
workspace/"llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake",
workspace/"llvm-project/lldb/cmake/caches/Apple-lldb-Linux.cmake",
]
inreplace lldb_cmake_caches, "repl_swift", "lldb-python-scripts \\0"

# Paired with llbuild patch
inreplace workspace/"llbuild/Package.swift", "@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX

mkdir build do
# List of components to build
swift_components = %w[
autolink-driver compiler clang-resource-dir-symlink
tools editor-integration toolchain-tools license
sourcekit-xpc-service swift-remote-mirror
libexec tools editor-integration toolchain-tools
license sourcekit-xpc-service swift-remote-mirror
swift-remote-mirror-headers stdlib
static-mirror-lib
]
Expand All @@ -327,7 +349,7 @@ def install
args = %W[
--host-cc=#{which(ENV.cc)}
--host-cxx=#{which(ENV.cxx)}
--release --assertions
--release --no-assertions
--no-swift-stdlib-assertions
--build-subdir=#{build}
--lldb --llbuild --swiftpm --swift-driver
Expand All @@ -341,6 +363,8 @@ def install
--install-prefix=#{install_prefix}
--swift-include-tests=0
--llvm-include-tests=0
--lldb-configure-tests=0
--lldb-extra-cmake-args=-DPython3_EXECUTABLE=#{which("python3.11")}
--skip-build-benchmarks
--build-swift-private-stdlib=0
--install-swift
Expand All @@ -358,11 +382,13 @@ def install
extra_cmake_options = []

if OS.mac?
# Backtracing currently requires stdlib - we may revisit in the future if part of the OS
args += %W[
--host-target=macosx-#{Hardware::CPU.arch}
--darwin-deployment-version-osx=#{MacOS.version}
--build-swift-dynamic-stdlib=0
--build-swift-dynamic-sdk-overlay=0
--swift-enable-backtracing=0
--stdlib-deployment-targets=
--swift-darwin-supported-archs=#{Hardware::CPU.arch}
--swift-darwin-module-archs=#{Hardware::CPU.arch}
Expand All @@ -379,8 +405,6 @@ def install
--foundation
--libdispatch
--xctest
--skip-early-swift-driver
--skip-early-swiftsyntax

--host-target=linux-#{Hardware::CPU.arch}
--stdlib-deployment-targets=linux-#{Hardware::CPU.arch}
Expand All @@ -393,12 +417,11 @@ def install
rpaths = [loader_path, rpath, rpath(target: lib/"swift/linux")]
extra_cmake_options << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(":")}"

ENV["CMAKE_Swift_COMPILER"] = "" # Ignore our shim
ENV.prepend_path "PATH", workspace/"bootstrap/usr/bin"
end

args << "--extra-cmake-options=#{extra_cmake_options.join(" ")}"

ENV["SKIP_XCODE_VERSION_CHECK"] = "1"
system "#{workspace}/swift/utils/build-script", *args
end

Expand All @@ -407,8 +430,6 @@ def install
ENV["SWIFT_EXEC"] = "#{prefix}#{install_prefix}/bin/swiftc"
MacOS.sdk_locator.all_sdks.each do |sdk|
next if sdk.version < :big_sur
# https://github.com/apple/swift/issues/62765
next if sdk.version == :ventura

system "#{prefix}#{install_prefix}/bin/swift", "build-sdk-interfaces",
"-sdk", sdk.path,
Expand Down Expand Up @@ -449,12 +470,6 @@ def caveats
module_cache = testpath/"ModuleCache"
module_cache.mkdir

# Temporary hack while macOS 13 SDK prebuilding is disabled.
if OS.mac? && MacOS.version == :ventura
ENV.remove_macosxsdk
ENV["SDKROOT"] = "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk"
end

(testpath/"test.swift").write <<~'EOS'
let base = 2
let exponent_inner = 3
Expand Down

0 comments on commit d443fa4

Please sign in to comment.