From 9df6a7ea9c4f8077b9dd2c0e6f6ebde5248965b5 Mon Sep 17 00:00:00 2001 From: Nicolas Bachschmidt Date: Fri, 27 Jun 2025 13:01:02 +0200 Subject: [PATCH] Avoid linking to Homebrew Cellar Links to the Cellar break when packages are upgraded. --- bin/ruby-build | 5 +++++ test/build.bats | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/bin/ruby-build b/bin/ruby-build index 7b35e565..7e03e16b 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -1107,6 +1107,11 @@ has_broken_mac_openssl() { } pkgconfig_openssl_version() { + local libdir + libdir="$(pkg-config --variable=prefix openssl 2>/dev/null || true)" + # We don't want to link to Homebrew Cellar because links break when packages are upgraded. + [[ "$libdir" != */Cellar/* ]] || return 0 + pkg-config --modversion openssl 2>/dev/null || true } diff --git a/test/build.bats b/test/build.bats index 38d6a3a5..faa9fcd8 100755 --- a/test/build.bats +++ b/test/build.bats @@ -536,6 +536,9 @@ OUT @test "link to Homebrew OpenSSL" { cached_tarball "ruby-3.2.0" configure + openssl_libdir="$TMP/homebrew/Cellar/openssl@3/3.0.0" + mkdir -p "$openssl_libdir" + local homebrew_prefix="${TMP}/homebrew" executable "${homebrew_prefix}/opt/openssl@3/bin/openssl" <