From 920d54124a7ed87e205b280038934d9c3a55cee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Mon, 21 Mar 2022 12:23:32 +0100 Subject: [PATCH] Fix FTBFS with Ruby 3.x due to removed rb_set_safe_level. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Ruby 2.7 the entire concept is deprecated and in Ruby 3.x is removed entirely - see https://bugs.ruby-lang.org/issues/16131 Signed-off-by: Slávek Banko --- lib/kross/ruby/rubyinterpreter.cpp | 4 ++++ lib/kross/ruby/rubywrapper.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/kross/ruby/rubyinterpreter.cpp b/lib/kross/ruby/rubyinterpreter.cpp index 18ae65955..3504ca7c4 100644 --- a/lib/kross/ruby/rubyinterpreter.cpp +++ b/lib/kross/ruby/rubyinterpreter.cpp @@ -16,6 +16,8 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. ***************************************************************************/ + +#include "config.h" #include "rubyinterpreter.h" #include @@ -83,12 +85,14 @@ RubyInterpreter::RubyInterpreter(Kross::Api::InterpreterInfo* info): Kross::Api: { initRuby(); } +#ifndef HAVE_RUBY_3 if(info->hasOption("safelevel") ) { kross_rb_set_safe_level( info->getOption("safelevel")->value.toInt() ); } else { kross_rb_set_safe_level(3); // if the safelevel option is undefined, set it to maximum level } +#endif } diff --git a/lib/kross/ruby/rubywrapper.c b/lib/kross/ruby/rubywrapper.c index 84d12540a..a25b1b282 100644 --- a/lib/kross/ruby/rubywrapper.c +++ b/lib/kross/ruby/rubywrapper.c @@ -17,8 +17,11 @@ * Boston, MA 02110-1301, USA. ***************************************************************************/ +#include "config.h" #include "ruby.h" void kross_rb_set_safe_level(int safelevel) { +#ifndef HAVE_RUBY_3 rb_set_safe_level(safelevel); +#endif }