diff --git a/bin/ruby-build b/bin/ruby-build index cb55f8deea..2d495a8fc4 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -580,6 +580,7 @@ build_package_standard_build() { if [ "$package_var_name" = "RUBY" ]; then use_homebrew_readline || use_freebsd_pkg ||true + use_homebrew_yaml || true fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -1022,17 +1023,18 @@ locate_llvm() { } needs_yaml() { - [[ "$RUBY_CONFIGURE_OPTS" != *--with-libyaml-dir=* ]] && ! use_homebrew_yaml } use_homebrew_yaml() { - local libdir="$(brew --prefix libyaml 2>/dev/null || true)" - if [ -d "$libdir" ]; then - echo "ruby-build: using libyaml from homebrew" - package_option ruby configure --with-libyaml-dir="$libdir" - else - return 1 + if [[ "$RUBY_CONFIGURE_OPTS" != *--with-libyaml-dir=* ]]; then + local libdir="$(brew --prefix libyaml 2>/dev/null || true)" + if [ -d "$libdir" ]; then + echo "ruby-build: using libyaml from homebrew" + package_option ruby configure --with-libyaml-dir="$libdir" + else + return 1 + fi fi } diff --git a/test/build.bats b/test/build.bats index 96d520537f..45688bea7f 100755 --- a/test/build.bats +++ b/test/build.bats @@ -186,10 +186,12 @@ OUT mkdir -p "$brew_libdir" stub uname '-s : echo Linux' - stub brew "--prefix libyaml : echo '$brew_libdir'" false + stub brew false "--prefix libyaml : echo '$brew_libdir'" stub_make_install - install_fixture definitions/needs-yaml + run_inline_definition <