From fe290a41738a17abe412d9167d24c1d11cc7df30 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 24 Nov 2023 13:14:56 +0100 Subject: [PATCH] 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: https://github.com/ruby/openssl/issues/699 --- Rakefile | 10 ++++++---- ext/stringio/extconf.rb | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 1a16b54..c8cd706 100644 --- a/Rakefile +++ b/Rakefile @@ -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}" @@ -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"] diff --git a/ext/stringio/extconf.rb b/ext/stringio/extconf.rb index ad8650d..553732f 100644 --- a/ext/stringio/extconf.rb +++ b/ext/stringio/extconf.rb @@ -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