From ebb03a0b82e6faec1941bedcdd610e68dc124ab5 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 3 Sep 2015 16:30:40 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- template/verconf.h.tmpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'template') diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl index 5ee8a0e472..9325aee0ff 100644 --- a/template/verconf.h.tmpl +++ b/template/verconf.h.tmpl @@ -1,5 +1,7 @@ -% 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 @@ % 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 -- cgit v1.2.3