diff options
Diffstat (limited to 'mkconfig.rb')
-rw-r--r-- | mkconfig.rb | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/mkconfig.rb b/mkconfig.rb index 175a4c3b15..272cfdcfc1 100644 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -28,11 +28,11 @@ has_srcdir = false has_version = false File.foreach "config.status" do |$_| next if /^#/ - if /^s%@program_transform_name@%s,(.*)%g$/ + if /^s[%,]@program_transform_name@[%,]s,(.*)[%,]/ next if $install_name ptn = $1.sub(/\$\$/, '$').split(/,/) #' v_fast << " CONFIG[\"ruby_install_name\"] = \"" + "ruby".sub(ptn[0],ptn[1]) + "\"\n" - elsif /^s%@(\w+)@%(.*)%g/ + elsif /^s[%,]@(\w+)@[%,](.*)[%,]/ name = $1 val = $2 || "" next if name =~ /^(INSTALL|DEFS|configure_input|srcdir|top_srcdir)$/ @@ -40,7 +40,7 @@ File.foreach "config.status" do |$_| next if $so_name and name =~ /^RUBY_SO_NAME$/ v = " CONFIG[\"" + name + "\"] = " + val.sub(/^\s*(.*)\s*$/, '"\1"').gsub(/\$\{?(\w+)\}?/) { - "\#{CONFIG[\\\"#{$1}\\\"]}" + "$(#{$1})" } + "\n" if fast[name] v_fast << v @@ -48,20 +48,7 @@ File.foreach "config.status" do |$_| v_others << v end has_version = true if name == "MAJOR" - if /DEFS/ - val.split(/\s*-D/).each do |i| - if i =~ /(.*)=(\\")?([^\\]*)(\\")?/ - key, val = $1, $3 - if val == '1' - val = "TRUE" - else - val.sub! /^\s*(.*)\s*$/, '"\1"' - end - print " CONFIG[\"#{key}\"] = #{val}\n" - end - end - end - elsif /^ac_given_srcdir=(.*)/ + elsif /^(?:ac_given_)?srcdir=(.*)/ v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path($1) + "\"\n" has_srcdir = true elsif /^ac_given_INSTALL=(.*)/ @@ -71,7 +58,7 @@ File.foreach "config.status" do |$_| end if not has_srcdir - v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path(srcdir) + "\"\n" + v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path(srcdir || '.') + "\"\n" end if not has_version @@ -102,6 +89,11 @@ end print v_fast, v_others print <<EOS + CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)" + CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)" + CONFIG["archdir"] = "$(rubylibdir)/$(arch)" + CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)" + CONFIG["sitearchdir"] = "$(sitelibdir)/$(arch)" CONFIG["compile_dir"] = "#{Dir.pwd}" MAKEFILE_CONFIG = {} CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup} @@ -109,7 +101,7 @@ print <<EOS val.gsub!(/\\$\\(([^()]+)\\)/) do |var| key = $1 if CONFIG.key? key - "\#{Config::expand(CONFIG[\\\"\#{key}\\\"])}" + Config::expand(CONFIG[key]) else var end |