Skip to content

Commit

Permalink
rust 1.72.1
Browse files Browse the repository at this point in the history
- Build with the Python from macOS.
- Instead of doing a full `git clone`, build Cargo from a source
  tarball.

Co-authored-by: Ruoyu Zhong <[email protected]>
  • Loading branch information
chenrui333 and ZhongRuoyu committed Sep 23, 2023
1 parent a9b507c commit ea7472c
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions Formula/r/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@ class Rust < Formula
desc "Safe, concurrent, practical language"
homepage "https://www.rust-lang.org/"
license any_of: ["Apache-2.0", "MIT"]
revision 2

stable do
# TODO: check if we can use unversioned `llvm` and `libgit2` at version bump.
# See comments below for details on `libgit2`.
url "https://static.rust-lang.org/dist/rustc-1.72.0-src.tar.gz"
sha256 "ea9d61bbb51d76b6ea681156f69f0e0596b59722f04414b01c6e100b4b5be3a1"
# TODO: try switching to `llvm` 17 at 1.73.0.
# See: https://github.com/rust-lang/rust/issues/116020
url "https://static.rust-lang.org/dist/rustc-1.72.1-src.tar.gz"
sha256 "7f48845f6a52cdbb5d63fb0528fd5f520eb443275b55f98e328159f86568f895"

# From https://github.com/rust-lang/rust/tree/#{version}/src/tools
# When bumping to a new version, check if we can use unversioned `libgit2`.
# See comments below for details.
resource "cargo" do
url "https://github.com/rust-lang/cargo.git",
tag: "0.73.1",
revision: "26bba48309d080ef3a3a00053f4e1dc879ef1de9"
end

# Fix for a compiler issue that may cause some builds to spin forever.
# Remove on 1.73.0 release.
# https://github.com/rust-lang/rust/pull/114948
# https://github.com/rust-lang/rust/issues/115297
# https://github.com/kpcyrd/sh4d0wup/issues/12
patch do
url "https://github.com/rust-lang/rust/commit/0f7f6b70617fbcda9f73755fa9b560bfb0a588eb.patch?full_index=1"
sha256 "549f446612bef10a1a06a967f61655b59c1b6895d762d764ca89caf65c114fe9"
url "https://github.com/rust-lang/cargo/archive/refs/tags/0.73.1.tar.gz"
sha256 "976fb6f3e773319e60875772478645297d9eacc852857e288e8cec65399d2c88"
end
end

Expand All @@ -48,7 +38,6 @@ class Rust < Formula
end
end

depends_on "[email protected]" => :build
# To check for `libgit2` version:
# 1. Search for `libgit2-sys` version at https://github.com/rust-lang/cargo/blob/#{cargo_version}/Cargo.lock
# 2. If the version suffix of `libgit2-sys` is newer than +1.6.*, then:
Expand All @@ -61,6 +50,7 @@ class Rust < Formula
depends_on "openssl@3"
depends_on "pkg-config"

uses_from_macos "python" => :build
uses_from_macos "curl"
uses_from_macos "zlib"

Expand Down Expand Up @@ -90,8 +80,6 @@ class Rust < Formula
end

def install
ENV.prepend_path "PATH", Formula["[email protected]"].opt_libexec/"bin"

# Ensure that the `openssl` crate picks up the intended library.
# https://docs.rs/openssl/latest/openssl/#manual
ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix
Expand Down Expand Up @@ -208,7 +196,9 @@ def check_binary_linkage(binary, library)
missing_linkage = []
expected_linkage.each do |binary, dylibs|
dylibs.each do |dylib|
missing_linkage << "#{binary} => #{dylib}" unless check_binary_linkage(binary, dylib)
next if check_binary_linkage(binary, dylib)

missing_linkage << "#{binary} => #{dylib}"
end
end
assert missing_linkage.empty?, "Missing linkage: #{missing_linkage.join(", ")}"
Expand Down

0 comments on commit ea7472c

Please sign in to comment.