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
---
0c8cdc4
 configure.ac            |  5 +++++
0c8cdc4
 loadpath.c              |  4 ++++
0c8cdc4
 template/verconf.h.tmpl |  3 +++
0c8cdc4
 tool/rbinstall.rb       | 10 ++++++++++
0c8cdc4
 4 files changed, 22 insertions(+)
117278a
c2db65d
diff --git a/configure.ac b/configure.ac
c2db65d
index 6bba453e3c..028ef7ca3e 100644
c2db65d
--- a/configure.ac
c2db65d
+++ b/configure.ac
17f23f3
@@ -3746,6 +3746,10 @@ AC_ARG_WITH(vendorarchdir,
bf92566
             [vendorarchdir=$withval],
4c12d4e
             [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
117278a
 
117278a
+AC_ARG_WITH(rubygemsdir,
117278a
+           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
117278a
+            [rubygemsdir=$withval])
117278a
+
c2db65d
 AS_IF([test "${LOAD_RELATIVE+set}"], [
a03b2d2
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
a03b2d2
     RUBY_EXEC_PREFIX=''
17f23f3
@@ -3770,6 +3774,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
 
4c12d4e
 AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
a03b2d2
 AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
a03b2d2
diff --git a/loadpath.c b/loadpath.c
a03b2d2
index 623dc9d..74c5d9e 100644
a03b2d2
--- a/loadpath.c
a03b2d2
+++ b/loadpath.c
02ee790
@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
360d2b9
 #endif
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"
9195984
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
a03b2d2
index 79c003e..34f2382 100644
9195984
--- a/template/verconf.h.tmpl
9195984
+++ b/template/verconf.h.tmpl
4c12d4e
@@ -36,6 +36,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
0c8cdc4
@@ -334,6 +334,7 @@ def CONFIG.[](name, mandatory = false)
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]
0c8cdc4
 enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
0c8cdc4
@@ -560,7 +561,16 @@ def stub
117278a
 install?(:local, :comm, :lib) do
117278a
   prepare "library scripts", rubylibdir
c2db65d
   noinst = %w[*.txt *.rdoc *.gemspec]
0c8cdc4
+  # Bundler carries "rubygems.rb" file, so it must be specialcased :/
0c8cdc4
+  noinst += %w[rubygems.rb rubygems/ bundler.rb bundler/] if rubygemsdir
117278a
   install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
117278a
+  if rubygemsdir
0c8cdc4
+    noinst = %w[*.txt *.rdoc *.gemspec]
0c8cdc4
+    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
117278a
+    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
0c8cdc4
+    install_recursive(File.join(srcdir, "lib", "bundler"), File.join(rubylibdir, "bundler"), :no_install => noinst, :mode => $data_mode)
0c8cdc4
+    install(File.join(srcdir, "lib", "bundler.rb"), rubylibdir, :mode => $data_mode)
117278a
+  end
117278a
 end
117278a
 
9195984
 install?(:local, :comm, :hdr, :'comm-hdr') do
9c18864
-- 
a03b2d2
1.8.3.1
117278a