Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ pkgconfig_prefix() {
prefix="$(pkg-config --variable=prefix "$1" 2>/dev/null || true)"
[ -n "$prefix" ] || return 1
brew_prefix="$(brew --prefix 2>/dev/null || true)"
if [[ -n $prefix_prefix && ( $prefix == "$brew_prefix"/Cellar/* || \
if [[ -n $brew_prefix && ( $prefix == "$brew_prefix"/Cellar/* || \
$prefix == "$(brew --repository 2>/dev/null || true)"/Cellar/* ) ]]; then
return 1
fi
Expand Down
38 changes: 38 additions & 0 deletions test/build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,44 @@ make install
OUT
}

@test "link to Homebrew OpenSSL ignoring pkg-config" {
cached_tarball "ruby-3.2.0" configure

local homebrew_prefix="${TMP}/homebrew"
executable "${homebrew_prefix}/opt/openssl@3/bin/openssl" <<EXE
#!/$BASH
[ "\$1" = "version" ] || exit 1
echo 'OpenSSL 3.2.1 20 Dec 2019'
EXE

stub_repeated uname '-s : echo Linux'
stub cc '-xc -E - : echo "OpenSSL 1.0.1a 1 Aug 2023"'
stub_repeated brew \
'list : echo "openssl@3"' \
"--prefix : if [ \$# -ge 2 ]; then echo '$homebrew_prefix'/opt/\$2; else echo '$homebrew_prefix'; fi " \
"--repository : echo '$homebrew_prefix'"
stub pkg-config "--variable=prefix openssl : echo '$homebrew_prefix'/Cellar/openssl@3/3.2.1"
stub_make_install

run_inline_definition <<DEF
install_package "openssl-1.1.1w" "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" openssl --if needs_openssl:1.1.0-3.2.x
install_package "ruby-3.2.0" "http://ruby-lang.org/ruby/2.0/ruby-3.2.0.tar.gz"
DEF
assert_success

unstub uname
unstub cc
unstub brew
unstub pkg-config
unstub make

assert_build_log <<OUT
ruby-3.2.0: [--prefix=$INSTALL_ROOT,--with-openssl-dir=$TMP/homebrew/opt/openssl@3,--with-ext=openssl,psych,+]
make -j 2
make install
OUT
}

@test "forward extra command-line arguments as configure flags" {
cached_tarball "ruby-3.2.0" configure

Expand Down
Loading