Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust 1.72.0 #140367

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 70 additions & 33 deletions Formula/r/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@ class Rust < Formula
license any_of: ["Apache-2.0", "MIT"]

stable do
url "https://static.rust-lang.org/dist/rustc-1.71.1-src.tar.gz"
sha256 "6fa90d50d1d529a75f6cc349784de57d7ec0ba2419b09bde7d335c25bd4e472e"
url "https://static.rust-lang.org/dist/rustc-1.72.0-src.tar.gz"
sha256 "ea9d61bbb51d76b6ea681156f69f0e0596b59722f04414b01c6e100b4b5be3a1"

# From https://github.com/rust-lang/rust/tree/#{version}/src/tools
resource "cargo" do
url "https://github.com/rust-lang/cargo.git",
tag: "0.72.2",
revision: "1a737af0c83b28c1f249b821a76a19c82696b05a"
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"
end
ZhongRuoyu marked this conversation as resolved.
Show resolved Hide resolved
end

Expand All @@ -36,6 +46,9 @@ class Rust < Formula
depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "[email protected]" => :build
depends_on "libgit2"
depends_on "libssh2"
depends_on "llvm"
ZhongRuoyu marked this conversation as resolved.
Show resolved Hide resolved
depends_on "openssl@3"
depends_on "pkg-config"

Expand All @@ -45,28 +58,27 @@ class Rust < Formula
conflicts_with "rust-analyzer", because: "both install `rust-analyzer` binary"
conflicts_with "rustfmt", because: "both install `cargo-fmt` and `rustfmt` binaries"
ZhongRuoyu marked this conversation as resolved.
Show resolved Hide resolved

# From https://github.com/rust-lang/rust/blob/#{version}/src/stage0.json
resource "cargobootstrap" do
on_macos do
# From https://github.com/rust-lang/rust/blob/#{version}/src/stage0.json
on_arm do
url "https://static.rust-lang.org/dist/2023-06-01/cargo-1.70.0-aarch64-apple-darwin.tar.xz"
sha256 "faa0c57eab1846f4220e0833a167b845799bfc2d43aee819db7e9f5fe7d5a031"
url "https://static.rust-lang.org/dist/2023-07-13/cargo-1.71.0-aarch64-apple-darwin.tar.xz"
sha256 "7637bc54d15cec656d7abb32417316546c7a784eded8677753b5dad7f05b5b09"
end
on_intel do
url "https://static.rust-lang.org/dist/2023-06-01/cargo-1.70.0-x86_64-apple-darwin.tar.xz"
sha256 "0aa4661564be110614874812891d29b327eb343d2eb1eaf9862438aa2436f6b5"
url "https://static.rust-lang.org/dist/2023-07-13/cargo-1.71.0-x86_64-apple-darwin.tar.xz"
sha256 "d83fe33cabf20394168f056ead44d243bd37dc96165d87867ea5114cfb52e739"
end
end

on_linux do
# From: https://github.com/rust-lang/rust/blob/#{version}/src/stage0.json
on_arm do
url "https://static.rust-lang.org/dist/2023-06-01/cargo-1.70.0-aarch64-unknown-linux-gnu.tar.xz"
sha256 "8fd2d9806f0601feab1485f79e46d1441af2158c68abf56788ff355d5c6b4ab5"
url "https://static.rust-lang.org/dist/2023-07-13/cargo-1.71.0-aarch64-unknown-linux-gnu.tar.xz"
sha256 "13e8ff23d6af976a45f3ab451bf698e318a8d1823d588ff8a989555096f894a8"
end
on_intel do
url "https://static.rust-lang.org/dist/2023-06-01/cargo-1.70.0-x86_64-unknown-linux-gnu.tar.xz"
sha256 "650e7a890a52869cd14e2305652bff775aec7fc2cf47fc62cf4a89ff07242333"
url "https://static.rust-lang.org/dist/2023-07-13/cargo-1.71.0-x86_64-unknown-linux-gnu.tar.xz"
sha256 "fe6fb520f59966300ee661d18b37c36cb3e614877c4c01dfedf987b8a9c577e9"
end
end
end
Expand All @@ -75,9 +87,12 @@ def install
ENV.prepend_path "PATH", Formula["[email protected]"].opt_libexec/"bin"

# Ensure that the `openssl` crate picks up the intended library.
# https://crates.io/crates/openssl#manual-configuration
# https://docs.rs/openssl/latest/openssl/#manual
ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix

ENV["LIBGIT2_SYS_USE_PKG_CONFIG"] = "1"
ENV["LIBSSH2_SYS_USE_PKG_CONFIG"] = "1"

if OS.mac?
# Requires the CLT to be the active developer directory if Xcode is installed
ENV["SDKROOT"] = MacOS.sdk_path
Expand All @@ -86,7 +101,40 @@ def install
ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version
end

args = %W[--prefix=#{prefix} --sysconfdir=#{etc} --enable-vendor --set rust.jemalloc]
resource("cargobootstrap").stage do
system "./install.sh", "--prefix=#{buildpath}/cargobootstrap"
end
ENV.prepend_path "PATH", buildpath/"cargobootstrap/bin"

cargo_src_path = buildpath/"src/tools/cargo"
cargo_src_path.rmtree
resource("cargo").stage cargo_src_path
if OS.mac?
inreplace cargo_src_path/"Cargo.toml",
/^curl\s*=\s*"(.+)"$/,
'curl = { version = "\\1", features = ["force-system-lib-on-osx"] }'
end

# rustfmt and rust-analyzer are available in their own formulae.
tools = %w[
analysis
cargo
clippy
rustdoc
rust-demangler
src
]
args = %W[
--prefix=#{prefix}
--sysconfdir=#{etc}
--tools=#{tools.join(",")}
--llvm-root=#{Formula["llvm"].opt_prefix}
--enable-llvm-link-shared
--enable-vendor
--disable-cargo-native-static
--set=rust.jemalloc
--release-description=#{tap.user}
]
if build.head?
args << "--disable-rpath"
args << "--release-channel=nightly"
Expand All @@ -98,24 +146,13 @@ def install
system "make"
system "make", "install"

resource("cargobootstrap").stage do
system "./install.sh", "--prefix=#{buildpath}/cargobootstrap"
end
ENV.prepend_path "PATH", buildpath/"cargobootstrap/bin"

resource("cargo").stage do
ENV["RUSTC"] = bin/"rustc"
args = %W[--root #{prefix} --path . --force]
args += %w[--features curl-sys/force-system-lib-on-osx] if OS.mac?
ZhongRuoyu marked this conversation as resolved.
Show resolved Hide resolved
system "cargo", "install", *args
man1.install Dir["src/etc/man/*.1"]
bash_completion.install "src/etc/cargo.bashcomp.sh"
zsh_completion.install "src/etc/_cargo"
end

(lib/"rustlib/src/rust").install "library"
rm_rf prefix/"lib/rustlib/uninstall.sh"
rm_rf prefix/"lib/rustlib/install.log"
rm_f [
bin.glob("*.old"),
lib/"rustlib/install.log",
lib/"rustlib/uninstall.sh",
(lib/"rustlib").glob("manifest-*"),
]
end

def post_install
Expand Down
Loading