Skip to content

Commit 69775e3

Browse files
committed
Set RbConfig::CONFIG['configure_args'] for openssl and libyaml
* See ruby/openssl#650 (comment) * Fixes #3170
1 parent 55f4a97 commit 69775e3

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Compatibility:
1818
* Add `rb_gc_mark_movable` function (@andrykonchin).
1919
* 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)
2020
* Display "unhandled exception" as the message for `RuntimeError` instances with an empty message (#3255, @nirvdrum).
21+
* Set `RbConfig::CONFIG['configure_args']` for openssl and libyaml (#3170, #3303, @eregon).
2122

2223
Performance:
2324

lib/cext/include/truffleruby/truffleruby-abi-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
// $RUBY_VERSION must be the same as TruffleRuby.LANGUAGE_VERSION.
1111
// $ABI_NUMBER starts at 1 and is incremented for every ABI-incompatible change.
1212

13-
#define TRUFFLERUBY_ABI_VERSION "3.2.2.6"
13+
#define TRUFFLERUBY_ABI_VERSION "3.2.2.7"
1414

1515
#endif

lib/truffle/rbconfig.rb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,24 @@ module RbConfig
114114
soext = Truffle::Platform::SOEXT
115115

116116
# Make C extensions use the same libssl as the one used for the openssl C extension
117-
if Truffle::Platform.darwin?
118-
require 'truffle/openssl-prefix'
119-
openssl_prefix = ENV['OPENSSL_PREFIX']
120-
if openssl_prefix
121-
# Change the same variables as MRI's --with-opt-dir configure option would
122-
cppflags << " -I#{openssl_prefix}/include"
123-
ldflags << " -L#{openssl_prefix}/lib"
124-
dldflags << " -L#{openssl_prefix}/lib"
125-
end
117+
configure_args = ''
118+
119+
require 'truffle/openssl-prefix'
120+
if openssl_prefix = ENV['OPENSSL_PREFIX']
121+
configure_args << " '--with-openssl-dir=#{openssl_prefix}'"
122+
123+
# The below should not be needed as it's redundant but is still necessary
124+
# until grpc's extconf.rb is changed, as that does not use dir_config("openssl").
125+
# See https://github.com/oracle/truffleruby/issues/3170#issuecomment-1649471551
126+
# We change the same variables as MRI's --with-opt-dir configure option would.
127+
cppflags << " -I#{openssl_prefix}/include"
128+
ldflags << " -L#{openssl_prefix}/lib"
129+
dldflags << " -L#{openssl_prefix}/lib"
130+
end
131+
132+
require 'truffle/libyaml-prefix'
133+
if libyaml_prefix = ENV['LIBYAML_PREFIX']
134+
configure_args << " '--with-libyaml-dir=#{libyaml_prefix}'"
126135
end
127136

128137
# Set extra flags needed for --building-core-cexts
@@ -152,7 +161,7 @@ module RbConfig
152161
'ARCH_FLAG' => '',
153162
'build' => host,
154163
'build_os' => host_os_full,
155-
'configure_args' => ' ',
164+
'configure_args' => configure_args,
156165
'CC' => cc,
157166
'CCDLFLAGS' => '-fPIC',
158167
'CP' => 'cp',

src/main/c/openssl/extconf.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
require "mkmf"
1515

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

21+
dir_config_given = dir_config("openssl").any?
22+
2523
dir_config("kerberos")
2624

2725
Logging::message "=== OpenSSL for Ruby configurator ===\n"

0 commit comments

Comments
 (0)