1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/configsub.rb
matz 08ec02b92b changes from personal modifies -- matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-12-28 05:00:47 +00:00

32 lines
779 B
Ruby

#!./miniruby -ps
BEGIN {
CONFIG = {}
VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) do
# overridden if config.status has version
CONFIG['MAJOR'] = $1
CONFIG['MINOR'] = $2
CONFIG['TEENY'] = $3
end
File.foreach($config || "config.status") do |line|
next if /^#/ =~ line
if /^s%@(\w+)@%(.*)%g/ =~ line
name = $1
val = $2 || ""
next if /^(INSTALL|DEFS|configure_input|srcdir)$/ =~ name
val.gsub!(/\$\{([^{}]+)\}/) { "$(#{$1})" }
CONFIG[name] = val
end
end
CONFIG['top_srcdir'] = File.expand_path($srcdir || ".")
CONFIG['RUBY_INSTALL_NAME'] = $install_name if $install_name
CONFIG['RUBY_SO_NAME'] = $so_name if $so_name
$defout = open($output, 'w') if $output
}
gsub!(/@(\w+)@/) {CONFIG[$1] || $&}
# vi:set sw=2: