Skip to content

Commit c2b09a6

Browse files
committed
Do not compile the C extension on TruffleRuby
* 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
1 parent a5616dd commit c2b09a6

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Rakefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ require "rake/testtask"
33

44
name = "stringio"
55

6-
if RUBY_PLATFORM =~ /java/
6+
case RUBY_ENGINE
7+
when "jruby"
78
require 'rake/javaextensiontask'
89
extask = Rake::JavaExtensionTask.new("stringio") do |ext|
910
ext.lib_dir << "/#{ext.platform}"
@@ -13,15 +14,22 @@ if RUBY_PLATFORM =~ /java/
1314
end
1415

1516
task :build => "#{extask.lib_dir}/#{extask.name}.jar"
16-
else
17+
when "ruby"
1718
require 'rake/extensiontask'
1819
extask = Rake::ExtensionTask.new(name) do |x|
1920
x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}"
2021
end
22+
else
23+
task :compile
2124
end
25+
2226
Rake::TestTask.new(:test) do |t|
23-
ENV["RUBYOPT"] = "-I" + [extask.lib_dir, "test/lib"].join(File::PATH_SEPARATOR)
24-
t.libs << extask.lib_dir
27+
if extask
28+
ENV["RUBYOPT"] = "-I" + [extask.lib_dir, "test/lib"].join(File::PATH_SEPARATOR)
29+
t.libs << extask.lib_dir
30+
else
31+
ENV["RUBYOPT"] = "-Itest/lib"
32+
end
2533
t.libs << "test/lib"
2634
t.ruby_opts << "-rhelper"
2735
t.test_files = FileList["test/**/test_*.rb"]

ext/stringio/extconf.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# frozen_string_literal: false
22
require 'mkmf'
3-
create_makefile('stringio')
3+
if RUBY_ENGINE == 'ruby'
4+
create_makefile('stringio')
5+
else
6+
File.write('Makefile', dummy_makefile("").join)
7+
end

0 commit comments

Comments
 (0)