2015-06-09 22:06:28 -04: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-28 22:06:38 -04:00
|
|
|
if inc = arg['i']
|
|
|
|
src = inc == '-' ? STDIN.read : File.read(inc)
|
2015-06-09 22:06:28 -04:00
|
|
|
arg['versions'] = version = {}
|
2015-06-11 04:07:49 -04:00
|
|
|
File.read(File.join(arg['srcdir'], 'version.c')).
|
|
|
|
scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|STR)\(([^()]*)\)/m) do |n, v|
|
|
|
|
version[n] =
|
|
|
|
eval(src[/\bruby_#{v}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
|
2015-06-09 22:06:28 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
%>baseruby="<%=arg['BASERUBY']%>"
|
2010-04-05 22:21:40 -04:00
|
|
|
ruby="${RUBY-$baseruby}"
|
2015-04-12 19:24:33 -04:00
|
|
|
_=
|
2011-01-22 20:32:57 -05:00
|
|
|
"eval" "{" \
|
|
|
|
"`expr \"$ruby\" : echo > /dev/null || echo exec`" \
|
|
|
|
"$ruby" '-r"`expr \"$0\" : / > /dev/null || pwd`/${0#/}" "$@";' \
|
|
|
|
"}" || "exit" "$?"
|
2015-04-13 03:40:28 -04:00
|
|
|
_=baseruby
|
2011-01-22 20:32:57 -05:00
|
|
|
ruby=ruby
|
2009-02-19 01:47:13 -05:00
|
|
|
class Object
|
2011-02-10 21:39:05 -05:00
|
|
|
remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
|
2009-02-19 01:47:13 -05:00
|
|
|
CROSS_COMPILING = RUBY_PLATFORM
|
2015-06-09 22:06:28 -04:00
|
|
|
constants.grep(/^RUBY_/) {|n| remove_const n}
|
|
|
|
% arg['versions'].each {|n, v|
|
|
|
|
<%=n%> = <%=v.inspect%>
|
|
|
|
% }
|
2009-02-19 01:47:13 -05:00
|
|
|
end
|
2015-04-12 19:25:21 -04:00
|
|
|
builddir = File.dirname(File.expand_path(__FILE__))
|
2015-09-04 06:06:49 -04:00
|
|
|
srcdir = "<%=arg['srcdir']%>"
|
|
|
|
top_srcdir = File.realpath(srcdir, builddir)
|
2014-07-06 01:20:10 -04:00
|
|
|
fake = File.join(top_srcdir, "tool/fake.rb")
|
|
|
|
eval(File.read(fake), nil, fake)
|
2015-02-25 12:19:57 -05:00
|
|
|
ENV["RUBYOPT"] = ["-r#{__FILE__}", ENV["RUBYOPT"]].compact.join(" ")
|