Surface make problems while building Ruby extensions

A very common type of build failure is that the Ruby "openssl" extension failed to compile. However, when that happens, ruby-build just prints a generic "BUILD FAILED" message. To find out what happened, the user would first have to open the ruby-build log, note the "Following extensions are not compiled" section, then figure out how to find the exact location to the "ext/openssl/mkmf.log" file for more information.

Now, when `make` fails, ruby-build will automatically forward the "Following extensions are not compiled" information to stderr.
This commit is contained in:
Mislav Marohnić 2023-11-21 17:08:36 +01:00
parent 4cb285791c
commit 4a3ff7e194
No known key found for this signature in database

View file

@ -692,9 +692,20 @@ build_package_standard_build() {
"${!PACKAGE_CONFIGURE_OPTS_ARRAY}" $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS}
) || return $?
local status=0
# make -j <num_cpu_cores>
# 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() {