pvalena / rpms / ruby

Forked from rpms/ruby 6 years ago
Clone
a03b2d2
From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
117278a
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
117278a
Date: Fri, 11 Nov 2011 13:14:45 +0100
117278a
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
117278a
 Ruby tree.
117278a
117278a
---
a03b2d2
 configure.in          | 5 +++++
a03b2d2
 loadpath.c            | 4 ++++
a03b2d2
 template/verconf.h.in | 3 +++
a03b2d2
 tool/rbinstall.rb     | 9 +++++++++
a03b2d2
 4 files changed, 21 insertions(+)
117278a
117278a
diff --git a/configure.in b/configure.in
a03b2d2
index 03a4152..0e371e2 100644
117278a
--- a/configure.in
117278a
+++ b/configure.in
a03b2d2
@@ -3621,6 +3621,10 @@ AC_ARG_WITH(vendorarchdir,
bf92566
             [vendorarchdir=$withval],
cdd0186
             [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
117278a
 
117278a
+AC_ARG_WITH(rubygemsdir,
117278a
+           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
117278a
+            [rubygemsdir=$withval])
117278a
+
a03b2d2
 if test "${LOAD_RELATIVE+set}"; then
a03b2d2
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
a03b2d2
     RUBY_EXEC_PREFIX=''
a03b2d2
@@ -3644,6 +3648,7 @@ AC_SUBST(sitearchdir)dnl
117278a
 AC_SUBST(vendordir)dnl
bf92566
 AC_SUBST(vendorlibdir)dnl
117278a
 AC_SUBST(vendorarchdir)dnl
117278a
+AC_SUBST(rubygemsdir)dnl
117278a
 
a03b2d2
 AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
a03b2d2
 
a03b2d2
diff --git a/loadpath.c b/loadpath.c
a03b2d2
index 623dc9d..74c5d9e 100644
a03b2d2
--- a/loadpath.c
a03b2d2
+++ b/loadpath.c
a03b2d2
@@ -86,6 +86,10 @@ const char ruby_initial_load_paths[] =
a03b2d2
     RUBY_VENDOR_LIB "\0"
a03b2d2
 #endif
a03b2d2
 
a03b2d2
+#ifdef RUBYGEMS_DIR
a03b2d2
+    RUBYGEMS_DIR "\0"
a03b2d2
+#endif
a03b2d2
+
a03b2d2
     RUBY_LIB "\0"
a03b2d2
 #ifdef RUBY_THINARCH
a03b2d2
     RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
a03b2d2
diff --git a/template/verconf.h.in b/template/verconf.h.in
a03b2d2
index 79c003e..34f2382 100644
a03b2d2
--- a/template/verconf.h.in
a03b2d2
+++ b/template/verconf.h.in
a03b2d2
@@ -34,6 +34,9 @@
a03b2d2
 % if C["RUBY_SEARCH_PATH"]
a03b2d2
 #define RUBY_SEARCH_PATH		"${RUBY_SEARCH_PATH}"
a03b2d2
 % end
a03b2d2
+% if C["rubygemsdir"]
a03b2d2
+#define RUBYGEMS_DIR			"${rubygemsdir}"
a03b2d2
+% end
a03b2d2
 %
a03b2d2
 % R = {}
a03b2d2
 % R["ruby_version"] = '"RUBY_LIB_VERSION"'
117278a
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
a03b2d2
index b47b6e1..0b99408 100755
117278a
--- a/tool/rbinstall.rb
117278a
+++ b/tool/rbinstall.rb
a03b2d2
@@ -317,6 +317,7 @@ sitelibdir = CONFIG["sitelibdir"]
117278a
 sitearchlibdir = CONFIG["sitearchdir"]
117278a
 vendorlibdir = CONFIG["vendorlibdir"]
117278a
 vendorarchlibdir = CONFIG["vendorarchdir"]
117278a
+rubygemsdir = CONFIG["rubygemsdir"]
ea3cb65
 mandir = CONFIG["mandir", true]
4efe111
 docdir = CONFIG["docdir", true]
117278a
 configure_args = Shellwords.shellwords(CONFIG["configure_args"])
a03b2d2
@@ -505,7 +506,15 @@ end
117278a
 install?(:local, :comm, :lib) do
117278a
   prepare "library scripts", rubylibdir
b3f2794
   noinst = %w[README* *.txt *.rdoc *.gemspec]
117278a
+  noinst += %w[*ubygems.rb rubygems/ datadir.rb] if rubygemsdir
117278a
   install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
117278a
+  if rubygemsdir
117278a
+    noinst = %w[obsolete.rb]
117278a
+    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :mode => $data_mode)
117278a
+    install_recursive(File.join(srcdir, "lib", "rbconfig"), File.join(rubygemsdir, "rbconfig"), :no_install => noinst, :mode => $data_mode)
117278a
+    install(File.join(srcdir, "lib", "ubygems.rb"), File.join(rubygemsdir, "ubygems.rb"), :mode => $data_mode)
117278a
+    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
117278a
+  end
117278a
 end
117278a
 
117278a
 install?(:local, :arch, :lib) do
9c18864
-- 
a03b2d2
1.8.3.1
117278a