]> git.pld-linux.org Git - packages/ruby.git/blame - custom-rubygems-location.patch
up to 2.3.4
[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---
1c3d4237 8 configure.in | 5 +++++
9 loadpath.c | 4 ++++
10 template/verconf.h.tmpl | 3 +++
11 tool/rbinstall.rb | 9 +++++++++
1a83bc11 12 4 files changed, 21 insertions(+)
c0484a8d
ER
13
14diff --git a/configure.in b/configure.in
1a83bc11 15index 03a4152..0e371e2 100644
c0484a8d
ER
16--- a/configure.in
17+++ b/configure.in
6b9c4b92 18@@ -4264,6 +4264,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+
1a83bc11
ER
26 if test "${LOAD_RELATIVE+set}"; then
27 AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
28 RUBY_EXEC_PREFIX=''
6b9c4b92 29@@ -4288,6 +4292,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
6b9c4b92 70@@ -328,6 +328,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]
77 configure_args = Shellwords.shellwords(CONFIG["configure_args"])
6b9c4b92 78@@ -506,7 +507,15 @@ def CONFIG.[](name, mandatory = false)
c0484a8d
ER
79 install?(:local, :comm, :lib) do
80 prepare "library scripts", rubylibdir
81 noinst = %w[README* *.txt *.rdoc *.gemspec]
82+ noinst += %w[*ubygems.rb rubygems/ datadir.rb] if rubygemsdir
83 install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
84+ if rubygemsdir
85+ noinst = %w[obsolete.rb]
86+ install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :mode => $data_mode)
87+ install_recursive(File.join(srcdir, "lib", "rbconfig"), File.join(rubygemsdir, "rbconfig"), :no_install => noinst, :mode => $data_mode)
88+ install(File.join(srcdir, "lib", "ubygems.rb"), File.join(rubygemsdir, "ubygems.rb"), :mode => $data_mode)
89+ install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
90+ end
91 end
92
1c3d4237 93 install?(:local, :comm, :hdr, :'comm-hdr') do
c0484a8d 94--
1a83bc11 951.8.3.1
c0484a8d 96
This page took 0.051549 seconds and 4 git commands to generate.