5 break ARGV.shift if arg == '--'
6 /\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
8 re = Regexp.new('\A'+arg.gsub(/\w+\b/, '\&\\w*')+'\z', "i")
17 pure = (value != "no")
19 debugger = value ? (value.split unless value == "no") : %w"gdb --args"
26 srcdir ||= File.dirname(__FILE__)
29 abs_archdir = File.expand_path(archdir)
30 $:.unshift(abs_archdir)
33 config = RbConfig::CONFIG
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"
42 abs_extout = File.expand_path(extout)
43 libs << File.expand_path("common", abs_extout) << File.expand_path(RUBY_PLATFORM, abs_extout)
45 libs << File.expand_path("lib", srcdir)
46 config["bindir"] = abs_archdir
47 ENV["RUBY"] = File.expand_path(ruby)
48 ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
51 libs << File.expand_path("ext", srcdir) << "-"
52 elsif e = ENV["RUBYLIB"]
53 libs |= e.split(File::PATH_SEPARATOR)
55 ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
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)
62 if /linux/ =~ RUBY_PLATFORM
63 ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
68 cmd << "-rpurelib.rb" if pure
70 cmd.unshift(*debugger) if debugger