]> git.pld-linux.org Git - packages/ruby.git/blame - custom-rubygems-location.patch
up to 2.6.5
[packages/ruby.git] / custom-rubygems-location.patch
CommitLineData
1a83bc11 1From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
c0484a8d
ER
2From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3Date: Fri, 11 Nov 2011 13:14:45 +0100
4Subject: [PATCH] Allow to install RubyGems into custom location, outside of
5 Ruby tree.
6
7---
2798ed3c 8 configure.ac | 5 +++++
9 loadpath.c | 4 ++++
10 template/verconf.h.tmpl | 3 +++
11 tool/rbinstall.rb | 10 ++++++++++
12 4 files changed, 22 insertions(+)
c0484a8d 13
2798ed3c 14diff --git a/configure.ac b/configure.ac
15index 6bba453e3c..028ef7ca3e 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -3746,6 +3746,10 @@ AC_ARG_WITH(vendorarchdir,
c0484a8d 19 [vendorarchdir=$withval],
6b9c4b92 20 [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
c0484a8d
ER
21
22+AC_ARG_WITH(rubygemsdir,
23+ AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
24+ [rubygemsdir=$withval])
c0484a8d 25+
2798ed3c 26 AS_IF([test "${LOAD_RELATIVE+set}"], [
1a83bc11
ER
27 AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
28 RUBY_EXEC_PREFIX=''
2798ed3c 29@@ -3770,6 +3774,7 @@ AC_SUBST(sitearchdir)dnl
c0484a8d
ER
30 AC_SUBST(vendordir)dnl
31 AC_SUBST(vendorlibdir)dnl
32 AC_SUBST(vendorarchdir)dnl
33+AC_SUBST(rubygemsdir)dnl
34
6b9c4b92 35 AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
1a83bc11 36 AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
1a83bc11
ER
37diff --git a/loadpath.c b/loadpath.c
38index 623dc9d..74c5d9e 100644
39--- a/loadpath.c
40+++ b/loadpath.c
41@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
42 #endif
43 #endif
44
45+#ifdef RUBYGEMS_DIR
46+ RUBYGEMS_DIR "\0"
47+#endif
48+
49 RUBY_LIB "\0"
50 #ifdef RUBY_THINARCH
51 RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
1c3d4237 52diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
1a83bc11 53index 79c003e..34f2382 100644
1c3d4237 54--- a/template/verconf.h.tmpl
55+++ b/template/verconf.h.tmpl
6b9c4b92 56@@ -36,6 +36,9 @@
1a83bc11
ER
57 % if C["RUBY_SEARCH_PATH"]
58 #define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
59 % end
60+% if C["rubygemsdir"]
61+#define RUBYGEMS_DIR "${rubygemsdir}"
62+% end
63 %
64 % R = {}
65 % R["ruby_version"] = '"RUBY_LIB_VERSION"'
c0484a8d 66diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
1a83bc11 67index b47b6e1..0b99408 100755
c0484a8d
ER
68--- a/tool/rbinstall.rb
69+++ b/tool/rbinstall.rb
2798ed3c 70@@ -334,6 +334,7 @@ def CONFIG.[](name, mandatory = false)
c0484a8d
ER
71 sitearchlibdir = CONFIG["sitearchdir"]
72 vendorlibdir = CONFIG["vendorlibdir"]
73 vendorarchlibdir = CONFIG["vendorarchdir"]
74+rubygemsdir = CONFIG["rubygemsdir"]
75 mandir = CONFIG["mandir", true]
76 docdir = CONFIG["docdir", true]
2798ed3c 77 enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
78@@ -560,7 +561,16 @@ def stub
c0484a8d
ER
79 install?(:local, :comm, :lib) do
80 prepare "library scripts", rubylibdir
2798ed3c 81 noinst = %w[*.txt *.rdoc *.gemspec]
82+ # Bundler carries "rubygems.rb" file, so it must be specialcased :/
83+ noinst += %w[rubygems.rb rubygems/ bundler.rb bundler/] if rubygemsdir
c0484a8d
ER
84 install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
85+ if rubygemsdir
2798ed3c 86+ noinst = %w[*.txt *.rdoc *.gemspec]
87+ install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
c0484a8d 88+ install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
2798ed3c 89+ install_recursive(File.join(srcdir, "lib", "bundler"), File.join(rubylibdir, "bundler"), :no_install => noinst, :mode => $data_mode)
90+ install(File.join(srcdir, "lib", "bundler.rb"), rubylibdir, :mode => $data_mode)
c0484a8d
ER
91+ end
92 end
93
1c3d4237 94 install?(:local, :comm, :hdr, :'comm-hdr') do
c0484a8d 95--
1a83bc11 961.8.3.1
c0484a8d 97
This page took 0.03651 seconds and 4 git commands to generate.