$NetBSD: patch-ag,v 1.7 2010/09/10 03:48:40 taca Exp $

Add install_root option for pkgsrc's rubygems support.

--- lib/rubygems/uninstaller.rb.orig	2009-06-22 22:54:36.000000000 +0000
+++ lib/rubygems/uninstaller.rb
@@ -51,6 +51,12 @@ class Gem::Uninstaller
     @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
     @user_install = options[:user_install] unless options[:install_dir]
@@ -124,7 +130,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
