diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-15 03:32:26 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-15 03:32:26 +0000 |
commit | afb554d90a742933f7f45ecd4f443ba427508e92 (patch) | |
tree | d7a4734ebe5f06696c4b34bbed49be59bbe96c97 | |
parent | 3b37c7456406b7b9423c5fe0399f792be37e7d27 (diff) | |
download | ruby-afb554d90a742933f7f45ecd4f443ba427508e92.tar.gz |
* tool/compile_prelude.rb: use constant for prefix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | tool/compile_prelude.rb | 9 |
2 files changed, 10 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Thu Nov 15 12:31:13 2007 Tanaka Akira <akr@fsij.org> + + * tool/compile_prelude.rb: use constant for prefix. + Thu Nov 15 12:24:39 2007 Tanaka Akira <akr@fsij.org> * tool/compile_prelude.rb: use simple template system for source diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb index 1884cd08a2..ea77729311 100644 --- a/tool/compile_prelude.rb +++ b/tool/compile_prelude.rb @@ -23,6 +23,7 @@ end mkconf = nil setup_ruby_prefix = nil +teardown_ruby_prefix = nil lines_list = preludes.map {|filename| lines = [] need_ruby_prefix = false @@ -30,13 +31,14 @@ lines_list = preludes.map {|filename| line.gsub!(/RbConfig::CONFIG\["(\w+)"\]/) { unless mkconf require 'rbconfig' - mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{ruby_prefix}') + mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}') exlen = $:.grep(%r{\A/}).last.length - RbConfig::CONFIG["prefix"].length - setup_ruby_prefix = "ruby_prefix = $:.grep(%r{\\A/}).last[0..#{-exlen-1}]\n" + setup_ruby_prefix = "TMP_RUBY_PREFIX = $:.grep(%r{\\A/}).last[0..#{-exlen-1}]\n" + teardown_ruby_prefix = 'Object.class_eval { remove_const "TMP_RUBY_PREFIX" }' end if RbConfig::MAKEFILE_CONFIG.has_key? $1 val = RbConfig.expand("$(#$1)", mkconf) - need_ruby_prefix = true if /\A\#{ruby_prefix\}/ =~ val + need_ruby_prefix = true if /\A\#{TMP_RUBY_PREFIX\}/ =~ val c_esc(val) else $& @@ -47,6 +49,7 @@ lines_list = preludes.map {|filename| setup_lines = [] if need_ruby_prefix setup_lines << c_esc(setup_ruby_prefix) + lines << c_esc(teardown_ruby_prefix) end [setup_lines, lines] } |