1 From 4fc1be3af3f58621bb751c9e63c208b15c0e8d16 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3 Date: Tue, 31 Mar 2015 16:21:04 +0200
4 Subject: [PATCH 1/4] Use ruby_version_dir_name for versioned directories.
6 This disallows changing the ruby_version constant by --with-ruby-version
7 configuration options. The two places version numbers are disallowed as
8 well, since there are a lot of places which cannot handle this format
11 ruby_version_dir_name now specifies custom version string for versioned
12 directories, e.g. instead of default X.Y.Z, you can specify whatever
15 configure.in | 68 ++++++++++++++++++++++++++++-------------------------
16 template/ruby.pc.in | 1 +
17 2 files changed, 37 insertions(+), 32 deletions(-)
19 diff --git a/configure.in b/configure.in
20 index db37cd6..6e73fae 100644
23 @@ -4177,9 +4177,6 @@ AS_CASE(["$target_os"],
24 rubyw_install_name='$(RUBYW_INSTALL_NAME)'
27 -rubylibdir='${rubylibprefix}/${ruby_version}'
28 -rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
30 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
31 AC_ARG_WITH(rubyarchprefix,
32 AS_HELP_STRING([--with-rubyarchprefix=DIR],
33 @@ -4202,58 +4199,64 @@ AC_ARG_WITH(ridir,
35 AC_SUBST(RI_BASE_NAME)
37 -AC_ARG_WITH(ruby-version,
38 - AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|minor|STR)]),
39 - [ruby_version=$withval],
40 - [ruby_version=full])
41 unset RUBY_LIB_VERSION
42 -unset RUBY_LIB_VERSION_STYLE
43 -AS_CASE(["$ruby_version"],
44 - [full], [RUBY_LIB_VERSION_STYLE='3 /* full */'],
45 - [minor], [RUBY_LIB_VERSION_STYLE='2 /* minor */'])
46 -if test ${RUBY_LIB_VERSION_STYLE+set}; then
48 - echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
49 - echo '#define STRINGIZE(x) x'
50 - test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
51 - echo '#include "verconf.h"'
52 - echo '#include "version.h"'
53 - echo 'ruby_version=RUBY_LIB_VERSION'
55 - test -f verconf.h || > verconf.h
56 - ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
58 -elif test -z "${ruby_version}"; then
59 - AC_MSG_ERROR([No ruby version, No place for bundled libraries])
61 - RUBY_LIB_VERSION="${ruby_version}"
63 +RUBY_LIB_VERSION_STYLE='3 /* full */'
65 +echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
66 +echo '#define STRINGIZE(x) x'
67 +test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
68 +echo '#include "verconf.h"'
69 +echo '#include "version.h"'
70 +echo 'ruby_version=RUBY_LIB_VERSION'
72 +test -f verconf.h || > verconf.h
73 +ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
76 +RUBY_LIB_VERSION="${ruby_version}"
78 AC_SUBST(RUBY_LIB_VERSION_STYLE)
79 AC_SUBST(RUBY_LIB_VERSION)
81 +AC_ARG_WITH(ruby-version,
82 + AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|STR)]),
83 + [ruby_version_dir_name=$withval],
84 + [ruby_version_dir_name=full])
85 +AS_CASE(["$ruby_version_dir_name"],
86 + [full], [ruby_version_dir_name='${ruby_version}'])
88 +ruby_version_dir=/'${ruby_version_dir_name}'
90 +if test -z "${ruby_version_dir_name}"; then
91 + AC_MSG_ERROR([No ruby version, No place for bundled libraries])
94 +rubylibdir='${rubylibprefix}'${ruby_version_dir}
95 +rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_dir}}${multiarch-'${rubylibdir}/${arch}'}
98 AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
100 [sitedir='${rubylibprefix}/site_ruby'])
101 -sitelibdir='${sitedir}/${ruby_version}'
102 +sitelibdir='${sitedir}'${ruby_version_dir}
104 AC_ARG_WITH(sitearchdir,
105 AS_HELP_STRING([--with-sitearchdir=DIR],
106 [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
107 [sitearchdir=$withval],
108 - [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
109 + [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_dir}}${multiarch-'${sitelibdir}/${sitearch}'}])
111 AC_ARG_WITH(vendordir,
112 AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
113 [vendordir=$withval],
114 [vendordir='${rubylibprefix}/vendor_ruby'])
115 -vendorlibdir='${vendordir}/${ruby_version}'
116 +vendorlibdir='${vendordir}'${ruby_version_dir}
118 AC_ARG_WITH(vendorarchdir,
119 AS_HELP_STRING([--with-vendorarchdir=DIR],
120 [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
121 [vendorarchdir=$withval],
122 - [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
123 + [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
125 if test "${LOAD_RELATIVE+set}"; then
126 AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
127 @@ -4270,6 +4273,7 @@ AC_SUBST(sitearchincludedir)dnl
129 AC_SUBST(sitearch)dnl
130 AC_SUBST(ruby_version)dnl
131 +AC_SUBST(ruby_version_dir_name)dnl
132 AC_SUBST(rubylibdir)dnl
133 AC_SUBST(rubyarchdir)dnl
135 diff --git a/template/ruby.pc.in b/template/ruby.pc.in
136 index 8a2c066..c81b211 100644
137 --- a/template/ruby.pc.in
138 +++ b/template/ruby.pc.in
139 @@ -9,6 +9,7 @@ MAJOR=@MAJOR@
142 ruby_version=@ruby_version@
143 +ruby_version_dir_name=@ruby_version_dir_name@
144 RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
145 RUBY_BASE_NAME=@RUBY_BASE_NAME@
146 RUBY_VERSION_NAME=@RUBY_VERSION_NAME@
151 From 518850aba6eee76de7715aae8d37330e34b01983 Mon Sep 17 00:00:00 2001
152 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
153 Date: Tue, 31 Mar 2015 16:37:26 +0200
154 Subject: [PATCH 2/4] Add ruby_version_dir_name support for RDoc.
157 lib/rdoc/ri/paths.rb | 2 +-
158 tool/rbinstall.rb | 2 +-
159 2 files changed, 2 insertions(+), 2 deletions(-)
161 diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
162 index 970cb91..5bf8230 100644
163 --- a/lib/rdoc/ri/paths.rb
164 +++ b/lib/rdoc/ri/paths.rb
165 @@ -10,7 +10,7 @@ module RDoc::RI::Paths
169 - version = RbConfig::CONFIG['ruby_version']
170 + version = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
172 BASE = if RbConfig::CONFIG.key? 'ridir' then
173 File.join RbConfig::CONFIG['ridir'], version
174 diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
175 index d4c110e..d39c9a6 100755
176 --- a/tool/rbinstall.rb
177 +++ b/tool/rbinstall.rb
178 @@ -406,7 +406,7 @@ def CONFIG.[](name, mandatory = false)
180 install?(:doc, :rdoc) do
182 - ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
183 + ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version_dir_name'] || CONFIG['ruby_version'], "system")
184 prepare "rdoc", ridatadir
185 install_recursive($rdocdir, ridatadir, :mode => $data_mode)
191 From f8d136f9a46d1fe87eba622ab9665935d05e981b Mon Sep 17 00:00:00 2001
192 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
193 Date: Tue, 31 Mar 2015 16:37:44 +0200
194 Subject: [PATCH 3/4] Add ruby_version_dir_name support for RubyGems.
197 lib/rubygems/defaults.rb | 11 ++++++-----
198 test/rubygems/test_gem.rb | 5 +++--
199 2 files changed, 9 insertions(+), 7 deletions(-)
201 diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
202 index 55ca080..75eea2b 100644
203 --- a/lib/rubygems/defaults.rb
204 +++ b/lib/rubygems/defaults.rb
205 @@ -32,20 +32,20 @@ def self.default_dir
207 File.dirname(RbConfig::CONFIG['sitedir']),
209 - RbConfig::CONFIG['ruby_version']
210 + RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
212 elsif RbConfig::CONFIG['rubylibprefix'] then
214 RbConfig::CONFIG['rubylibprefix'],
216 - RbConfig::CONFIG['ruby_version']
217 + RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
221 RbConfig::CONFIG['libdir'],
224 - RbConfig::CONFIG['ruby_version']
225 + RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
229 @@ -75,7 +75,8 @@ def self.default_rubygems_dirs
232 parts = [Gem.user_home, '.gem', ruby_engine]
233 - parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
234 + ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
235 + parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
239 @@ -172,7 +173,7 @@ def self.vendor_dir # :nodoc:
240 return nil unless RbConfig::CONFIG.key? 'vendordir'
242 File.join RbConfig::CONFIG['vendordir'], 'gems',
243 - RbConfig::CONFIG['ruby_version']
244 + RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
248 diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
249 index 0428bea..b6e090e 100644
250 --- a/test/rubygems/test_gem.rb
251 +++ b/test/rubygems/test_gem.rb
252 @@ -963,7 +963,8 @@ def test_self_use_paths
254 def test_self_user_dir
255 parts = [@userhome, '.gem', Gem.ruby_engine]
256 - parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
257 + ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
258 + parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
260 assert_equal File.join(parts), Gem.user_dir
262 @@ -1090,7 +1091,7 @@ def test_self_user_home_user_drive_and_path
263 def test_self_vendor_dir
265 File.join RbConfig::CONFIG['vendordir'], 'gems',
266 - RbConfig::CONFIG['ruby_version']
267 + RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
269 assert_equal expected, Gem.vendor_dir
275 From 88c38a030c22dbf9422ece847bdfbf87d6659313 Mon Sep 17 00:00:00 2001
276 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
277 Date: Wed, 1 Apr 2015 14:55:37 +0200
278 Subject: [PATCH 4/4] Let headers directories follow the configured version
283 1 file changed, 1 insertion(+), 1 deletion(-)
285 diff --git a/configure.in b/configure.in
286 index 6e73fae..c842725 100644
289 @@ -275,7 +275,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
290 RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
291 AC_SUBST(RUBY_BASE_NAME)
292 AC_SUBST(RUBYW_BASE_NAME)
293 -AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
294 +AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version_dir_name}')
297 test x"$target_alias" = x &&