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

7958ac
From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
7958ac
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
7958ac
Date: Fri, 11 Nov 2011 13:14:45 +0100
7958ac
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
7958ac
 Ruby tree.
7958ac
7958ac
---
7958ac
 configure.ac            |  5 +++++
7958ac
 loadpath.c              |  4 ++++
7958ac
 template/verconf.h.tmpl |  3 +++
7958ac
 tool/rbinstall.rb       | 10 ++++++++++
7958ac
 4 files changed, 22 insertions(+)
7958ac
7958ac
diff --git a/configure.ac b/configure.ac
7958ac
index 93af30321d..bc13397e0e 100644
7958ac
--- a/configure.ac
7958ac
+++ b/configure.ac
7958ac
@@ -3888,6 +3888,10 @@ AC_ARG_WITH(vendorarchdir,
7958ac
             [vendorarchdir=$withval],
7958ac
             [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
7958ac
 
7958ac
+AC_ARG_WITH(rubygemsdir,
7958ac
+           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
7958ac
+            [rubygemsdir=$withval])
7958ac
+
7958ac
 AS_IF([test "${LOAD_RELATIVE+set}"], [
7958ac
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
7958ac
     RUBY_EXEC_PREFIX=''
7958ac
@@ -3912,6 +3916,7 @@ AC_SUBST(sitearchdir)dnl
7958ac
 AC_SUBST(vendordir)dnl
7958ac
 AC_SUBST(vendorlibdir)dnl
7958ac
 AC_SUBST(vendorarchdir)dnl
7958ac
+AC_SUBST(rubygemsdir)dnl
7958ac
 
7958ac
 AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
7958ac
 AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
7958ac
diff --git a/loadpath.c b/loadpath.c
7958ac
index 623dc9d..74c5d9e 100644
7958ac
--- a/loadpath.c
7958ac
+++ b/loadpath.c
7958ac
@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
7958ac
 #endif
7958ac
 #endif
7958ac
 
7958ac
+#ifdef RUBYGEMS_DIR
7958ac
+    RUBYGEMS_DIR "\0"
7958ac
+#endif
7958ac
+
7958ac
     RUBY_LIB "\0"
7958ac
 #ifdef RUBY_THINARCH
7958ac
     RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
7958ac
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
7958ac
index 79c003e..34f2382 100644
7958ac
--- a/template/verconf.h.tmpl
7958ac
+++ b/template/verconf.h.tmpl
7958ac
@@ -36,6 +36,9 @@
7958ac
 % if C["RUBY_SEARCH_PATH"]
7958ac
 #define RUBY_SEARCH_PATH		"${RUBY_SEARCH_PATH}"
7958ac
 % end
7958ac
+% if C["rubygemsdir"]
7958ac
+#define RUBYGEMS_DIR			"${rubygemsdir}"
7958ac
+% end
7958ac
 %
7958ac
 % R = {}
7958ac
 % R["ruby_version"] = '"RUBY_LIB_VERSION"'
7958ac
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
7958ac
index e9110a17ca..76a1f0a315 100755
7958ac
--- a/tool/rbinstall.rb
7958ac
+++ b/tool/rbinstall.rb
7958ac
@@ -348,6 +348,7 @@ def CONFIG.[](name, mandatory = false)
7958ac
   vendorlibdir = CONFIG["vendorlibdir"]
7958ac
   vendorarchlibdir = CONFIG["vendorarchdir"]
7958ac
 end
7958ac
+rubygemsdir = CONFIG["rubygemsdir"]
7958ac
 mandir = CONFIG["mandir", true]
7958ac
 docdir = CONFIG["docdir", true]
7958ac
 enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
7958ac
@@ -580,7 +581,16 @@ def stub
7958ac
 install?(:local, :comm, :lib) do
7958ac
   prepare "library scripts", rubylibdir
7958ac
   noinst = %w[*.txt *.rdoc *.gemspec]
7958ac
+  # Bundler carries "rubygems.rb" file, so it must be specialcased :/
7958ac
+  noinst += %w[rubygems.rb rubygems/ bundler.rb bundler/] if rubygemsdir
7958ac
   install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
7958ac
+  if rubygemsdir
7958ac
+    noinst = %w[*.txt *.rdoc *.gemspec]
7958ac
+    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
7958ac
+    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
7958ac
+    install_recursive(File.join(srcdir, "lib", "bundler"), File.join(rubylibdir, "bundler"), :no_install => noinst, :mode => $data_mode)
7958ac
+    install(File.join(srcdir, "lib", "bundler.rb"), rubylibdir, :mode => $data_mode)
7958ac
+  end
7958ac
 end
7958ac
 
7958ac
 install?(:local, :comm, :hdr, :'comm-hdr') do
7958ac
-- 
7958ac
1.8.3.1
7958ac