Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 72 lines (62 sloc) 1.84 kb
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
1 #!./miniruby
2
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
3 pure = true
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
4 while arg = ARGV[0]
5 break ARGV.shift if arg == '--'
6 /\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
7 arg, value = $1, $2
8 re = Regexp.new('\A'+arg.gsub(/\w+\b/, '\&\\w*')+'\z', "i")
9 case
10 when re =~ "srcdir"
11 srcdir = value
12 when re =~ "archdir"
13 archdir = value
14 when re =~ "extout"
15 extout = value
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
16 when re =~ "pure"
17 pure = (value != "no")
18 when re =~ "debugger"
19 debugger = value ? (value.split unless value == "no") : %w"gdb --args"
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
20 else
21 break
22 end
23 ARGV.shift
24 end
25
26 srcdir ||= File.dirname(__FILE__)
27 archdir ||= '.'
28
58f4fbc @nobu * runruby.rb: should load built rbconfig.rb.
nobu authored
29 abs_archdir = File.expand_path(archdir)
30 $:.unshift(abs_archdir)
31
32 require 'rbconfig'
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
33 config = RbConfig::CONFIG
58f4fbc @nobu * runruby.rb: should load built rbconfig.rb.
nobu authored
34
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
35 ruby = File.join(archdir, config["RUBY_INSTALL_NAME"]+config['EXEEXT'])
36 unless File.exist?(ruby)
37 abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
38 end
39
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
40 libs = [abs_archdir]
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
41 if extout
42 abs_extout = File.expand_path(extout)
8671cef @nobu * runruby.rb: extension library scripts moved into common directory.
nobu authored
43 libs << File.expand_path("common", abs_extout) << File.expand_path(RUBY_PLATFORM, abs_extout)
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
44 end
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
45 libs << File.expand_path("lib", srcdir)
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
46 config["bindir"] = abs_archdir
47 ENV["RUBY"] = File.expand_path(ruby)
48 ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
49
47b588c @nobu * ext/extmk.rb, ext/purelib.rb, lib/mkmf.rb, runruby.rb: clear default
nobu authored
50 if pure
51 libs << File.expand_path("ext", srcdir) << "-"
52 elsif e = ENV["RUBYLIB"]
1fc7f84 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
(no author) authored
53 libs |= e.split(File::PATH_SEPARATOR)
54 end
55 ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
56
57 libruby_so = File.join(abs_archdir, config['LIBRUBY_SO'])
58 if File.file?(libruby_so)
59 if e = config['LIBPATHENV'] and !e.empty?
60 ENV[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
61 end
62 if /linux/ =~ RUBY_PLATFORM
63 ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
64 end
65 end
66
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
67 cmd = [ruby]
47b588c @nobu * ext/extmk.rb, ext/purelib.rb, lib/mkmf.rb, runruby.rb: clear default
nobu authored
68 cmd << "-rpurelib.rb" if pure
34ef55e @nobu * runruby.rb: added --pure (turned on by default) and --debugger
nobu authored
69 cmd.concat(ARGV)
70 cmd.unshift(*debugger) if debugger
71 exec(*cmd)
Something went wrong with that request. Please try again.