From 341265c4a27cc61f6e562a4b350428a07b4a6f18 Mon Sep 17 00:00:00 2001 From: Andrew Konchin Date: Tue, 17 Sep 2024 13:56:43 +0300 Subject: [PATCH] Skip building on TruffleRuby --- Rakefile | 10 +++++++--- ext/fiddle/extconf.rb | 5 +++++ lib/fiddle.rb | 9 ++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index aefc9ed5..fb3e8bd4 100644 --- a/Rakefile +++ b/Rakefile @@ -17,8 +17,12 @@ namespace :version do end end -require 'rake/extensiontask' -Rake::ExtensionTask.new("fiddle") -Rake::ExtensionTask.new("-test-/memory_view") +if RUBY_ENGINE == 'ruby' + require 'rake/extensiontask' + Rake::ExtensionTask.new("fiddle") + Rake::ExtensionTask.new("-test-/memory_view") +else + task :compile +end task :default => [:compile, :test] diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index 2d85b3ee..422b121c 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -1,6 +1,11 @@ # frozen_string_literal: true require 'mkmf' +if RUBY_ENGINE != 'ruby' + File.write('Makefile', dummy_makefile("").join) + return +end + # :stopdoc: def gcc? diff --git a/lib/fiddle.rb b/lib/fiddle.rb index 6137c487..cd559dc8 100644 --- a/lib/fiddle.rb +++ b/lib/fiddle.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true -require 'fiddle.so' +if RUBY_ENGINE == "ruby" + require 'fiddle.so' +else + $LOAD_PATH.delete(__dir__) + require 'fiddle' # load from stdlib + return +end + require 'fiddle/closure' require 'fiddle/function' require 'fiddle/version'