Skip to content

Commit

Permalink
Determine the homebrew openssl version based on the ruby version (closes
Browse files Browse the repository at this point in the history
 #474).

* Ruby <= 3.0 requires openssl 1.1.
* Ruby >= 3.1.0 requires openssl 3.0.
* Removed `[email protected]` from `dependencies.txt` in favor of using
  `install_optional_deps` to install the variable openssl version.
  • Loading branch information
postmodern committed Nov 30, 2023
1 parent 1ee0921 commit 352f78f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion share/ruby-install/ruby/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apt: xz-utils build-essential bison zlib1g-dev libyaml-dev libssl-dev libgdbm-de
dnf: xz gcc automake bison zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel
yum: xz gcc automake bison zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel
port: automake bison openssl readline libyaml gdbm libffi
brew: automake bison [email protected] readline libyaml gdbm libffi
brew: automake bison readline libyaml gdbm libffi
pacman: xz gcc make bison zlib ncurses openssl readline libyaml gdbm libffi
zypper: xz gcc make automake zlib-devel libyaml-devel libopenssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel
pkg: openssl readline libyaml gdbm libffi
Expand Down
21 changes: 20 additions & 1 deletion share/ruby-install/ruby/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ ruby_dir_name="ruby-$ruby_version"
ruby_mirror="${ruby_mirror:-https://cache.ruby-lang.org/pub/ruby}"
ruby_url="${ruby_url:-$ruby_mirror/$ruby_version_family/$ruby_archive}"

if [[ "$package_manager" == "brew" ]]; then
case "$ruby_version_family" in
2.*|3.0) openssl_version="1.1" ;;
*) openssl_version="3.0" ;;
esac
fi

#
# Install [email protected] or [email protected] depending on the Ruby version,
# only for homebrew.
#
function install_optional_deps()
{
if [[ "$package_manager" == "brew" ]]; then
install_packages "openssl@${openssl_version}"
fi
}

#
# Configures Ruby.
#
Expand All @@ -30,7 +48,8 @@ function configure_ruby()
case "$package_manager" in
brew)
opt_dir="$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm)"
openssl_dir="$(brew --prefix [email protected])"

openssl_dir="$(brew --prefix "openssl@$openssl_version")"
;;
port)
opt_dir="/opt/local"
Expand Down

0 comments on commit 352f78f

Please sign in to comment.