Skip to content

Commit 687c2b9

Browse files
committed
Skip passing --with-readline-dir for Ruby 3.3+
1 parent 3b79c29 commit 687c2b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/ruby-build

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ build_package_standard() {
655655
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
656656

657657
if [ "$package_var_name" = "RUBY" ]; then
658-
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-readline-dir=* ]]; then
658+
# shellcheck disable=SC2155
659+
local ruby_semver="$(normalize_semver "${package_name#ruby-}")"
660+
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-readline-dir=* && "$ruby_semver" -lt 300300 ]]; then
661+
# Ruby 3.3+ does not need external readline: https://github.com/rbenv/ruby-build/issues/2330
659662
use_homebrew_readline || use_freebsd_readline || true
660663
fi
661664
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-libffi-dir=* ]]; then
@@ -672,7 +675,7 @@ build_package_standard() {
672675
# use openssl installed from Ports Collection
673676
package_option ruby configure --with-openssl-dir="/usr/local"
674677
fi
675-
elif [ "$(normalize_semver "${package_name#ruby-}")" -lt 200707 ]; then
678+
elif [ "$ruby_semver" -lt 200707 ]; then
676679
local opt
677680
for opt in $RUBY_CONFIGURE_OPTS "${RUBY_CONFIGURE_OPTS_ARRAY[@]}"; do
678681
if [[ $opt == --with-openssl-dir=* ]]; then
@@ -690,7 +693,7 @@ build_package_standard() {
690693
fi
691694
if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-ext* &&
692695
"$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--without-ext* &&
693-
"$(normalize_semver "${package_name#ruby-}")" -ge 200500 ]]; then
696+
"$ruby_semver" -ge 200500 ]]; then
694697
# For Ruby 2.5+, fail the `make` step if any of these extensions were not compiled.
695698
# Otherwise, the build would have succeeded, but Ruby would be useless at runtime.
696699
# https://github.com/ruby/ruby/commit/b58a30e1c14e971adba4096104274d5d692492e9

0 commit comments

Comments
 (0)