]> git.pld-linux.org Git - packages/ruby.git/blob - custom-rubygems-location.patch
- unconditional noarch subpackages
[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.ac            |  5 +++++
9  loadpath.c              |  4 ++++
10  template/verconf.h.tmpl |  3 +++
11  tool/rbinstall.rb       | 10 ++++++++++
12  4 files changed, 22 insertions(+)
13
14 diff --git a/configure.ac b/configure.ac
15 index 6bba453e3c..028ef7ca3e 100644
16 --- a/configure.ac
17 +++ b/configure.ac
18 @@ -3746,6 +3746,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  AS_IF([test "${LOAD_RELATIVE+set}"], [
27      AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
28      RUBY_EXEC_PREFIX=''
29 @@ -3770,6 +3774,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 @@ -330,6 +330,7 @@
71  archhdrdir = CONFIG["rubyarchhdrdir"] || (rubyhdrdir + "/" + CONFIG['arch'])
72  rubylibdir = CONFIG["rubylibdir", true]
73  archlibdir = CONFIG["rubyarchdir", true]
74 +rubygemsdir = CONFIG["rubygemsdir"]
75  if CONFIG["sitedir"]
76    sitelibdir = CONFIG["sitelibdir"]
77    sitearchlibdir = CONFIG["sitearchdir"]
78 @@ -560,7 +561,16 @@ def stub
79  install?(:local, :comm, :lib) do
80    prepare "library scripts", rubylibdir
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
84    install_recursive(File.join(srcdir, "lib"), rubylibdir, :no_install => noinst, :mode => $data_mode)
85 +  if rubygemsdir
86 +    noinst = %w[*.txt *.rdoc *.gemspec]
87 +    install_recursive(File.join(srcdir, "lib", "rubygems"), File.join(rubygemsdir, "rubygems"), :no_install => noinst, :mode => $data_mode)
88 +    install(File.join(srcdir, "lib", "rubygems.rb"), File.join(rubygemsdir, "rubygems.rb"), :mode => $data_mode)
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)
91 +  end
92  end
93  
94  install?(:local, :comm, :hdr, :'comm-hdr') do
95 -- 
96 1.8.3.1
97
This page took 0.047034 seconds and 3 git commands to generate.