Skip to content

Commit

Permalink
[Truffle] JT: extract method.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Nov 14, 2016
1 parent ed07dcc commit a7afede
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tool/jt.rb
Expand Up @@ -690,7 +690,7 @@ def command_p(*args)
e 'p begin', *args, 'end'
end

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

# Ensure ruby.su is up-to-date
Expand All @@ -702,6 +702,11 @@ def cextc(cext_dir, *clang_opts)
puts "Compiling outdated ruby.su"
cextc ruby_cext_api
end
end
private :build_ruby_su

def cextc(cext_dir, *clang_opts)
build_ruby_su

config_file = File.join(cext_dir, CEXTC_CONF_FILE)
unless File.exist?(config_file)
Expand Down Expand Up @@ -761,17 +766,7 @@ def cextc(cext_dir, *clang_opts)
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
build_ruby_su

gem_name = File.basename(cext_dir)
gem_dir = Dir.glob(ENV['GEM_HOME'] + "/gems/#{gem_name}*/")[0] + "ext/#{gem_name}/"
Expand Down

0 comments on commit a7afede

Please sign in to comment.