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

ruby@2.7: switch to openssl@3 #134420

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Changes from all commits
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
48 changes: 39 additions & 9 deletions Formula/ruby@2.7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ class RubyAT27 < Formula
url "https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.8.tar.xz"
sha256 "f22f662da504d49ce2080e446e4bea7008cee11d5ec4858fc69000d0e5b1d7fb"
license "Ruby"
revision 1

livecheck do
url "https://www.ruby-lang.org/en/downloads/"
regex(/href=.*?ruby[._-]v?(2\.7(?:\.\d+)+)\.t/i)
end

bottle do
sha256 arm64_ventura: "38f24449e4e31e1fabdaa980a1d0dd21e0a1432ef93410d2c4d3886eedd366e6"
sha256 arm64_monterey: "ef5de92ff2a74b341a228afe6b0601ae869b2db94645c10dd78b578a7c7903bb"
sha256 arm64_big_sur: "e1a4f0aded868d1b732b43cf010a78ac92fbbc21b7b01b79697a858ff5986414"
sha256 ventura: "506b92de87465908f9cfd6a13d7ba6a10900fab6f4d38a353076f23fd1120839"
sha256 monterey: "22e90308975956ce14cd906c40e7d25633d09d355522144d093885b9451389bc"
sha256 big_sur: "b34a861f092e5a0a0284315b6229de9feb7c5ad460b238fa60e5c535dcc3be80"
sha256 x86_64_linux: "50cb1843b58aea15f4563f180cc3356290005f3187a6a5707ac347b1691950cd"
sha256 arm64_ventura: "3b37017d8a6c722b6ce8b44361d7893a8458c8696e84f393df01be87e4d67faa"
sha256 arm64_monterey: "732ed82a82fed5ceb49de4cd4be5c5c6f4151d02c157df689cbdb1eae668b0f5"
sha256 arm64_big_sur: "7d0763386880e2a4edb83e80151592d9ea074a87cd7091406798c74d3a6b7bea"
sha256 ventura: "34b05f1fce9e839d2039ff581f40f195ae590f803e2b8c5cbdd564130b775716"
sha256 monterey: "f10c957f760ae1b34d12629ad26c958556f9bc84ad0da848f3077a522b0ede5f"
sha256 big_sur: "695d5eaf8dee2c506365e15030a1d139e161c640d455c1eea5ae5d433a0d76de"
sha256 x86_64_linux: "e72683fb67d9a53c863389d2adb94a0f11bfc4f5abe35ce61e68b3ceb453a927"
end

keg_only :versioned_formula
Expand All @@ -28,7 +29,7 @@ class RubyAT27 < Formula

depends_on "pkg-config" => :build
depends_on "libyaml"
depends_on "openssl@1.1"
depends_on "openssl@3"
depends_on "readline"

uses_from_macos "libxcrypt"
Expand All @@ -42,6 +43,18 @@ class RubyAT27 < Formula
sha256 "55f1c67fa2ae96c9751b81afad5c0f2b3792c5b19cbba6d54d8df9fd821460d3"
end

# Update the bundled openssl gem for compatibility with OpenSSL 3.
resource "openssl" do
url "https://github.com/ruby/openssl/archive/refs/tags/v3.1.0.tar.gz"
sha256 "3f099acd0b3bea791cbdde520f2d332a709bbd9144abcbe22189a20bac12c6de"
end

# Update the bundled digest gem for compatibility with the newer openssl gem.
resource "digest" do
url "https://github.com/ruby/digest/archive/refs/tags/v3.1.1.tar.gz"
sha256 "27107e7a982ce090eb9d84f4fa2f0e537feb46389e5cdd50855f6b8f8531d280"
end

def api_version
Utils.safe_popen_read("#{bin}/ruby", "-e", "print Gem.ruby_api_version")
end
Expand All @@ -54,7 +67,24 @@ def install
# otherwise `gem` command breaks
ENV.delete("SDKROOT")

paths = %w[libyaml openssl@1.1 readline].map { |f| Formula[f].opt_prefix }
%w[openssl digest].each do |r_name|
resource(r_name).stage do
%W[ext/#{r_name} test/#{r_name}].each { |stem| (buildpath/stem).rmtree }
(buildpath/"ext").install "ext/#{r_name}"
Pathname.new("lib").each_child do |child|
if child.directory?
child.each_child { |grandchild| (buildpath/"ext"/r_name/child).install grandchild }
next
end

(buildpath/"ext"/r_name/"lib").install child
end
(buildpath/"ext"/r_name).install "#{r_name}.gemspec"
(buildpath/"test").install "test/#{r_name}"
end
end

paths = %w[libyaml openssl@3 readline].map { |f| Formula[f].opt_prefix }
args = %W[
--prefix=#{prefix}
--enable-shared
Expand Down