Skip to content

Commit 599042d

Browse files
committed
Use --with-*-dir= options when configuring CRuby (closes #507).
* Ruby < 3.4.0 treated the `--with-*-dir=` options differently than the `--with-opt-dir=` option. This was apparently fixed in Ruby 3.4.0, however we should error on the side of caution and use the `--with-*-dir=` options instead of `--with-opt-dir=`.
1 parent 1bc5780 commit 599042d

1 file changed

Lines changed: 32 additions & 10 deletions

File tree

share/ruby-install/ruby/functions.sh

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,54 @@ function configure_ruby()
2323
autoreconf || return $?
2424
fi
2525

26-
local opt_dir
27-
local openssl_dir
26+
local dependency_opts=()
2827

2928
log "Configuring ruby $ruby_version ..."
3029
case "$package_manager" in
3130
brew)
32-
opt_dir="$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix libffi)"
33-
openssl_dir="$(brew --prefix "openssl@${openssl_version}")"
31+
dependency_opts+=(
32+
"--with-readline-dir=$(brew --prefix readline)"
33+
"--with-libyaml-dir=$(brew --prefix libyaml)"
34+
"--with-libffi-dir=$(brew --prefix libffi)"
35+
"--with-openssl-dir=$(brew --prefix "openssl@${openssl_version}")"
36+
)
3437

3538
if [[ "${ruby_dependencies[*]}" == *"gdbm"* ]]; then
36-
opt_dir="${opt_dir}:$(brew --prefix gdbm)"
39+
dependency_opts+=(
40+
"--with-gdbm-dir=$(brew --prefix gdbm)"
41+
)
3742
fi
3843

3944
if [[ "${ruby_dependencies[*]}" == *"jemalloc"* ]]; then
40-
opt_dir="${opt_dir}:$(brew --prefix jemalloc)"
45+
dependency_opts+=(
46+
"--with-jemalloc-dir=$(brew --prefix jemalloc)"
47+
)
4148
fi
4249
;;
4350
port)
44-
opt_dir="/opt/local"
45-
openssl_dir="/opt/local"
51+
dependency_opts+=(
52+
"--with-readline-dir=/usr/local"
53+
"--with-libyaml-dir=/usr/local"
54+
"--with-libffi-dir=/usr/local"
55+
"--with-openssl-dir=/usr/local"
56+
)
57+
58+
if [[ "${ruby_dependencies[*]}" == *"gdbm"* ]]; then
59+
dependency_opts+=(
60+
"--with-gdbm-dir=/usr/local"
61+
)
62+
fi
63+
64+
if [[ "${ruby_dependencies[*]}" == *"jemalloc"* ]]; then
65+
dependency_opts+=(
66+
"--with-jemalloc-dir=/usr/local"
67+
)
68+
fi
4669
;;
4770
esac
4871

4972
run ./configure --prefix="$install_dir" \
50-
"${opt_dir:+--with-opt-dir="$opt_dir"}" \
51-
"${openssl_dir:+--with-openssl-dir="$openssl_dir"}" \
73+
"${dependency_opts[@]}" \
5274
"${configure_opts[@]}" || return $?
5375
}
5476

0 commit comments

Comments
 (0)