]> git.pld-linux.org Git - packages/ruby.git/blob - custom-rubygems-location.patch
e82f17255ea153b656777495e0da4349e3f0d12f
[packages/ruby.git] / custom-rubygems-location.patch
1 From 94da59aafacc6a9efe829529eb51385588d6f149 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3 Date: Fri, 11 Nov 2011 13:14:45 +0100
4 Subject: [PATCH] Allow to install RubyGems into custom location, outside of
5  Ruby tree.
6
7 ---
8  configure.in            | 5 +++++
9  loadpath.c              | 4 ++++
10  template/verconf.h.tmpl | 3 +++
11  tool/rbinstall.rb       | 9 +++++++++
12  4 files changed, 21 insertions(+)
13
14 diff --git a/configure.in b/configure.in
15 index 03a4152..0e371e2 100644
16 --- a/configure.in
17 +++ b/configure.in
18 @@ -4264,6 +4264,10 @@ AC_ARG_WITH(vendorarchdir,
19              [vendorarchdir=$withval],
20              [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
21  
22 +AC_ARG_WITH(rubygemsdir,
23 +           AS_HELP_STRING([--with-rubygemsdir=DIR], [custom rubygems directory]),
24 +            [rubygemsdir=$withval])
25 +
26  if test "${LOAD_RELATIVE+set}"; then
27      AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
28      RUBY_EXEC_PREFIX=''
29 @@ -4288,6 +4292,7 @@ AC_SUBST(sitearchdir)dnl
30  AC_SUBST(vendordir)dnl
31  AC_SUBST(vendorlibdir)dnl
32  AC_SUBST(vendorarchdir)dnl
33 +AC_SUBST(rubygemsdir)dnl
34  
35  AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
36  AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
37 diff --git a/loadpath.c b/loadpath.c
38 index 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"
52 diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
53 index 79c003e..34f2382 100644
54 --- a/template/verconf.h.tmpl
55 +++ b/template/verconf.h.tmpl
56 @@ -36,6 +36,9 @@
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"'
66 diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
67 index b47b6e1..0b99408 100755
68 --- a/tool/rbinstall.rb
69 +++ b/tool/rbinstall.rb
70 @@ -328,6 +328,7 @@ def CONFIG.[](name, mandatory = false)
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"])
78 @@ -506,7 +507,15 @@ def CONFIG.[](name, mandatory = false)
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  
93  install?(:local, :comm, :hdr, :'comm-hdr') do
94 -- 
95 1.8.3.1
96
This page took 0.02758 seconds and 2 git commands to generate.