$NetBSD: patch-ag,v 1.2 2008/09/15 08:43:44 taca Exp $

--- lib/rubygems/uninstaller.rb.orig	2008-06-21 03:34:46.000000000 +0900
+++ lib/rubygems/uninstaller.rb
@@ -31,6 +31,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
   end
 
   ##
@@ -74,7 +79,11 @@ class Gem::Uninstaller
     return if gemspec.nil?
 
     if gemspec.executables.size > 0 then
-      bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home)
+      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 = Gem.source_index.search(gemspec.name).delete_if { |spec|
         spec.version == gemspec.version
