1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/mkconfig.rb
matz 7422ccdd9e * signal.c (sighandle): should not re-register sighandler if
POSIX_SIGNAL is defined.

* eval.c (error_print): errat array may be empty.

* eval.c (rb_eval_cmd): should not upgrade safe level unless
  explicitly specified by argument newly added.

* signal.c (sig_trap): should not allow tainted trap closure.

* variable.c (rb_f_trace_var): should not allow trace_var on safe
  level higher than 3.

* variable.c (rb_f_trace_var): should not allow tainted trace
  closure.

* gc.c: do not use static stack until system stack overflows.

* eval.c (eval): should call Exception#exception instead of
  calling rb_exc_new3() directly.

* error.c (exc_exception): set "mesg" directly to the clone.  it
  might be better to set mesg via some method for flexibility.

* variable.c (cvar_override_check): should print original module
  name, if 'a' is T_ICLASS.

* parse.y (yylex): float '1_.0' should not be allowed.

* variable.c (var_getter): should care about var as Qfalse
  (ruby-bugs#PR199).

* array.c (cmpint): <=> or block for {min,max} may return bignum.

* array.c (sort_1): use rb_compint.

* array.c (sort_2): ditto.

* enum.c (min_ii): ditto.

* enum.c (min_ii): ditto.

* enum.c (max_i): ditto.

* enum.c (max_ii): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-13 08:19:52 +00:00

116 lines
3.3 KiB
Ruby

#!./miniruby -s
require File.dirname($0)+"/lib/ftools"
rbconfig_rb = ARGV[0] || 'rbconfig.rb'
srcdir = $srcdir if $srcdir
File.makedirs(File.dirname(rbconfig_rb), true)
version = RUBY_VERSION
config = open(rbconfig_rb, "w")
$stdout.reopen(config)
fast = {'prefix'=>TRUE, 'ruby_install_name'=>TRUE, 'INSTALL'=>TRUE, 'EXEEXT'=>TRUE}
print %[
module Config
RUBY_VERSION == "#{version}" or
raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})"
# This file was created by configrb when ruby was built. Any changes
# made to this file will be lost the next time ruby is built.
]
print " DESTDIR = '' if not defined? DESTDIR\n CONFIG = {}\n"
v_fast = []
v_others = []
has_srcdir = false
has_version = false
File.foreach "config.status" do |line|
next if /^#/ =~ line
if /^s[%,]@program_transform_name@[%,]s,(.*)/ =~ line
next if $install_name
ptn = $1.sub(/\$\$/, '$').split(/,/) #'
v_fast << " CONFIG[\"ruby_install_name\"] = \"" + "ruby".sub(ptn[0],ptn[1]) + "\"\n"
elsif /^s[%,]@(\w+)@[%,](.*)[%,]/ =~ line
name = $1
val = $2 || ""
next if /^(INSTALL|DEFS|configure_input|srcdir|top_srcdir)$/ =~ name
next if $install_name and /^RUBY_INSTALL_NAME$/ =~ name
next if $so_name and /^RUBY_SO_NAME$/ =~ name
v = " CONFIG[\"" + name + "\"] = " +
val.strip.gsub(/\$\{?(\w+)\}?/) {"$(#{$1})"}.dump + "\n"
if fast[name]
v_fast << v
else
v_others << v
end
has_version = true if name == "MAJOR"
elsif /^(?:ac_given_)?srcdir=(.*)/ =~ line
v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path($1) + "\"\n"
has_srcdir = true
elsif /^ac_given_INSTALL=(.*)/ =~ line
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
end
# break if /^CEOF/
end
if not has_srcdir
v_fast << " CONFIG[\"srcdir\"] = \"" + File.expand_path(srcdir || '.') + "\"\n"
end
if not has_version
RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n"
print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n"
print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n"
}
end
v_fast.collect! do |x|
if /"prefix"/ === x
prefix = Regexp.quote('/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM)
puts " TOPDIR = File.dirname(__FILE__).sub!(%r'#{prefix}\\Z', '')"
x.sub(/= (.*)/, '= (TOPDIR || DESTDIR + \1)')
else
x
end
end
if $install_name
v_fast << " CONFIG[\"ruby_install_name\"] = \"" + $install_name + "\"\n"
v_fast << " CONFIG[\"RUBY_INSTALL_NAME\"] = \"" + $install_name + "\"\n"
end
if $so_name
v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n"
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}
def Config::expand(val)
val.gsub!(/\\$\\(([^()]+)\\)/) do |var|
key = $1
if CONFIG.key? key
Config::expand(CONFIG[key])
else
var
end
end
val
end
CONFIG.each_value do |val|
Config::expand(val)
end
end
EOS
config.close
# vi:set sw=2: