]> git.pld-linux.org Git - packages/ruby.git/blame - ruby-version.patch
up to 2.6.5
[packages/ruby.git] / ruby-version.patch
CommitLineData
1c3d4237 1From 4fc1be3af3f58621bb751c9e63c208b15c0e8d16 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
3Date: Tue, 31 Mar 2015 16:21:04 +0200
4Subject: [PATCH 1/4] Use ruby_version_dir_name for versioned directories.
5
6This disallows changing the ruby_version constant by --with-ruby-version
7configuration options. The two places version numbers are disallowed as
8well, since there are a lot of places which cannot handle this format
9properly.
10
11ruby_version_dir_name now specifies custom version string for versioned
12directories, e.g. instead of default X.Y.Z, you can specify whatever
13string.
14---
2798ed3c 15 configure.ac | 64 ++++++++++++++++++++++++---------------------
1c3d4237 16 template/ruby.pc.in | 1 +
2798ed3c 17 2 files changed, 35 insertions(+), 30 deletions(-)
1c3d4237 18
2798ed3c 19diff --git a/configure.ac b/configure.ac
20index 8ea969412f..a00f2b6776 100644
21--- a/configure.ac
22+++ b/configure.ac
23@@ -3661,9 +3661,6 @@ AS_CASE(["$target_os"],
1c3d4237 24 rubyw_install_name='$(RUBYW_INSTALL_NAME)'
25 ])
26
27-rubylibdir='${rubylibprefix}/${ruby_version}'
28-rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
29-
30 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
31 AC_ARG_WITH(rubyarchprefix,
32 AS_HELP_STRING([--with-rubyarchprefix=DIR],
2798ed3c 33@@ -3686,56 +3683,62 @@ AC_ARG_WITH(ridir,
1c3d4237 34 AC_SUBST(ridir)
35 AC_SUBST(RI_BASE_NAME)
36
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 */'])
2798ed3c 46-AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
1c3d4237 47- {
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'
1c3d4237 51- echo '#include "version.h"'
52- echo 'ruby_version=RUBY_LIB_VERSION'
53- } > conftest.c
1c3d4237 54- ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
55- eval $ruby_version
2798ed3c 56-], [test -z "${ruby_version}"], [
1c3d4237 57- AC_MSG_ERROR([No ruby version, No place for bundled libraries])
2798ed3c 58-], [
1c3d4237 59- RUBY_LIB_VERSION="${ruby_version}"
2798ed3c 60-])
61+RUBY_LIB_VERSION_STYLE='3 /* full */'
1c3d4237 62+{
63+echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
64+echo '#define STRINGIZE(x) x'
65+test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
1c3d4237 66+echo '#include "version.h"'
67+echo 'ruby_version=RUBY_LIB_VERSION'
68+} > conftest.c
1c3d4237 69+ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
70+eval $ruby_version
71+
72+RUBY_LIB_VERSION="${ruby_version}"
73+
74 AC_SUBST(RUBY_LIB_VERSION_STYLE)
75 AC_SUBST(RUBY_LIB_VERSION)
76
77+AC_ARG_WITH(ruby-version,
78+ AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|STR)]),
79+ [ruby_version_dir_name=$withval],
80+ [ruby_version_dir_name=full])
81+AS_CASE(["$ruby_version_dir_name"],
82+ [full], [ruby_version_dir_name='${ruby_version}'])
83+
84+ruby_version_dir=/'${ruby_version_dir_name}'
85+
86+if test -z "${ruby_version_dir_name}"; then
87+ AC_MSG_ERROR([No ruby version, No place for bundled libraries])
88+fi
89+
90+rubylibdir='${rubylibprefix}'${ruby_version_dir}
91+rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_dir}}${multiarch-'${rubylibdir}/${arch}'}
92+
93 AC_ARG_WITH(sitedir,
94 AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
95 [sitedir=$withval],
96 [sitedir='${rubylibprefix}/site_ruby'])
97-sitelibdir='${sitedir}/${ruby_version}'
98+sitelibdir='${sitedir}'${ruby_version_dir}
99
100 AC_ARG_WITH(sitearchdir,
101 AS_HELP_STRING([--with-sitearchdir=DIR],
102 [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
103 [sitearchdir=$withval],
104- [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
105+ [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_dir}}${multiarch-'${sitelibdir}/${sitearch}'}])
106
107 AC_ARG_WITH(vendordir,
108 AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
109 [vendordir=$withval],
110 [vendordir='${rubylibprefix}/vendor_ruby'])
111-vendorlibdir='${vendordir}/${ruby_version}'
112+vendorlibdir='${vendordir}'${ruby_version_dir}
113
114 AC_ARG_WITH(vendorarchdir,
115 AS_HELP_STRING([--with-vendorarchdir=DIR],
116 [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
117 [vendorarchdir=$withval],
118- [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
119+ [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
120
2798ed3c 121 AS_IF([test "${LOAD_RELATIVE+set}"], [
1c3d4237 122 AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
2798ed3c 123@@ -3752,6 +3755,7 @@ AC_SUBST(sitearchincludedir)dnl
1c3d4237 124 AC_SUBST(arch)dnl
125 AC_SUBST(sitearch)dnl
126 AC_SUBST(ruby_version)dnl
127+AC_SUBST(ruby_version_dir_name)dnl
128 AC_SUBST(rubylibdir)dnl
129 AC_SUBST(rubyarchdir)dnl
130 AC_SUBST(sitedir)dnl
131diff --git a/template/ruby.pc.in b/template/ruby.pc.in
132index 8a2c066..c81b211 100644
133--- a/template/ruby.pc.in
134+++ b/template/ruby.pc.in
135@@ -9,6 +9,7 @@ MAJOR=@MAJOR@
136 MINOR=@MINOR@
137 TEENY=@TEENY@
138 ruby_version=@ruby_version@
139+ruby_version_dir_name=@ruby_version_dir_name@
2798ed3c 140 RUBY_API_VERSION=@RUBY_API_VERSION@
1c3d4237 141 RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
142 RUBY_BASE_NAME=@RUBY_BASE_NAME@
1c3d4237 143--
1442.1.0
145
146
147From 518850aba6eee76de7715aae8d37330e34b01983 Mon Sep 17 00:00:00 2001
148From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
149Date: Tue, 31 Mar 2015 16:37:26 +0200
150Subject: [PATCH 2/4] Add ruby_version_dir_name support for RDoc.
151
152---
153 lib/rdoc/ri/paths.rb | 2 +-
154 tool/rbinstall.rb | 2 +-
155 2 files changed, 2 insertions(+), 2 deletions(-)
156
157diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
158index 970cb91..5bf8230 100644
159--- a/lib/rdoc/ri/paths.rb
160+++ b/lib/rdoc/ri/paths.rb
161@@ -10,7 +10,7 @@ module RDoc::RI::Paths
162 #:stopdoc:
163 require 'rbconfig'
164
165- version = RbConfig::CONFIG['ruby_version']
166+ version = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
167
168 BASE = if RbConfig::CONFIG.key? 'ridir' then
169 File.join RbConfig::CONFIG['ridir'], version
170diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
171index d4c110e..d39c9a6 100755
172--- a/tool/rbinstall.rb
173+++ b/tool/rbinstall.rb
2798ed3c 174@@ -424,7 +424,7 @@ def CONFIG.[](name, mandatory = false)
1c3d4237 175
176 install?(:doc, :rdoc) do
177 if $rdocdir
178- ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
179+ ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version_dir_name'] || CONFIG['ruby_version'], "system")
180 prepare "rdoc", ridatadir
2798ed3c 181 install_recursive($rdocdir, ridatadir, :no_install => rdoc_noinst, :mode => $data_mode)
1c3d4237 182 end
183--
1842.1.0
185
186
187From f8d136f9a46d1fe87eba622ab9665935d05e981b Mon Sep 17 00:00:00 2001
188From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
189Date: Tue, 31 Mar 2015 16:37:44 +0200
190Subject: [PATCH 3/4] Add ruby_version_dir_name support for RubyGems.
191
192---
193 lib/rubygems/defaults.rb | 11 ++++++-----
194 test/rubygems/test_gem.rb | 5 +++--
195 2 files changed, 9 insertions(+), 7 deletions(-)
196
197diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
198index 55ca080..75eea2b 100644
199--- a/lib/rubygems/defaults.rb
200+++ b/lib/rubygems/defaults.rb
201@@ -32,20 +32,20 @@ def self.default_dir
202 [
203 File.dirname(RbConfig::CONFIG['sitedir']),
204 'Gems',
205- RbConfig::CONFIG['ruby_version']
206+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
207 ]
2798ed3c 208 elsif RbConfig::CONFIG['rubylibprefix']
1c3d4237 209 [
2798ed3c 210 RbConfig::CONFIG['rubylibprefix'],
211 'gems',
212- RbConfig::CONFIG['ruby_version']
213+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
1c3d4237 214 ]
215 else
216 [
217 RbConfig::CONFIG['libdir'],
218 ruby_engine,
219 'gems',
220- RbConfig::CONFIG['ruby_version']
221+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
222 ]
223 end
224
225@@ -75,7 +75,8 @@ def self.default_rubygems_dirs
226
227 def self.user_dir
228 parts = [Gem.user_home, '.gem', ruby_engine]
229- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
230+ ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
231+ parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
232 File.join parts
233 end
234
235@@ -172,7 +173,7 @@ def self.vendor_dir # :nodoc:
236 return nil unless RbConfig::CONFIG.key? 'vendordir'
237
238 File.join RbConfig::CONFIG['vendordir'], 'gems',
239- RbConfig::CONFIG['ruby_version']
240+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
241 end
242
2798ed3c 243 ##
1c3d4237 244diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
245index 0428bea..b6e090e 100644
246--- a/test/rubygems/test_gem.rb
247+++ b/test/rubygems/test_gem.rb
2798ed3c 248@@ -1288,7 +1288,8 @@ def test_self_use_paths
1c3d4237 249
250 def test_self_user_dir
251 parts = [@userhome, '.gem', Gem.ruby_engine]
252- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
253+ ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
254+ parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
255
256 assert_equal File.join(parts), Gem.user_dir
257 end
2798ed3c 258@@ -1365,7 +1366,7 @@ def test_self_gzip
1c3d4237 259 def test_self_vendor_dir
260 expected =
261 File.join RbConfig::CONFIG['vendordir'], 'gems',
262- RbConfig::CONFIG['ruby_version']
263+ RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
264
265 assert_equal expected, Gem.vendor_dir
266 end
267--
2682.1.0
269
270
271From 88c38a030c22dbf9422ece847bdfbf87d6659313 Mon Sep 17 00:00:00 2001
272From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
273Date: Wed, 1 Apr 2015 14:55:37 +0200
274Subject: [PATCH 4/4] Let headers directories follow the configured version
275 name.
276
277---
2798ed3c 278 configure.ac | 2 +-
1c3d4237 279 1 file changed, 1 insertion(+), 1 deletion(-)
280
2798ed3c 281diff --git a/configure.ac b/configure.ac
282index a00f2b6776..999e2d6d5d 100644
283--- a/configure.ac
284+++ b/configure.ac
285@@ -101,7 +101,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
1c3d4237 286 RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
287 AC_SUBST(RUBY_BASE_NAME)
288 AC_SUBST(RUBYW_BASE_NAME)
289-AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
290+AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version_dir_name}')
291
292 AC_CANONICAL_TARGET
293 test x"$target_alias" = x &&
294--
2952.1.0
296
This page took 0.143511 seconds and 4 git commands to generate.