2015-06-10 05:06:28 +03:00
|
|
|
<%
|
|
|
|
arg = {}
|
|
|
|
while /\A(\w+)=(.*)/ =~ ARGV[0]
|
|
|
|
arg[$1] = $2
|
|
|
|
arg[$1].tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
|
|
|
ARGV.shift
|
|
|
|
end
|
2015-07-29 05:06:38 +03:00
|
|
|
if inc = arg['i']
|
|
|
|
src = inc == '-' ? STDIN.read : File.read(inc)
|
2018-05-29 11:47:07 +03:00
|
|
|
def src.value(name)
|
|
|
|
eval(self[/\bruby_#{name}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
|
|
|
|
end
|
2015-06-10 05:06:28 +03:00
|
|
|
arg['versions'] = version = {}
|
2015-06-11 11:07:49 +03:00
|
|
|
File.read(File.join(arg['srcdir'], 'version.c')).
|
|
|
|
scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|STR)\(([^()]*)\)/m) do |n, v|
|
2018-05-29 11:47:07 +03:00
|
|
|
version[n] = src.value(v)
|
2015-06-10 05:06:28 +03:00
|
|
|
end
|
2018-05-30 02:28:50 +03:00
|
|
|
arg['RUBY_DESCRIPTION_WITH_JIT'] = src.value('description_with_jit')
|
2015-06-10 05:06:28 +03:00
|
|
|
end
|
|
|
|
%>baseruby="<%=arg['BASERUBY']%>"
|
2015-11-22 09:42:14 +03:00
|
|
|
_\
|
|
|
|
=begin
|
2015-04-13 02:24:33 +03:00
|
|
|
_=
|
2015-11-22 09:42:14 +03:00
|
|
|
ruby="${RUBY-$baseruby}"
|
|
|
|
case "$ruby" in "echo "*) $ruby; exit $?;; esac
|
|
|
|
case "$0" in /*) r=-r"$0";; *) r=-r"./$0";; esac
|
|
|
|
exec $ruby "$r" "$@"
|
|
|
|
=end
|
|
|
|
=baseruby
|
2009-02-19 09:47:13 +03:00
|
|
|
class Object
|
2011-02-11 05:39:05 +03:00
|
|
|
remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
|
2009-02-19 09:47:13 +03:00
|
|
|
CROSS_COMPILING = RUBY_PLATFORM
|
2015-06-10 05:06:28 +03:00
|
|
|
constants.grep(/^RUBY_/) {|n| remove_const n}
|
|
|
|
% arg['versions'].each {|n, v|
|
2018-06-15 03:06:33 +03:00
|
|
|
<%=n%> = <%if n=='RUBY_DESCRIPTION' %>RubyVM.const_defined?(:MJIT) && RubyVM::MJIT.enabled? ?
|
2018-05-30 02:28:50 +03:00
|
|
|
<%=arg['RUBY_DESCRIPTION_WITH_JIT'].inspect%> :
|
|
|
|
<%end%><%=v.inspect%>
|
2015-06-10 05:06:28 +03:00
|
|
|
% }
|
2009-02-19 09:47:13 +03:00
|
|
|
end
|
2015-04-13 02:25:21 +03:00
|
|
|
builddir = File.dirname(File.expand_path(__FILE__))
|
2015-09-04 13:06:49 +03:00
|
|
|
srcdir = "<%=arg['srcdir']%>"
|
|
|
|
top_srcdir = File.realpath(srcdir, builddir)
|
2014-07-06 09:20:10 +04:00
|
|
|
fake = File.join(top_srcdir, "tool/fake.rb")
|
|
|
|
eval(File.read(fake), nil, fake)
|
2015-02-25 20:19:57 +03:00
|
|
|
ENV["RUBYOPT"] = ["-r#{__FILE__}", ENV["RUBYOPT"]].compact.join(" ")
|