Skip to content

Commit

Permalink
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -760,6 +760,28 @@ def cextc(cext_dir, *clang_opts)
sulong_link '-o', out, *config_libs, *lls
end

def cextc_extconf(cext_dir, *clang_opts)
abort "You need to set SULONG_HOME" unless SULONG_HOME

# Ensure ruby.su is up-to-date
ruby_cext_api = "#{JRUBY_DIR}/truffle/src/main/c/cext"
ruby_c = "#{JRUBY_DIR}/truffle/src/main/c/cext/ruby.c"
ruby_h = "#{JRUBY_DIR}/lib/ruby/truffle/cext/ruby.h"
ruby_su = "#{JRUBY_DIR}/lib/ruby/truffle/cext/ruby.su"
if cext_dir != ruby_cext_api and (newer?(ruby_h, ruby_su) or newer?(ruby_c, ruby_su))
puts "Compiling outdated ruby.su"
cextc ruby_cext_api
end

This comment has been minimized.

Copy link
@eregon

eregon Nov 14, 2016

Member

Please, no code duplication, this file is already long and complex enough 😉 => Extract Method


gem_name = File.basename(cext_dir)
gem_dir = Dir.glob(ENV['GEM_HOME'] + "/gems/#{gem_name}*/")[0] + "ext/#{gem_name}/"
Dir.chdir(gem_dir) do
run("extconf.rb")
raw_sh("make")
FileUtils.copy_file("#{gem_name}.su", "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}/lib/#{gem_name}/#{gem_name}.su")
end
end

def test(*args)
path, *rest = args

@@ -901,7 +923,12 @@ def test_cexts(*args)
unless gem_root and File.exist?(File.join(gem_root, CEXTC_CONF_FILE))
gem_root = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
end
cextc gem_root, '-Werror=implicit-function-declaration'
if gem_name == "ruby-argon2"
cextc gem_root, '-Werror=implicit-function-declaration'
else
cextc_extconf gem_root, '-Werror=implicit-function-declaration'
end

next if gem_name == 'psd_native' # psd_native is excluded just for running
run '--graal',
*dependencies.map { |d| "-I#{ENV['GEM_HOME']}/gems/#{d}/lib" },

2 comments on commit ed07dcc

@bjfish
Copy link
Contributor

@bjfish bjfish commented on ed07dcc Nov 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisseaton Let me know if you see any issues. It appears to be working as far as I can tell from the output.

@chrisseaton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can we switch to use this for building ruby.su and building all out test cexts? The minimum ones don't have extconf.rbs at the moment.

Please sign in to comment.