$NetBSD$

Add install_root option for pkgsrc's rubygems support.

--- lib/rubygems.rb.orig	2010-08-26 08:25:09.000000000 +0000
+++ lib/rubygems.rb
@@ -353,7 +353,10 @@ module Gem
   ##
   # The path where gem executables are to be installed.
 
-  def self.bindir(install_dir=Gem.dir)
+  def self.bindir(install_dir=Gem.dir, install_root=nil)
+    unless install_root.nil?
+      install_dir = install_dir.sub(install_root, "")
+    end
     return File.join(install_dir, 'bin') unless
       install_dir.to_s == Gem.default_dir
     Gem.default_bindir
@@ -576,7 +579,7 @@ module Gem
   ##
   # The index to insert activated gem paths into the $LOAD_PATH.
   #
-  # Defaults to the site lib directory unless gem_prelude.rb has loaded paths,
+  # Defaults to the vendor lib directory unless gem_prelude.rb has loaded paths,
   # then it inserts the activated gem's paths before the gem_prelude.rb paths
   # so you can override the gem_prelude.rb default $LOAD_PATH paths.
 
@@ -687,6 +690,7 @@ module Gem
     prefix = File.dirname dir
 
     if prefix == File.expand_path(ConfigMap[:sitelibdir]) or
+       prefix == File.expand_path(ConfigMap[:vendorlibdir]) or
        prefix == File.expand_path(ConfigMap[:libdir]) or
        'lib' != File.basename(dir) then
       nil
