Explicitly set PKG_CONFIG_PATH when `--with-openssl-dir` is used for older Rubies.
Otherwise, Ruby will attempt to link to the latest OpenSSL found by pkg-config,
which could be incompatible.
This merges "standard_build" and "standard_install" build steps into one again
and modifies "standard_install_with_bundled_gems" to just invoke "standard"
with the addition of `update-gems` & `extract-gems` targets.
Using `--with-ext=+` only has the indended effect (compiling all extensions that would normally get compiled) on Ruby 2.5+. On older versions, it causes none of the default extensions to get compiled, resulting in a defunct installation.
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.
Normally, Ruby `make` step will print a warning about any missing
extensions, but will not abort the build and instead proceed as normal.
Since Ruby installations without openssl or psych are essentially
broken, ruby-build used to have a `verify_openssl` build step to test if
the newly built Ruby can load these extensions, and print helpful
information and abort the build on errors:
Loading the Ruby openssl extension failed
ERROR: Ruby install aborted due to missing extensions
The `verify_opensl` implementation was necessary to provide a good
experience for ruby-build users, but was hacky and I would prefer to
eliminate it.
It appears that passing `--with-ext=openssl,psych` to the Ruby configure
step marks those extensions as mandatory and fails the `make` process if
they failed to build. This is exactly the behavior we want, so this
enables the configure option for all Ruby builds.
It seems like there exist platforms that have wget which does not
support the `--show-progress` option. This reverts to using wget in its
default verbose mode where a progress bar and bunch more information are
printed to stderr.
There is no need to redirect to &3 to most cases anymore: &2 will suffice.
Also, it is better to print failure errors like checksum mismatches to
stderr instead of to the log file at &4.
- The command line invocation is now printed in the log.
- For every extension that failed, print the absolute location to its
mkmf.log to encourage the user to look there when troubleshooting.
- Do not print "Configure options used" since ruby-build now prints the
full `./configure` invocation as part of the build output.
This removes the `isolated_gem_dependency` hack as well as the `rake` &
`bundle` shell wrapper functions. The main reason is to avoid having to
use the `command` shell builtin to be able to invoke the real `rake` and
`bundle`. In my testing on bash 3.2, `command` does not respect the
usual bash error handling rules, and thus a failed `command` invocation
can trigger the ERR trap mechanism even when we don't want it to.
This stops writing raw pushd/popd output to the log file, which is noisy
and potentially confusing out-of-context. Instead, when changing the
directory in a way that is significant to the log, just print `cd`
followed by the name of the new directory.
This connects the stderr of download utilities like curl and wget to the
original stderr of the process so that they can detect a terminal and
print progress bars to it.
- "BUILD FAILED" is now printed in red instead of in highlight color.
- Print CPU architecture information after OS information.
- Do NOT print last 10 lines of the log anymore. Due to the verbosity of
compilers, that rarely includes the actual error message, but users
think it does and so they paste it in their GitHub reports instead of
perusing the log file.
ruby-build now prints the full invocation of (almost) every external
command that it runs. Typically that is something like:
-> ./configure --prefix=/path/to/ruby
-> make -j 2
-> make install
All output of these commands still goes to the log file by default.
This changes the behavior of `--verbose` mode to simply redirect all
command output to the stdout & stderr of the parent process instead of
writing to and then tailing the log file. This allows implementations of
commands like `./configure` or `make` to detect a terminal and output
color.