2019-05-07 10:13:54 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
---
|
2024-11-20 13:31:51 +00:00
|
|
|
configure.ac | 5 +++++
|
|
|
|
loadpath.c | 4 ++++
|
|
|
|
template/verconf.h.tmpl | 3 +++
|
|
|
|
tool/rbinstall.rb | 10 ++++++++++
|
|
|
|
4 files changed, 22 insertions(+)
|
2019-05-07 10:13:54 +00:00
|
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
2024-11-20 13:31:51 +00:00
|
|
|
index 93af30321d..bc13397e0e 100644
|
2019-05-07 10:13:54 +00:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2024-11-20 13:31:51 +00:00
|
|
|
@@ -4348,6 +4348,10 @@ AC_ARG_WITH(vendorarchdir,
|
2019-05-07 10:13:54 +00:00
|
|
|
[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=''
|
2024-11-20 13:31:51 +00:00
|
|
|
@@ -4372,6 +4376,7 @@ AC_SUBST(sitearchdir)dnl
|
2019-05-07 10:13:54 +00:00
|
|
|
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 --git a/loadpath.c b/loadpath.c
|
|
|
|
index 623dc9d..74c5d9e 100644
|
|
|
|
--- a/loadpath.c
|
|
|
|
+++ b/loadpath.c
|
|
|
|
@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef RUBYGEMS_DIR
|
|
|
|
+ RUBYGEMS_DIR "\0"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
RUBY_LIB "\0"
|
|
|
|
#ifdef RUBY_THINARCH
|
|
|
|
RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
|
|
|
|
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
|
|
|
|
index 79c003e..34f2382 100644
|
|
|
|
--- a/template/verconf.h.tmpl
|
|
|
|
+++ b/template/verconf.h.tmpl
|
|
|
|
@@ -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 --git a/tool/rbinstall.rb b/tool/rbinstall.rb
|
2024-11-20 13:31:51 +00:00
|
|
|
index e9110a17ca..76a1f0a315 100755
|
2019-05-07 10:13:54 +00:00
|
|
|
--- a/tool/rbinstall.rb
|
|
|
|
+++ b/tool/rbinstall.rb
|
2024-11-20 13:31:51 +00:00
|
|
|
@@ -359,6 +359,7 @@ def CONFIG.[](name, mandatory = false)
|
2021-06-29 14:02:12 +00:00
|
|
|
vendorlibdir = CONFIG["vendorlibdir"]
|
|
|
|
vendorarchlibdir = CONFIG["vendorarchdir"]
|
|
|
|
end
|
2019-05-07 10:13:54 +00:00
|
|
|
+rubygemsdir = CONFIG["rubygemsdir"]
|
|
|
|
mandir = CONFIG["mandir", true]
|
|
|
|
docdir = CONFIG["docdir", true]
|
2024-11-20 13:31:51 +00:00
|
|
|
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
|
|
|
|
@@ -595,7 +596,16 @@ def stub
|
2019-05-07 10:13:54 +00:00
|
|
|
install?(:local, :comm, :lib) do
|
|
|
|
prepare "library scripts", rubylibdir
|
|
|
|
noinst = %w[*.txt *.rdoc *.gemspec]
|
2024-11-20 13:31:51 +00:00
|
|
|
+ # Bundler carries "rubygems.rb" file, so it must be specialcased :/
|
|
|
|
+ noinst += %w[rubygems.rb rubygems/ bundler.rb bundler/] if rubygemsdir
|
2019-05-07 10:13:54 +00:00
|
|
|
install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
|
|
|
|
+ if rubygemsdir
|
2024-11-20 13:31:51 +00:00
|
|
|
+ noinst = %w[*.txt *.rdoc *.gemspec]
|
|
|
|
+ install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
|
2019-05-07 10:13:54 +00:00
|
|
|
+ install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
|
2024-11-20 13:31:51 +00:00
|
|
|
+ install_recursive(File.join(srcdir, "lib", "bundler"), File.join(rubylibdir, "bundler"), :no_install => noinst, :mode => $data_mode)
|
|
|
|
+ install(File.join(srcdir, "lib", "bundler.rb"), rubylibdir, :mode => $data_mode)
|
2019-05-07 10:13:54 +00:00
|
|
|
+ end
|
|
|
|
end
|
|
|
|
|
|
|
|
install?(:local, :comm, :hdr, :'comm-hdr') do
|