mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* template/fake.rb.in: scan MKSTR and MKINT from version.c and then extract the value for them from version.i. * version.c (Init_version): use MKINT as the marker. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.2 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 arg['i']
 | 
						|
  src = File.read(arg['i'])
 | 
						|
  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] =
 | 
						|
        eval(src[/\bruby_#{v}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
 | 
						|
  end
 | 
						|
end
 | 
						|
%>baseruby="<%=arg['BASERUBY']%>"
 | 
						|
ruby="${RUBY-$baseruby}"
 | 
						|
_=
 | 
						|
"eval" "{" \
 | 
						|
"`expr \"$ruby\" : echo > /dev/null || echo exec`" \
 | 
						|
"$ruby" '-r"`expr \"$0\" : / > /dev/null || pwd`/${0#/}" "$@";' \
 | 
						|
"}" || "exit" "$?"
 | 
						|
_=baseruby
 | 
						|
ruby=ruby
 | 
						|
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%> = <%=v.inspect%>
 | 
						|
% }
 | 
						|
end
 | 
						|
builddir = File.dirname(File.expand_path(__FILE__))
 | 
						|
top_srcdir = File.expand_path("<%=arg['srcdir']%>", builddir)
 | 
						|
$:.unshift(builddir)
 | 
						|
fake = File.join(top_srcdir, "tool/fake.rb")
 | 
						|
eval(File.read(fake), nil, fake)
 | 
						|
ENV["RUBYOPT"] = ["-r#{__FILE__}", ENV["RUBYOPT"]].compact.join(" ")
 |