Skip to content

Commit

Permalink
Do not compile the C extension on TruffleRuby
Browse files Browse the repository at this point in the history
* Before this it was compiled but not used, because TruffleRuby has
  a stringio.rb in stdlib and .rb has precedence over .so.
  In fact that extension never worked on TruffleRuby,
  because rb_io_extract_modeenc() has never been defined on TruffleRuby.
* So this just skip compiling the extension since compilation of it now fails:
  ruby/openssl#699
  • Loading branch information
eregon committed Nov 24, 2023
1 parent a5616dd commit fe290a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "rake/testtask"

name = "stringio"

if RUBY_PLATFORM =~ /java/
if RUBY_ENGINE == "jruby"
require 'rake/javaextensiontask'
extask = Rake::JavaExtensionTask.new("stringio") do |ext|
ext.lib_dir << "/#{ext.platform}"
Expand All @@ -13,15 +13,17 @@ if RUBY_PLATFORM =~ /java/
end

task :build => "#{extask.lib_dir}/#{extask.name}.jar"
else
elsif RUBY_ENGINE == "ruby"
require 'rake/extensiontask'
extask = Rake::ExtensionTask.new(name) do |x|
x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}"
end
else
task :compile
end
Rake::TestTask.new(:test) do |t|
ENV["RUBYOPT"] = "-I" + [extask.lib_dir, "test/lib"].join(File::PATH_SEPARATOR)
t.libs << extask.lib_dir
ENV["RUBYOPT"] = "-I" + [*(extask.lib_dir if extask), "test/lib"].join(File::PATH_SEPARATOR)
t.libs << extask.lib_dir if extask
t.libs << "test/lib"
t.ruby_opts << "-rhelper"
t.test_files = FileList["test/**/test_*.rb"]
Expand Down
6 changes: 5 additions & 1 deletion ext/stringio/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# frozen_string_literal: false
require 'mkmf'
create_makefile('stringio')
if RUBY_ENGINE == 'ruby'
create_makefile('stringio')
else
File.write('Makefile', dummy_makefile("").join)
end

0 comments on commit fe290a4

Please sign in to comment.