mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	fake.rb.in: accurate fake
* template/fake.rb.in: turn into erb template from autoconf template to fake more accurately. * common.mk (fake.rb): needs preprocessed file now. * version.c (Init_version): add dummy expression to RUBY_ENGINE_VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									d3bce79183
								
							
						
					
					
						commit
						c5634371dc
					
				
					 4 changed files with 37 additions and 20 deletions
				
			
		
							
								
								
									
										10
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,13 @@
 | 
			
		|||
Wed Jun 10 11:06:25 2015  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* template/fake.rb.in: turn into erb template from autoconf
 | 
			
		||||
	  template to fake more accurately.
 | 
			
		||||
 | 
			
		||||
	* common.mk (fake.rb): needs preprocessed file now.
 | 
			
		||||
 | 
			
		||||
	* version.c (Init_version): add dummy expression to
 | 
			
		||||
	  RUBY_ENGINE_VERSION.
 | 
			
		||||
 | 
			
		||||
Tue Jun  9 12:31:25 2015  Marc-Andre Lafortune  <ruby-core@marc-andre.ca>
 | 
			
		||||
 | 
			
		||||
	* lib/prime.rb: Simplify and optimize EratosthenesSieve
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -549,10 +549,10 @@ fake: $(CROSS_COMPILING)-fake
 | 
			
		|||
yes-fake: $(arch)-fake.rb $(RBCONFIG) PHONY
 | 
			
		||||
no-fake: PHONY
 | 
			
		||||
 | 
			
		||||
$(arch)-fake.rb: $(RBCONFIG) $(srcdir)/template/fake.rb.in $(srcdir)/tool/expand-config.rb rbconfig.rb
 | 
			
		||||
	@$(BOOTSTRAPRUBY) $(srcdir)/tool/expand-config.rb \
 | 
			
		||||
		-output=$@ -mode=$(INSTALL_PROG_MODE) -expand -config=rbconfig.rb \
 | 
			
		||||
		srcdir="$(srcdir)" BASERUBY="$(BASERUBY)" $(srcdir)/template/fake.rb.in
 | 
			
		||||
$(arch)-fake.rb: $(srcdir)/template/fake.rb.in $(srcdir)/tool/generic_erb.rb version.i
 | 
			
		||||
	$(ECHO) generating $@
 | 
			
		||||
	@$(BOOTSTRAPRUBY) $(srcdir)/tool/generic_erb.rb -c -o $@ $(srcdir)/template/fake.rb.in \
 | 
			
		||||
		i=version.i srcdir="$(srcdir)" BASERUBY="$(BASERUBY)"
 | 
			
		||||
 | 
			
		||||
btest: $(TEST_RUNNABLE)-btest
 | 
			
		||||
no-btest: PHONY
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,18 @@
 | 
			
		|||
baseruby="@BASERUBY@"
 | 
			
		||||
<%
 | 
			
		||||
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 = {}
 | 
			
		||||
  src.scan(/rb_define_global_const\("(RUBY_\w+)",\s*(?:.*rb_\w*str_new\w*\((\w+)|\(*\(VALUE\)\((.+)\)\)\s*<<\s?)/) do |n, s, i|
 | 
			
		||||
    version[n] = i ? i.to_i : src[/\b#{s}\[\]\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*);/m, 1].gsub(/\A"|"\z|" *"/, '').gsub(/\\(.)/, '\1')
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
%>baseruby="<%=arg['BASERUBY']%>"
 | 
			
		||||
ruby="${RUBY-$baseruby}"
 | 
			
		||||
_=
 | 
			
		||||
"eval" "{" \
 | 
			
		||||
| 
						 | 
				
			
			@ -10,20 +24,13 @@ ruby=ruby
 | 
			
		|||
class Object
 | 
			
		||||
  remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
 | 
			
		||||
  CROSS_COMPILING = RUBY_PLATFORM
 | 
			
		||||
  remove_const :RUBY_PLATFORM
 | 
			
		||||
  remove_const :RUBY_VERSION
 | 
			
		||||
  remove_const :RUBY_PATCHLEVEL
 | 
			
		||||
  remove_const :RUBY_RELEASE_DATE
 | 
			
		||||
  remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
 | 
			
		||||
  RUBY_PLATFORM = "@arch@"
 | 
			
		||||
  RUBY_VERSION = "@RUBY_PROGRAM_VERSION@"
 | 
			
		||||
  RUBY_PATCHLEVEL = @PATCHLEVEL@
 | 
			
		||||
  RUBY_RELEASE_DATE = "@RUBY_RELEASE_DATE@"
 | 
			
		||||
  patchlevel_str = RUBY_PATCHLEVEL == -1 ? "dev" : "p#{RUBY_PATCHLEVEL}"
 | 
			
		||||
  RUBY_DESCRIPTION = "ruby #{RUBY_VERSION}#{patchlevel_str} (#{RUBY_RELEASE_DATE}) [#{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("@srcdir@", builddir)
 | 
			
		||||
top_srcdir = File.expand_path("<%=arg['srcdir']%>", builddir)
 | 
			
		||||
$:.unshift(builddir)
 | 
			
		||||
fake = File.join(top_srcdir, "tool/fake.rb")
 | 
			
		||||
eval(File.read(fake), nil, fake)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,11 +38,11 @@ VALUE ruby_engine_name = Qnil;
 | 
			
		|||
void
 | 
			
		||||
Init_version(void)
 | 
			
		||||
{
 | 
			
		||||
    VALUE v = MKSTR(version);
 | 
			
		||||
    VALUE version;
 | 
			
		||||
    /*
 | 
			
		||||
     * The running version of ruby
 | 
			
		||||
     */
 | 
			
		||||
    rb_define_global_const("RUBY_VERSION", v);
 | 
			
		||||
    rb_define_global_const("RUBY_VERSION", (version = MKSTR(version)));
 | 
			
		||||
    /*
 | 
			
		||||
     * The date this ruby was released
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ Init_version(void)
 | 
			
		|||
    /*
 | 
			
		||||
     * The version of the engine or interpreter this ruby uses.
 | 
			
		||||
     */
 | 
			
		||||
    rb_define_global_const("RUBY_ENGINE_VERSION", v);
 | 
			
		||||
    rb_define_global_const("RUBY_ENGINE_VERSION", (1 ? version : MKSTR(version)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*! Prints the version information of the CRuby interpreter to stdout. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue