summaryrefslogtreecommitdiff
path: root/tool/mkconfig.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-xtool/mkconfig.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index a407ccfedb..e73cd29d62 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -39,6 +39,7 @@ win32 = /mswin/ =~ arch
universal = /universal.*darwin/ =~ arch
v_fast = []
v_others = []
+v_runtime = {}
vars = {}
continued_name = nil
continued_line = nil
@@ -115,6 +116,8 @@ File.foreach "config.status" do |line|
if name == "configure_args"
val.gsub!(/ +(?!-)/, "=") if win32
val.gsub!(/--with-out-ext/, "--without-ext")
+ elsif name == "libdir"
+ v_runtime[:libdir] = val[/\$(\(exec_prefix\)|\{exec_prefix\})\/(.*)/, 2]
end
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
case name
@@ -146,7 +149,7 @@ end
drive = File::PATH_SEPARATOR == ';'
-prefix = "/lib/ruby/#{version}/#{arch}"
+prefix = "/#{v_runtime[:libdir] || 'lib'}/ruby/#{version}/#{arch}"
print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n"
print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
print <<'ARCH' if universal