summaryrefslogtreecommitdiff
path: root/tool/mkconfig.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-27 15:35:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-27 15:35:15 +0000
commitbffd6395d6cd29e153bd16c81ffda9d9a055cb92 (patch)
tree2d9a6e5eb86199b11937b99acae40389daa53946 /tool/mkconfig.rb
parent8de619bee53b48353839f82d8198ce7e83f1832e (diff)
mkconfig.rb: fix empty prefix
* tool/mkconfig.rb: fix empty RbConfig::CONFIG["prefix"] when configured --with-rubyarchprefix, remove prefix from rubyarchdir after expansion for the case it does not start with '$(prefix)'. [fix GH-643] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-xtool/mkconfig.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index d108a51..79c97fa 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -167,10 +167,10 @@ def vars.expand(val, config = self)
val.replace(newval) unless newval == val
val
end
-vars["prefix"] = ""
-vars["exec_prefix"] = ""
-prefix = vars.expand(vars["rubyarchdir"])
-print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n"
+prefix = vars.expand(vars["prefix"])
+rubyarchdir = vars.expand(vars["rubyarchdir"])
+relative_archdir = rubyarchdir.rindex(prefix, 0) ? rubyarchdir[prefix.size..-1] : rubyarchdir
+print " TOPDIR = File.dirname(__FILE__).chomp!(#{relative_archdir.dump})\n"
print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
print <<'ARCH' if universal
arch_flag = ENV['ARCHFLAGS'] || ((e = ENV['RC_ARCHS']) && e.split.uniq.map {|a| "-arch #{a}"}.join(' '))