1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/template/fake.rb.in
nobu b03c1d087b fake.rb.in: duplicated RUBYOPT
* template/fake.rb.in: removed duplicated options in RUBYOPT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-03 04:43:27 +00:00

50 lines
1.5 KiB
Ruby

<%
arg = {}
while /\A(\w+)=(.*)/ =~ ARGV[0]
arg[$1] = $2
arg[$1].tr!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
ARGV.shift
end
if inc = arg['i']
src = inc == '-' ? STDIN.read : File.read(inc)
def src.value(name)
eval(self[/\bruby_#{name}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
end
arg['versions'] = version = {}
File.read(File.join(arg['srcdir'], 'version.c')).
scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|STR)\(([^()]*)\)/m) do |n, v|
version[n] = src.value(v)
end
arg['RUBY_DESCRIPTION_WITH_JIT'] = src.value('description_with_jit')
end
%>baseruby="<%=arg['BASERUBY']%>"
_\
=begin
_=
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
class Object
remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
CROSS_COMPILING = RUBY_PLATFORM
constants.grep(/^RUBY_/) {|n| remove_const n}
% arg['versions'].each {|n, v|
<%=n%> = <%if n=='RUBY_DESCRIPTION' %>RubyVM.const_defined?(:MJIT) && RubyVM::MJIT.enabled? ?
<%=arg['RUBY_DESCRIPTION_WITH_JIT'].inspect%> :
<%end%><%=v.inspect%>
% }
end
builddir = File.dirname(File.expand_path(__FILE__))
srcdir = "<%=arg['srcdir']%>"
top_srcdir = File.realpath(srcdir, builddir)
fake = File.join(top_srcdir, "tool/fake.rb")
eval(File.read(fake), nil, fake)
ropt = "-r#{__FILE__}"
["RUBYOPT"].each do |flag|
opt = ENV[flag]
opt = opt ? ([ropt] | opt.split).join(" ") : ropt
ENV[flag] = opt
end