Skip to content

Commit

Permalink
Skip building on TruffleRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Sep 17, 2024
1 parent aad5a3b commit 504e1a2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 31 deletions.
11 changes: 8 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ 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]
62 changes: 34 additions & 28 deletions ext/fiddle/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,35 +218,41 @@ def enable_debug_build_flag(flags)
$LOCAL_LIBS.prepend("#{libffi.a} ").strip! # to exts.mk
$INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)')
end
create_makefile 'fiddle' do |conf|
if !libffi
next conf << "LIBFFI_CLEAN = none\n"
elsif $gnumake && !$nmake
submake_arg = "-C $(LIBFFI_DIR)\n"
else
submake_pre = "cd $(LIBFFI_DIR) && #{config_string("exec")}".strip
end
if $nmake
cmd = "$(RUBY) -C $(LIBFFI_DIR) #{libffi_config} --srcdir=$(LIBFFI_SRCDIR)"
else
cmd = "cd $(LIBFFI_DIR) && #$exec $(LIBFFI_SRCDIR)/configure #{libffi.opt}"

if RUBY_ENGINE == 'ruby'
create_makefile 'fiddle' do |conf|
if !libffi
next conf << "LIBFFI_CLEAN = none\n"
elsif $gnumake && !$nmake
submake_arg = "-C $(LIBFFI_DIR)\n"
else
submake_pre = "cd $(LIBFFI_DIR) && #{config_string("exec")}".strip
end
if $nmake
cmd = "$(RUBY) -C $(LIBFFI_DIR) #{libffi_config} --srcdir=$(LIBFFI_SRCDIR)"
else
cmd = "cd $(LIBFFI_DIR) && #$exec $(LIBFFI_SRCDIR)/configure #{libffi.opt}"
end
sep = "/"
seprpl = config_string('BUILD_FILE_SEPARATOR') {|s| sep = s; ":/=#{s}" if s != "/"} || ""
conf << <<-MK.gsub(/^ +| +$/, '')
PWD =
LIBFFI_CONFIGURE = #{cmd}
LIBFFI_ARCH = #{libffi.arch}
LIBFFI_SRCDIR = #{libffi.srcdir.sub(libffi.dir, '$(LIBFFI_DIR)')}
LIBFFI_DIR = #{libffi.dir}
LIBFFI_A = #{libffi.a.sub(libffi.dir, '$(LIBFFI_DIR)')}
LIBFFI_CFLAGS = #{libffi.cflags}
LIBFFI_LDFLAGS = #{libffi.ldflags}
FFI_H = $(LIBFFI_DIR)/include/ffi.h
SUBMAKE_PRE = #{submake_pre}
SUBMAKE_ARG = #{submake_arg}
LIBFFI_CLEAN = libffi
MK
end
sep = "/"
seprpl = config_string('BUILD_FILE_SEPARATOR') {|s| sep = s; ":/=#{s}" if s != "/"} || ""
conf << <<-MK.gsub(/^ +| +$/, '')
PWD =
LIBFFI_CONFIGURE = #{cmd}
LIBFFI_ARCH = #{libffi.arch}
LIBFFI_SRCDIR = #{libffi.srcdir.sub(libffi.dir, '$(LIBFFI_DIR)')}
LIBFFI_DIR = #{libffi.dir}
LIBFFI_A = #{libffi.a.sub(libffi.dir, '$(LIBFFI_DIR)')}
LIBFFI_CFLAGS = #{libffi.cflags}
LIBFFI_LDFLAGS = #{libffi.ldflags}
FFI_H = $(LIBFFI_DIR)/include/ffi.h
SUBMAKE_PRE = #{submake_pre}
SUBMAKE_ARG = #{submake_arg}
LIBFFI_CLEAN = libffi
MK
else
# skip building on Ruby implementations other than CRuby
File.write('Makefile', dummy_makefile("").join)
end

if libffi
Expand Down

0 comments on commit 504e1a2

Please sign in to comment.