Blame SOURCES/ruby-1.9.3-custom-rubygems-location.patch

79386f
From b5e9dc3683cb085aa57e7b12c35a4f21b2cc1482 Mon Sep 17 00:00:00 2001
79386f
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
79386f
Date: Fri, 11 Nov 2011 13:14:45 +0100
79386f
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
79386f
 Ruby tree.
79386f
79386f
---
79386f
 configure.in      | 8 ++++++++
79386f
 tool/rbinstall.rb | 9 +++++++++
79386f
 version.c         | 4 ++++
79386f
 3 files changed, 21 insertions(+)
79386f
79386f
diff --git a/configure.in b/configure.in
79386f
index 1627d12..e064b2b 100644
79386f
--- a/configure.in
79386f
+++ b/configure.in
c3d42c
@@ -3401,6 +3401,13 @@ AC_ARG_WITH(vendorarchdir,
79386f
             [vendorarchdir=$withval],
79386f
             [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
79386f
 
79386f
+AC_ARG_WITH(rubygemsdir,
79386f
+           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
79386f
+            [rubygemsdir=$withval])
79386f
+if test "$rubygemsdir" != ""; then
79386f
+    AC_DEFINE_UNQUOTED(RUBYGEMS_DIR,"$rubygemsdir" !<verconf>!)
79386f
+fi
79386f
+
79386f
 unexpand_shvar rubylibprefix       exec_prefix libdir RUBY_BASE_NAME
79386f
 unexpand_shvar rubyarchprefix      exec_prefix libdir arch RUBY_BASE_NAME archlibdir rubylibprefix
79386f
 unexpand_shvar rubysitearchprefix  exec_prefix libdir sitearch arch RUBY_BASE_NAME archlibdir sitearchlibdir rubylibprefix
c3d42c
@@ -3467,6 +3474,7 @@ AC_SUBST(sitearchdir)dnl
79386f
 AC_SUBST(vendordir)dnl
79386f
 AC_SUBST(vendorlibdir)dnl
79386f
 AC_SUBST(vendorarchdir)dnl
79386f
+AC_SUBST(rubygemsdir)dnl
79386f
 
79386f
 configure_args=$ac_configure_args
79386f
 AC_SUBST(configure_args)dnl
79386f
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
79386f
index 92e54c6..c72dfb6 100755
79386f
--- a/tool/rbinstall.rb
79386f
+++ b/tool/rbinstall.rb
c3d42c
@@ -320,6 +320,7 @@ sitelibdir = CONFIG["sitelibdir"]
79386f
 sitearchlibdir = CONFIG["sitearchdir"]
79386f
 vendorlibdir = CONFIG["vendorlibdir"]
79386f
 vendorarchlibdir = CONFIG["vendorarchdir"]
79386f
+rubygemsdir = CONFIG["rubygemsdir"]
79386f
 mandir = CONFIG["mandir", true]
79386f
 docdir = CONFIG["docdir", true]
79386f
 configure_args = Shellwords.shellwords(CONFIG["configure_args"])
c3d42c
@@ -507,7 +508,15 @@ end
79386f
 install?(:local, :comm, :lib) do
79386f
   prepare "library scripts", rubylibdir
79386f
   noinst = %w[README* *.txt *.rdoc *.gemspec]
79386f
+  noinst += %w[*ubygems.rb rubygems/ datadir.rb] if rubygemsdir
79386f
   install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
79386f
+  if rubygemsdir
79386f
+    noinst = %w[obsolete.rb]
79386f
+    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :mode => $data_mode)
79386f
+    install_recursive(File.join(srcdir, "lib", "rbconfig"), File.join(rubygemsdir, "rbconfig"), :no_install => noinst, :mode => $data_mode)
79386f
+    install(File.join(srcdir, "lib", "ubygems.rb"), File.join(rubygemsdir, "ubygems.rb"), :mode => $data_mode)
79386f
+    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
79386f
+  end
79386f
 end
79386f
 
79386f
 install?(:local, :arch, :lib) do
79386f
diff --git a/version.c b/version.c
79386f
index 54c4513..d76100b 100644
79386f
--- a/version.c
79386f
+++ b/version.c
79386f
@@ -99,6 +99,10 @@ const char ruby_initial_load_paths[] =
79386f
 #endif
79386f
 #endif
79386f
 
79386f
+#ifdef RUBYGEMS_DIR
79386f
+    RUBYGEMS_DIR "\0"
79386f
+#endif
79386f
+
79386f
     RUBY_LIB "\0"
79386f
 #ifdef RUBY_THINARCH
79386f
     RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
79386f
-- 
79386f
1.8.1.2
79386f