2004-02-09 11:48:55 +03:00
|
|
|
#!./miniruby
|
|
|
|
|
|
|
|
while arg = ARGV[0]
|
|
|
|
break ARGV.shift if arg == '--'
|
|
|
|
/\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
|
|
|
|
arg, value = $1, $2
|
|
|
|
re = Regexp.new('\A'+arg.gsub(/\w+\b/, '\&\\w*')+'\z', "i")
|
|
|
|
case
|
|
|
|
when re =~ "srcdir"
|
|
|
|
srcdir = value
|
|
|
|
when re =~ "archdir"
|
|
|
|
archdir = value
|
|
|
|
when re =~ "extout"
|
|
|
|
extout = value
|
|
|
|
else
|
|
|
|
break
|
|
|
|
end
|
|
|
|
ARGV.shift
|
|
|
|
end
|
|
|
|
|
|
|
|
srcdir ||= File.dirname(__FILE__)
|
|
|
|
archdir ||= '.'
|
|
|
|
|
2005-06-23 18:56:40 +04:00
|
|
|
abs_archdir = File.expand_path(archdir)
|
|
|
|
$:.unshift(abs_archdir)
|
|
|
|
|
|
|
|
require 'rbconfig'
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 11:34:53 +03:00
|
|
|
config = RbConfig::CONFIG
|
2005-06-23 18:56:40 +04:00
|
|
|
|
2004-02-09 11:48:55 +03:00
|
|
|
ruby = File.join(archdir, config["RUBY_INSTALL_NAME"]+config['EXEEXT'])
|
|
|
|
unless File.exist?(ruby)
|
|
|
|
abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
libs = [abs_archdir, File.expand_path("lib", srcdir)]
|
|
|
|
if extout
|
|
|
|
abs_extout = File.expand_path(extout)
|
|
|
|
libs << abs_extout << File.expand_path(RUBY_PLATFORM, abs_extout)
|
|
|
|
end
|
|
|
|
config["bindir"] = abs_archdir
|
2004-04-08 14:45:21 +04:00
|
|
|
ENV["RUBY"] = File.expand_path(ruby)
|
|
|
|
ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
|
2004-02-09 11:48:55 +03:00
|
|
|
|
|
|
|
if e = ENV["RUBYLIB"]
|
|
|
|
libs |= e.split(File::PATH_SEPARATOR)
|
|
|
|
end
|
|
|
|
ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
|
|
|
|
|
2004-12-07 21:26:46 +03:00
|
|
|
libruby_so = File.join(abs_archdir, config['LIBRUBY_SO'])
|
|
|
|
if File.file?(libruby_so)
|
|
|
|
if e = config['LIBPATHENV'] and !e.empty?
|
|
|
|
ENV[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
|
|
|
|
end
|
|
|
|
if /linux/ =~ RUBY_PLATFORM
|
|
|
|
ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
|
|
|
|
end
|
2004-02-09 11:48:55 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
exec ruby, *ARGV
|