pvalena / rpms / ruby

Forked from rpms/ruby 2 years ago
Clone
a03b2d
From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
117278
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
117278
Date: Fri, 11 Nov 2011 13:14:45 +0100
117278
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
117278
 Ruby tree.
117278
117278
---
c2db65
 configure.ac            | 5 +++++
919598
 loadpath.c              | 4 ++++
919598
 template/verconf.h.tmpl | 3 +++
c2db65
 tool/rbinstall.rb       | 7 +++++++
c2db65
 4 files changed, 19 insertions(+)
117278
c2db65
diff --git a/configure.ac b/configure.ac
c2db65
index 6bba453e3c..028ef7ca3e 100644
c2db65
--- a/configure.ac
c2db65
+++ b/configure.ac
793a1c
@@ -4287,6 +4287,10 @@ AC_ARG_WITH(vendorarchdir,
bf9256
             [vendorarchdir=$withval],
4c12d4
             [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
117278
 
117278
+AC_ARG_WITH(rubygemsdir,
117278
+           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
117278
+            [rubygemsdir=$withval])
117278
+
c2db65
 AS_IF([test "${LOAD_RELATIVE+set}"], [
a03b2d
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
a03b2d
     RUBY_EXEC_PREFIX=''
793a1c
@@ -4311,6 +4315,7 @@ AC_SUBST(sitearchdir)dnl
117278
 AC_SUBST(vendordir)dnl
bf9256
 AC_SUBST(vendorlibdir)dnl
117278
 AC_SUBST(vendorarchdir)dnl
117278
+AC_SUBST(rubygemsdir)dnl
117278
 
4c12d4
 AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
a03b2d
 AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
a03b2d
diff --git a/loadpath.c b/loadpath.c
a03b2d
index 623dc9d..74c5d9e 100644
a03b2d
--- a/loadpath.c
a03b2d
+++ b/loadpath.c
02ee79
@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
360d2b
 #endif
a03b2d
 #endif
a03b2d
 
a03b2d
+#ifdef RUBYGEMS_DIR
a03b2d
+    RUBYGEMS_DIR "\0"
a03b2d
+#endif
a03b2d
+
a03b2d
     RUBY_LIB "\0"
a03b2d
 #ifdef RUBY_THINARCH
a03b2d
     RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
919598
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
a03b2d
index 79c003e..34f2382 100644
919598
--- a/template/verconf.h.tmpl
919598
+++ b/template/verconf.h.tmpl
4c12d4
@@ -36,6 +36,9 @@
a03b2d
 % if C["RUBY_SEARCH_PATH"]
a03b2d
 #define RUBY_SEARCH_PATH		"${RUBY_SEARCH_PATH}"
a03b2d
 % end
a03b2d
+% if C["rubygemsdir"]
a03b2d
+#define RUBYGEMS_DIR			"${rubygemsdir}"
a03b2d
+% end
a03b2d
 %
a03b2d
 % R = {}
a03b2d
 % R["ruby_version"] = '"RUBY_LIB_VERSION"'
117278
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
a03b2d
index b47b6e1..0b99408 100755
117278
--- a/tool/rbinstall.rb
117278
+++ b/tool/rbinstall.rb
c2db65
@@ -331,6 +331,7 @@ def CONFIG.[](name, mandatory = false)
117278
 sitearchlibdir = CONFIG["sitearchdir"]
117278
 vendorlibdir = CONFIG["vendorlibdir"]
117278
 vendorarchlibdir = CONFIG["vendorarchdir"]
117278
+rubygemsdir = CONFIG["rubygemsdir"]
ea3cb6
 mandir = CONFIG["mandir", true]
4efe11
 docdir = CONFIG["docdir", true]
117278
 configure_args = Shellwords.shellwords(CONFIG["configure_args"])
c2db65
@@ -537,7 +538,13 @@ def install(src, cmd)
117278
 install?(:local, :comm, :lib) do
117278
   prepare "library scripts", rubylibdir
c2db65
   noinst = %w[*.txt *.rdoc *.gemspec]
c2db65
+  noinst += %w[rubygems.rb rubygems/ datadir.rb] if rubygemsdir
117278
   install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
117278
+  if rubygemsdir
117278
+    noinst = %w[obsolete.rb]
117278
+    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :mode => $data_mode)
117278
+    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
117278
+  end
117278
 end
117278
 
919598
 install?(:local, :comm, :hdr, :'comm-hdr') do
9c1886
-- 
a03b2d
1.8.3.1
117278