diff --git a/bin/ruby-build b/bin/ruby-build index b1547f748b..7c0179238a 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -673,6 +673,11 @@ build_package_standard_build() { package_option ruby configure --with-openssl-dir="/usr/local" fi fi + if [[ "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--with-ext* && + "$RUBY_CONFIGURE_OPTS ${RUBY_CONFIGURE_OPTS_ARRAY[*]}" != *--without-ext* ]]; then + # Fail the `make` step if any of these extensions were not compiled. + package_option ruby configure --with-ext=openssl,psych,+ + fi fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -687,9 +692,20 @@ build_package_standard_build() { "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} ) || return $? + local status=0 # make -j # shellcheck disable=SC2086 - capture_command "$MAKE" "${!PACKAGE_MAKE_OPTS_ARRAY}" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} + capture_command "$MAKE" "${!PACKAGE_MAKE_OPTS_ARRAY}" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} || status=$? + + if [[ $status -ne 0 && -z $VERBOSE ]]; then + # Surface any extension building problems from `make` log to stderr. + # https://github.com/ruby/ruby/blob/HEAD/ext/extmk.rb + sed -n '/Following extensions are not compiled/,/Fix the problems/p' "$LOG_PATH" | \ + sed '/remove these directories and try again/d' | \ + sed "s:\\([[:space:]]*Check\\) \\(ext/.*\\):\\1 ${PWD}/\\2:" >&2 + fi + + return $status } build_package_standard_install() { @@ -1214,48 +1230,9 @@ build_package_openssl() { fi } -# Post-install check that the openssl extension was built. -# TODO: explore replacing this implementation with scanning the `make` log -# for the "Following extensions are not compiled" block. +# Kept for backward compatibility with 3rd-party definitions. build_package_verify_openssl() { - local msg - msg="->$(print_command "$RUBY_BIN" -e "