summaryrefslogtreecommitdiff
path: root/tool/mkconfig.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-16 12:46:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-16 12:46:44 +0000
commitf18d0400616b1f456214e05738badfc0f9369449 (patch)
treeaef23ef201b9db3761a79cf054c2f7b2c0a279c0 /tool/mkconfig.rb
parentb9b26300da434f0bca833aa6603274dcffe756b9 (diff)
* tool/mkconfig.rb (RbConfig): honor ARCHFLAGS and RC_ARCHS to
override embedded ARCH_FLAG value on universal-darwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-xtool/mkconfig.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 160b6e5..243ffa1 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -36,6 +36,7 @@ module RbConfig
arch = RUBY_PLATFORM
win32 = /mswin/ =~ arch
+universal = /universal.*darwin/ =~ arch
v_fast = []
v_others = []
vars = {}
@@ -115,8 +116,17 @@ File.foreach "config.status" do |line|
val.gsub!(/--with-out-ext/, "--without-ext")
end
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
- if /^prefix$/ =~ name
+ case name
+ when /^prefix$/
val = "(TOPDIR || DESTDIR + #{val})"
+ when /^ARCH_FLAG$/
+ val = "arch_flag || #{val}" if universal
+ when /^UNIVERSAL_ARCHNAMES$/
+ universal, val = val, 'universal' if universal
+ when /^arch$/
+ if universal
+ val.sub!(/universal/, %q[#{arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || '\&'}])
+ end
end
v = " CONFIG[\"#{name}\"] #{win32 && vars[name] ? '<< "\n"' : '='} #{val}\n"
vars[name] = true
@@ -138,6 +148,11 @@ drive = File::PATH_SEPARATOR == ';'
prefix = "/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
+ arch_flag = ENV['ARCHFLAGS'] || ((e = ENV['RC_ARCHS']) && e.split.uniq.map {|a| "-arch #{a}"}.join(' '))
+ arch = arch_flag && arch_flag[/\A\s*-arch\s+(\S+)\s*\z/, 1]
+ARCH
+print " universal = #{universal}\n"
print " CONFIG = {}\n"
print " CONFIG[\"DESTDIR\"] = DESTDIR\n"