Skip to content

Commit

Permalink
Set RbConfig::CONFIG['configure_args'] for openssl and libyaml
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Nov 30, 2023
1 parent 55f4a97 commit 69775e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Compatibility:
* Add `rb_gc_mark_movable` function (@andrykonchin).
* Promote `File#path` and `File#to_path` to `IO#path` and `IO#to_path` and make IO#new accept an optional `path:` keyword argument (#3039, @moste00)
* Display "unhandled exception" as the message for `RuntimeError` instances with an empty message (#3255, @nirvdrum).
* Set `RbConfig::CONFIG['configure_args']` for openssl and libyaml (#3170, #3303, @eregon).

Performance:

Expand Down
2 changes: 1 addition & 1 deletion lib/cext/include/truffleruby/truffleruby-abi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
// $RUBY_VERSION must be the same as TruffleRuby.LANGUAGE_VERSION.
// $ABI_NUMBER starts at 1 and is incremented for every ABI-incompatible change.

#define TRUFFLERUBY_ABI_VERSION "3.2.2.6"
#define TRUFFLERUBY_ABI_VERSION "3.2.2.7"

#endif
29 changes: 19 additions & 10 deletions lib/truffle/rbconfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,24 @@ module RbConfig
soext = Truffle::Platform::SOEXT

# Make C extensions use the same libssl as the one used for the openssl C extension
if Truffle::Platform.darwin?
require 'truffle/openssl-prefix'
openssl_prefix = ENV['OPENSSL_PREFIX']
if openssl_prefix
# Change the same variables as MRI's --with-opt-dir configure option would
cppflags << " -I#{openssl_prefix}/include"
ldflags << " -L#{openssl_prefix}/lib"
dldflags << " -L#{openssl_prefix}/lib"
end
configure_args = ''

require 'truffle/openssl-prefix'
if openssl_prefix = ENV['OPENSSL_PREFIX']
configure_args << " '--with-openssl-dir=#{openssl_prefix}'"

# The below should not be needed as it's redundant but is still necessary
# until grpc's extconf.rb is changed, as that does not use dir_config("openssl").
# See https://github.com/oracle/truffleruby/issues/3170#issuecomment-1649471551
# We change the same variables as MRI's --with-opt-dir configure option would.
cppflags << " -I#{openssl_prefix}/include"
ldflags << " -L#{openssl_prefix}/lib"
dldflags << " -L#{openssl_prefix}/lib"
end

require 'truffle/libyaml-prefix'
if libyaml_prefix = ENV['LIBYAML_PREFIX']
configure_args << " '--with-libyaml-dir=#{libyaml_prefix}'"
end

# Set extra flags needed for --building-core-cexts
Expand Down Expand Up @@ -152,7 +161,7 @@ module RbConfig
'ARCH_FLAG' => '',
'build' => host,
'build_os' => host_os_full,
'configure_args' => ' ',
'configure_args' => configure_args,
'CC' => cc,
'CCDLFLAGS' => '-fPIC',
'CP' => 'cp',
Expand Down
6 changes: 2 additions & 4 deletions src/main/c/openssl/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
require "mkmf"

if defined?(::TruffleRuby)
require 'truffle/openssl-prefix'
dir_config_given = dir_config("openssl", ENV["OPENSSL_PREFIX"]).any?
# Needed with libssl 3.0.0 and -Werror from building core C extensions
$warnflags += ' -Wno-deprecated-declarations'
else
dir_config_given = dir_config("openssl").any?
end

dir_config_given = dir_config("openssl").any?

dir_config("kerberos")

Logging::message "=== OpenSSL for Ruby configurator ===\n"
Expand Down

0 comments on commit 69775e3

Please sign in to comment.