ruby-changes:37802
From: nobu <ko1@a...>
Date: Sat, 7 Mar 2015 11:06:26 +0900 (JST)
Subject: [ruby-changes:37802] nobu:r49883 (trunk): expand-config.rb: without fake.rb
nobu 2015-03-07 11:06:18 +0900 (Sat, 07 Mar 2015) New Revision: 49883 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49883 Log: expand-config.rb: without fake.rb * win32/Makefile.sub (ruby_pc): without fake.rb. * tool/expand-config.rb: no longer depends on fake.rb. Modified files: trunk/tool/expand-config.rb trunk/win32/Makefile.sub Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 49882) +++ win32/Makefile.sub (revision 49883) @@ -1075,8 +1075,9 @@ end https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L1075 <<KEEP $(ruby_pc): $(RBCONFIG) - @$(MINIRUBY) -r./rbconfig $(srcdir)/tool/expand-config.rb \ - $(srcdir)/template/ruby.pc.in > $@ + @$(BOOTSTRAPRUBY) $(srcdir)/tool/expand-config.rb \ + -output=$@ -mode=$(INSTALL_DATA_MODE) -config=rbconfig.rb \ + $(srcdir)/template/ruby.pc.in {$(srcdir)/enc/trans}.c.obj: $(ECHO) compiling $(<:\=/) Index: tool/expand-config.rb =================================================================== --- tool/expand-config.rb (revision 49882) +++ tool/expand-config.rb (revision 49883) @@ -1,7 +1,32 @@ https://github.com/ruby/ruby/blob/trunk/tool/expand-config.rb#L1 -STDOUT.binmode +#!./miniruby -s + +config = File.read(conffile = $config) +config.sub!(/^(\s*)RUBY_VERSION\b.*(\sor\s*)$/, '\1true\2') +rbconfig = Module.new {module_eval(config, conffile)}::RbConfig +config = $expand ? rbconfig::CONFIG : rbconfig::MAKEFILE_CONFIG +config["RUBY_RELEASE_DATE"] ||= + File.read(File.expand_path("../../version.h", __FILE__))[/^\s*#\s*define\s+RUBY_RELEASE_DATE\s+"(.*)"/, 1] + +while /\A(\w+)=(.*)/ =~ ARGV[0] + config[$1] = $2 + ARGV.shift +end + +re = /@(#{config.keys.map {|k| Regexp.quote(k)}.join('|')})@/ + +if $output + output = open($output, "wb", $mode &&= $mode.oct) + output.chmod($mode) if $mode +else + output = STDOUT + output.binmode +end + ARGF.each do |line| line.gsub!(/@([a-z_]\w*)@/i) { - (RbConfig::MAKEFILE_CONFIG[$1] or "").gsub(/\$\((.+?)\)/, %Q[${\\1}]) + s = config.fetch($1, $expand ? $& : "") + s = s.gsub(/\$\((.+?)\)/, %Q[${\\1}]) unless $expand + s } - puts line + output.puts line end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/