$NetBSD$

Add install_root option for pkgsrc's rubygems support.

--- lib/rubygems/uninstaller.rb.orig	2010-02-22 02:52:35.000000000 +0000
+++ lib/rubygems/uninstaller.rb
@@ -50,6 +50,11 @@ class Gem::Uninstaller
     @force_all = options[:all]
     @force_ignore = options[:ignore]
     @bin_dir = options[:bin_dir]
+    install_root = options[:install_root]
+    unless install_root.nil? or install_root == ""
+      @install_root = File.expand_path install_root
+      @gem_home = File.join(@install_root, @gem_home)
+    end
 
     # only add user directory if install_dir is not set
     @user_install = false
@@ -124,7 +129,11 @@ class Gem::Uninstaller
     return if spec.nil?
 
     unless spec.executables.empty? then
-      bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
+      bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home, @install_root)
+
+      unless @install_root.nil? or @install_root == ""
+        bindir = File.join(@install_root, bindir)
+      end
 
       list = @source_index.find_name(spec.name).delete_if { |s|
         s.version == spec.version
