Skip to content

Commit 550c4a8

Browse files
committed
Avoid linking to Homebrew Cellar
Links to the Cellar break when packages are upgraded.
1 parent 4ddb5d7 commit 550c4a8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/ruby-build

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,8 @@ needs_yaml() {
10341034
use_pkgconfig_yaml() {
10351035
local libdir
10361036
libdir="$(pkg-config --variable=prefix yaml-0.1 2>/dev/null || true)"
1037+
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
1038+
[[ "$libdir" != */Cellar/* ]] || return 1
10371039
if [ -d "$libdir" ]; then
10381040
package_option ruby configure --with-libyaml-dir="$libdir"
10391041
else
@@ -1065,6 +1067,8 @@ use_freebsd_yaml() {
10651067
use_pkgconfig_gmp() {
10661068
local libdir
10671069
libdir="$(pkg-config --variable=prefix gmp 2>/dev/null || true)"
1070+
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
1071+
[[ "$libdir" != */Cellar/* ]] || return 1
10681072
if [ -d "$libdir" ]; then
10691073
package_option ruby configure --with-gmp-dir="$libdir"
10701074
else
@@ -1100,6 +1104,8 @@ use_freebsd_readline() {
11001104
use_pkgconfig_readline() {
11011105
local libdir
11021106
libdir="$(pkg-config --variable=prefix readline 2>/dev/null || true)"
1107+
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
1108+
[[ "$libdir" != */Cellar/* ]] || return 1
11031109
if [ -d "$libdir" ]; then
11041110
package_option ruby configure --with-readline-dir="$libdir"
11051111
else
@@ -1121,6 +1127,8 @@ use_homebrew_readline() {
11211127
use_pkgconfig_libffi() {
11221128
local libdir
11231129
libdir="$(pkg-config --variable=prefix libffi 2>/dev/null || true)"
1130+
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
1131+
[[ "$libdir" != */Cellar/* ]] || return 1
11241132
if [ -d "$libdir" ]; then
11251133
package_option ruby configure --with-libffi-dir="$libdir"
11261134
else
@@ -1160,7 +1168,11 @@ pkgconfig_openssl_version() {
11601168
}
11611169

11621170
pkgconfig_openssl_prefix() {
1163-
pkg-config --variable=prefix openssl 2>/dev/null || true
1171+
local libdir
1172+
libdir="$(pkg-config --variable=prefix openssl 2>/dev/null || true)"
1173+
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
1174+
[[ "$libdir" != */Cellar/* ]] || return 0
1175+
printf "%s" "$libdir"
11641176
}
11651177

11661178
# List all Homebrew-installed OpenSSL versions and their filesystem prefixes.

0 commit comments

Comments
 (0)