summaryrefslogtreecommitdiff
path: root/tool/mkconfig.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-06 08:32:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-06 08:32:53 +0000
commit29c214e4a058fc4017ab0c0bf5c36b5bad203b5b (patch)
treeab2a45e9dc177e3f9b31d96588a922ba32d63aca /tool/mkconfig.rb
parentd32b122996778828f5d5f2ea58b0d2a8c0da7ede (diff)
configure.in: arch dependent library directory options
* configure.in (rubyarchprefix, sitearchdir, vendorarchdir): add options to customize architecture dependent library directories. * template/ruby.pc.in, tool/mkconfig.rb, tool/rbinstall.rb: use configured values. * tool/mkconfig.rb: expand rubyarchdir to extract prefix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-xtool/mkconfig.rb38
1 files changed, 22 insertions, 16 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 08b8c22..54b91a6 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -113,11 +113,10 @@ File.foreach "config.status" do |line|
end
end
end
+ vars[name] = val
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
@@ -133,7 +132,6 @@ File.foreach "config.status" do |line|
end
end
v = " CONFIG[\"#{name}\"] #{win32 && vars[name] ? '<< "\n"' : '='} #{val}\n"
- vars[name] = true
if fast[name]
v_fast << v
else
@@ -149,7 +147,26 @@ end
drive = File::PATH_SEPARATOR == ';'
-prefix = "/#{v_runtime[:libdir] || 'lib'}/ruby/#{version}/#{arch}"
+def vars.expand(val, config = self)
+ newval = val.gsub(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) {
+ var = $&
+ if !(v = $1 || $2)
+ '$'
+ elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
+ pat, sub = $1, $2
+ config[v] = false
+ config[v] = expand(key, config)
+ key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
+ key
+ else
+ var
+ end
+ }
+ val.replace(newval) unless newval == val
+ val
+end
+vars["prefix"] = ""
+prefix = vars.expand(vars["rubyarchdir"])
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
@@ -207,18 +224,7 @@ end
print(*v_fast)
print(*v_others)
print <<EOS
- CONFIG["rubylibdir"] = "$(rubylibprefix)/$(ruby_version)"
- CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
-EOS
-print <<EOS unless v_disabled["sitedir"]
- CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
- CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
-EOS
-print <<EOS unless v_disabled["vendordir"]
- CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
- CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
-EOS
-print <<EOS
+ CONFIG["archdir"] = "$(rubyarchdir)"
CONFIG["topdir"] = File.dirname(__FILE__)
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}