ruby/ruby-2.1.0-custom-rubygems-location.patch
2020-07-29 14:10:45 +08:00

91 lines
3.1 KiB
Diff

From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 11 Nov 2011 13:14:45 +0100
Subject: [PATCH] Allow to install RubyGems into custom location, outside of
Ruby tree.
---
configure.ac | 5 +++++
loadpath.c | 4 ++++
template/verconf.h.tmpl | 3 +++
tool/rbinstall.rb | 7 +++++++
4 files changed, 19 insertions(+)
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2020-07-27 16:38:47.589749033 +0800
+++ b/configure.ac 2020-07-27 16:24:09.948494621 +0800
@@ -4288,6 +4288,10 @@
[vendorarchdir=$withval],
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
+AC_ARG_WITH(rubygemsdir,
+ AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
+ [rubygemsdir=$withval])
+
AS_IF([test "${LOAD_RELATIVE+set}"], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
RUBY_EXEC_PREFIX=''
@@ -4312,6 +4316,7 @@
AC_SUBST(vendordir)dnl
AC_SUBST(vendorlibdir)dnl
AC_SUBST(vendorarchdir)dnl
+AC_SUBST(rubygemsdir)dnl
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
diff -Naur a/loadpath.c b/loadpath.c
--- a/loadpath.c 2020-07-27 16:38:47.589749033 +0800
+++ b/loadpath.c 2020-07-27 16:24:09.948494621 +0800
@@ -94,6 +94,10 @@
#endif
#endif
+#ifdef RUBYGEMS_DIR
+ RUBYGEMS_DIR "\0"
+#endif
+
RUBY_LIB "\0"
#ifdef RUBY_THINARCH
RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
diff -Naur a/template/verconf.h.tmpl b/template/verconf.h.tmpl
--- a/template/verconf.h.tmpl 2020-07-27 16:38:47.589749033 +0800
+++ b/template/verconf.h.tmpl 2020-07-27 16:24:09.948494621 +0800
@@ -36,6 +36,9 @@
% if C["RUBY_SEARCH_PATH"]
#define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
% end
+% if C["rubygemsdir"]
+#define RUBYGEMS_DIR "${rubygemsdir}"
+% end
%
% R = {}
% R["ruby_version"] = '"RUBY_LIB_VERSION"'
diff -Naur a/tool/rbinstall.rb b/tool/rbinstall.rb
--- a/tool/rbinstall.rb 2020-07-27 16:22:12.328326341 +0800
+++ b/tool/rbinstall.rb 2020-07-27 16:31:57.009162449 +0800
@@ -335,6 +335,7 @@
vendorlibdir = CONFIG["vendorlibdir"]
vendorarchlibdir = CONFIG["vendorarchdir"]
end
+rubygemsdir = CONFIG["rubygemsdir"]
mandir = CONFIG["mandir", true]
docdir = CONFIG["docdir", true]
configure_args = Shellwords.shellwords(CONFIG["configure_args"])
@@ -541,7 +542,13 @@
install?(:local, :comm, :lib) do
prepare "library scripts", rubylibdir
noinst = %w[*.txt *.rdoc *.gemspec]
+ noinst += %w[rubygems.rb rubygems/ datadir.rb] if rubygemsdir
install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
+ if rubygemsdir
+ noinst = %w[obsolete.rb]
+ install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :mode => $data_mode)
+ install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
+ end
end
install?(:local, :comm, :hdr, :'comm-hdr') do