ruby-changes:39673
From: nobu <ko1@a...>
Date: Fri, 4 Sep 2015 01:30:45 +0900 (JST)
Subject: [ruby-changes:39673] nobu:r51754 (trunk): verconf.h.tmpl: separate RbConfig
nobu 2015-09-04 01:30:40 +0900 (Fri, 04 Sep 2015) New Revision: 51754 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51754 Log: verconf.h.tmpl: separate RbConfig * template/verconf.h.tmpl: load rbconfig.rb into a separate namespace get rid of conflict with the default RbConfig, to run with BASERUBY. Modified files: trunk/template/verconf.h.tmpl Index: template/verconf.h.tmpl =================================================================== --- template/verconf.h.tmpl (revision 51753) +++ template/verconf.h.tmpl (revision 51754) @@ -1,5 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/template/verconf.h.tmpl#L1 -% require './rbconfig' -% C = RbConfig::MAKEFILE_CONFIG.dup +% config = File.read(conffile = 'rbconfig.rb') +% config.sub!(/^(\s*)RUBY_VERSION\b.*(\sor\s*)$/, '\1true\2') +% rbconfig = Module.new {module_eval(config, conffile)}::RbConfig +% C = rbconfig::MAKEFILE_CONFIG.dup % def C.[](name) str = super and (str unless str.empty?); end #define RUBY_BASE_NAME "${RUBY_BASE_NAME}" #define RUBY_VERSION_NAME RUBY_BASE_NAME"-"RUBY_LIB_VERSION @@ -49,12 +51,12 @@ https://github.com/ruby/ruby/blob/trunk/template/verconf.h.tmpl#L51 % R["rubysitearchprefix"] = '"RUBY_SITEARCH_PREFIX_FOR(arch)"' % R["exec_prefix"] = '"RUBY_EXEC_PREFIX"' % R["prefix"] = '"RUBY_EXEC_PREFIX"' -% exec_prefix_pat = /\A"#{Regexp.quote(RbConfig::CONFIG['exec_prefix'])}(?=\/|\z)/ +% exec_prefix_pat = /\A"#{Regexp.quote(rbconfig::CONFIG['exec_prefix'])}(?=\/|\z)/ % _erbout.gsub!(/^(#define\s+(\S+)\s+)(.*)/) { % pre, name, repl = $1, $2, $3 % pat = %["#{name}"] % c = C.merge(R.reject {|key, value| key == name or value.include?(pat)}) -% RbConfig.expand(repl, c) +% rbconfig.expand(repl, c) % repl.gsub!(/^""(?!$)|(.)""$/, '\1') % repl.sub!(exec_prefix_pat, 'RUBY_EXEC_PREFIX"') % pre + repl -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/