mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-11-27 22:30:55 +01:00
Check that openssl, yaml, readline, zlib are all loadable
If not, suggest that you should install necessary dependencies if a package manager `apt-get` or `yum` is detected on the system.
This commit is contained in:
parent
29f1a19154
commit
025e7c6952
1 changed files with 32 additions and 9 deletions
|
|
@ -834,15 +834,38 @@ build_package_mac_openssl() {
|
||||||
|
|
||||||
# Post-install check that the openssl extension was built.
|
# Post-install check that the openssl extension was built.
|
||||||
build_package_verify_openssl() {
|
build_package_verify_openssl() {
|
||||||
"$RUBY_BIN" -e 'begin
|
"$RUBY_BIN" -e '
|
||||||
require "openssl"
|
manager = ARGV[0]
|
||||||
rescue LoadError
|
packages = {
|
||||||
$stderr.puts "The Ruby openssl extension was not compiled. Missing the OpenSSL lib?"
|
"apt-get" => Hash.new {|h,k| "lib#{k}-dev" }.update(
|
||||||
$stderr.puts "Configure options used:"
|
"openssl" => "libssl-dev",
|
||||||
require "rbconfig"; require "shellwords"
|
"zlib" => "zlib1g-dev"
|
||||||
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
|
),
|
||||||
exit 1
|
"yum" => Hash.new {|h,k| "#{k}-devel" }.update(
|
||||||
end' >&4 2>&1
|
"yaml" => "libyaml-devel"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
failed = %w[openssl readline zlib yaml].reject do |lib|
|
||||||
|
begin
|
||||||
|
require lib
|
||||||
|
rescue LoadError
|
||||||
|
$stderr.puts "The Ruby #{lib} extension was not compiled."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if failed.size > 0
|
||||||
|
$stderr.puts "ERROR: Ruby install aborted due to missing extensions"
|
||||||
|
$stderr.print "Try running `%s install -y %s` to fetch missing dependencies.\n\n" % [
|
||||||
|
manager,
|
||||||
|
failed.map { |lib| packages.fetch(manager)[lib] }.join(" ")
|
||||||
|
] unless manager.empty?
|
||||||
|
$stderr.puts "Configure options used:"
|
||||||
|
require "rbconfig"; require "shellwords"
|
||||||
|
RbConfig::CONFIG.fetch("configure_args").shellsplit.each { |arg| $stderr.puts " #{arg}" }
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
' "$(basename "$(type -p yum apt-get | head -1)")" >&4 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure that directories listed in LDFLAGS exist
|
# Ensure that directories listed in LDFLAGS exist
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue