9f96fe
From 4fc1be3af3f58621bb751c9e63c208b15c0e8d16 Mon Sep 17 00:00:00 2001
9f96fe
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
9f96fe
Date: Tue, 31 Mar 2015 16:21:04 +0200
9f96fe
Subject: [PATCH 1/4] Use ruby_version_dir_name for versioned directories.
9f96fe
9f96fe
This disallows changing the ruby_version constant by --with-ruby-version
9f96fe
configuration options. The two places version numbers are disallowed as
9f96fe
well, since there are a lot of places which cannot handle this format
9f96fe
properly.
9f96fe
9f96fe
ruby_version_dir_name now specifies custom version string for versioned
9f96fe
directories, e.g. instead of default X.Y.Z, you can specify whatever
9f96fe
string.
9f96fe
---
9f96fe
 configure.ac        | 64 ++++++++++++++++++++++++---------------------
9f96fe
 template/ruby.pc.in |  1 +
9f96fe
 2 files changed, 35 insertions(+), 30 deletions(-)
9f96fe
9f96fe
diff --git a/configure.ac b/configure.ac
9f96fe
index 80b137e380..63cd3b4f8b 100644
9f96fe
--- a/configure.ac
9f96fe
+++ b/configure.ac
9f96fe
@@ -3977,9 +3977,6 @@ AS_CASE(["$target_os"],
9f96fe
     rubyw_install_name='$(RUBYW_INSTALL_NAME)'
9f96fe
     ])
9f96fe
 
9f96fe
-rubylibdir='${rubylibprefix}/${ruby_version}'
9f96fe
-rubyarchdir=${multiarch+'${rubyarchprefix}/${ruby_version}'}${multiarch-'${rubylibdir}/${arch}'}
9f96fe
-
9f96fe
 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
9f96fe
 AC_ARG_WITH(rubyarchprefix,
9f96fe
 	    AS_HELP_STRING([--with-rubyarchprefix=DIR],
9f96fe
@@ -4002,56 +3999,62 @@ AC_ARG_WITH(ridir,
9f96fe
 AC_SUBST(ridir)
9f96fe
 AC_SUBST(RI_BASE_NAME)
9f96fe
 
9f96fe
-AC_ARG_WITH(ruby-version,
9f96fe
-	    AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|minor|STR)]),
9f96fe
-            [ruby_version=$withval],
9f96fe
-            [ruby_version=full])
9f96fe
 unset RUBY_LIB_VERSION
9f96fe
-unset RUBY_LIB_VERSION_STYLE
9f96fe
-AS_CASE(["$ruby_version"],
9f96fe
-  [full],  [RUBY_LIB_VERSION_STYLE='3	/* full */'],
9f96fe
-  [minor], [RUBY_LIB_VERSION_STYLE='2	/* minor */'])
9f96fe
-AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
9f96fe
-    {
9f96fe
-    echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
9f96fe
-    echo '#define STRINGIZE(x) x'
9f96fe
-    test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
9f96fe
-    echo '#include "version.h"'
9f96fe
-    echo 'ruby_version=RUBY_LIB_VERSION'
9f96fe
-    } > conftest.c
9f96fe
-    ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
9f96fe
-    eval $ruby_version
9f96fe
-], [test -z "${ruby_version}"], [
9f96fe
-    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
9f96fe
-], [
9f96fe
-    RUBY_LIB_VERSION="${ruby_version}"
9f96fe
-])
9f96fe
+RUBY_LIB_VERSION_STYLE='3	/* full */'
9f96fe
+{
9f96fe
+echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
9f96fe
+echo '#define STRINGIZE(x) x'
9f96fe
+test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
9f96fe
+echo '#include "version.h"'
9f96fe
+echo 'ruby_version=RUBY_LIB_VERSION'
9f96fe
+} > conftest.c
9f96fe
+ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
9f96fe
+eval $ruby_version
9f96fe
+
9f96fe
+RUBY_LIB_VERSION="${ruby_version}"
9f96fe
+
9f96fe
 AC_SUBST(RUBY_LIB_VERSION_STYLE)
9f96fe
 AC_SUBST(RUBY_LIB_VERSION)
9f96fe
 
9f96fe
+AC_ARG_WITH(ruby-version,
9f96fe
+	    AS_HELP_STRING([--with-ruby-version=STR], [ruby version string for version specific directories [[full]] (full|STR)]),
9f96fe
+            [ruby_version_dir_name=$withval],
9f96fe
+            [ruby_version_dir_name=full])
9f96fe
+AS_CASE(["$ruby_version_dir_name"],
9f96fe
+  [full], [ruby_version_dir_name='${ruby_version}'])
9f96fe
+
9f96fe
+ruby_version_dir=/'${ruby_version_dir_name}'
9f96fe
+
9f96fe
+if test -z "${ruby_version_dir_name}"; then
9f96fe
+    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
9f96fe
+fi
9f96fe
+
9f96fe
+rubylibdir='${rubylibprefix}'${ruby_version_dir}
9f96fe
+rubyarchdir=${multiarch+'${rubyarchprefix}'${ruby_version_dir}}${multiarch-'${rubylibdir}/${arch}'}
9f96fe
+
9f96fe
 AC_ARG_WITH(sitedir,
9f96fe
 	    AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
9f96fe
             [sitedir=$withval],
9f96fe
             [sitedir='${rubylibprefix}/site_ruby'])
9f96fe
-sitelibdir='${sitedir}/${ruby_version}'
9f96fe
+sitelibdir='${sitedir}'${ruby_version_dir}
9f96fe
 
9f96fe
 AC_ARG_WITH(sitearchdir,
9f96fe
 	    AS_HELP_STRING([--with-sitearchdir=DIR],
9f96fe
 			   [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
9f96fe
             [sitearchdir=$withval],
9f96fe
-            [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
9f96fe
+            [sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby'${ruby_version_dir}}${multiarch-'${sitelibdir}/${sitearch}'}])
9f96fe
 
9f96fe
 AC_ARG_WITH(vendordir,
9f96fe
 	    AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]),
9f96fe
             [vendordir=$withval],
9f96fe
             [vendordir='${rubylibprefix}/vendor_ruby'])
9f96fe
-vendorlibdir='${vendordir}/${ruby_version}'
9f96fe
+vendorlibdir='${vendordir}'${ruby_version_dir}
9f96fe
 
9f96fe
 AC_ARG_WITH(vendorarchdir,
9f96fe
 	    AS_HELP_STRING([--with-vendorarchdir=DIR],
9f96fe
 			   [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
9f96fe
             [vendorarchdir=$withval],
9f96fe
-            [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
9f96fe
+            [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
9f96fe
 
9f96fe
 AS_IF([test "${LOAD_RELATIVE+set}"], [
9f96fe
     AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
9f96fe
@@ -4068,6 +4071,7 @@ AC_SUBST(sitearchincludedir)dnl
9f96fe
 AC_SUBST(arch)dnl
9f96fe
 AC_SUBST(sitearch)dnl
9f96fe
 AC_SUBST(ruby_version)dnl
9f96fe
+AC_SUBST(ruby_version_dir_name)dnl
9f96fe
 AC_SUBST(rubylibdir)dnl
9f96fe
 AC_SUBST(rubyarchdir)dnl
9f96fe
 AC_SUBST(sitedir)dnl
9f96fe
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
9f96fe
index 8a2c066..c81b211 100644
9f96fe
--- a/template/ruby.pc.in
9f96fe
+++ b/template/ruby.pc.in
9f96fe
@@ -2,6 +2,7 @@ MAJOR=@MAJOR@
9f96fe
 MINOR=@MINOR@
9f96fe
 TEENY=@TEENY@
9f96fe
 ruby_version=@ruby_version@
9f96fe
+ruby_version_dir_name=@ruby_version_dir_name@
9f96fe
 RUBY_API_VERSION=@RUBY_API_VERSION@
9f96fe
 RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
9f96fe
 arch=@arch@
9f96fe
-- 
9f96fe
2.1.0
9f96fe
9f96fe
9f96fe
From 518850aba6eee76de7715aae8d37330e34b01983 Mon Sep 17 00:00:00 2001
9f96fe
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
9f96fe
Date: Tue, 31 Mar 2015 16:37:26 +0200
9f96fe
Subject: [PATCH 2/4] Add ruby_version_dir_name support for RDoc.
9f96fe
9f96fe
---
9f96fe
 lib/rdoc/ri/paths.rb | 2 +-
9f96fe
 tool/rbinstall.rb    | 2 +-
9f96fe
 2 files changed, 2 insertions(+), 2 deletions(-)
9f96fe
9f96fe
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
9f96fe
index 970cb91..5bf8230 100644
9f96fe
--- a/lib/rdoc/ri/paths.rb
9f96fe
+++ b/lib/rdoc/ri/paths.rb
9f96fe
@@ -10,7 +10,7 @@ module RDoc::RI::Paths
9f96fe
   #:stopdoc:
9f96fe
   require 'rbconfig'
9f96fe
 
9f96fe
-  version = RbConfig::CONFIG['ruby_version']
9f96fe
+  version = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
9f96fe
 
9f96fe
   BASE    = File.join RbConfig::CONFIG['ridir'], version
9f96fe
 
9f96fe
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
9f96fe
index d4c110e..d39c9a6 100755
9f96fe
--- a/tool/rbinstall.rb
9f96fe
+++ b/tool/rbinstall.rb
9f96fe
@@ -448,7 +448,7 @@ def CONFIG.[](name, mandatory = false)
9f96fe
 
9f96fe
 install?(:doc, :rdoc) do
9f96fe
   if $rdocdir
9f96fe
-    ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
9f96fe
+    ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version_dir_name'] || CONFIG['ruby_version'], "system")
9f96fe
     prepare "rdoc", ridatadir
9f96fe
     install_recursive($rdocdir, ridatadir, :no_install => rdoc_noinst, :mode => $data_mode)
9f96fe
   end
9f96fe
-- 
9f96fe
2.23.0
9f96fe
9f96fe
9f96fe
From 9f0ec0233f618cbb862629816b22491c3df79578 Mon Sep 17 00:00:00 2001
9f96fe
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
9f96fe
Date: Tue, 31 Mar 2015 16:37:44 +0200
9f96fe
Subject: [PATCH 3/4] Add ruby_version_dir_name support for RubyGems.
9f96fe
9f96fe
---
9f96fe
 lib/rubygems/defaults.rb  | 7 ++++---
9f96fe
 test/rubygems/test_gem.rb | 5 +++--
9f96fe
 2 files changed, 7 insertions(+), 5 deletions(-)
9f96fe
9f96fe
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
9f96fe
index d4ff4a262c..3f9a5bf590 100644
9f96fe
--- a/lib/rubygems/defaults.rb
9f96fe
+++ b/lib/rubygems/defaults.rb
9f96fe
@@ -34,7 +34,7 @@ def self.default_spec_cache_dir
9f96fe
   # specified in the environment
9f96fe
 
9f96fe
   def self.default_dir
9f96fe
-    @default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version'])
9f96fe
+    @default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version'])
9f96fe
   end
9f96fe
 
9f96fe
   ##
9f96fe
@@ -103,7 +103,8 @@ def self.user_dir
9f96fe
     gem_dir = File.join(Gem.user_home, ".gem")
9f96fe
     gem_dir = File.join(Gem.data_home, "gem") unless File.exist?(gem_dir)
9f96fe
     parts = [gem_dir, ruby_engine]
9f96fe
-    parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
9f96fe
+    ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
9f96fe
+    parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
9f96fe
     File.join parts
9f96fe
   end
9f96fe
 
9f96fe
@@ -234,7 +235,7 @@ def self.vendor_dir # :nodoc:
9f96fe
     return nil unless RbConfig::CONFIG.key? 'vendordir'
9f96fe
 
9f96fe
     File.join RbConfig::CONFIG['vendordir'], 'gems',
9f96fe
-              RbConfig::CONFIG['ruby_version']
9f96fe
+              RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
9f96fe
   end
9f96fe
 
9f96fe
   ##
9f96fe
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
9f96fe
index b25068405d..e9fef4a311 100644
9f96fe
--- a/test/rubygems/test_gem.rb
9f96fe
+++ b/test/rubygems/test_gem.rb
9f96fe
@@ -1410,7 +1410,8 @@ def test_self_use_paths
9f96fe
 
9f96fe
   def test_self_user_dir
9f96fe
     parts = [@userhome, '.gem', Gem.ruby_engine]
9f96fe
-    parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
9f96fe
+    ruby_version_dir_name = RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
9f96fe
+    parts << ruby_version_dir_name unless ruby_version_dir_name.empty?
9f96fe
 
9f96fe
     FileUtils.mkdir_p File.join(parts)
9f96fe
 
9f96fe
@@ -1486,7 +1487,7 @@ def test_self_vendor_dir
9f96fe
     vendordir(File.join(@tempdir, 'vendor')) do
9f96fe
       expected =
9f96fe
         File.join RbConfig::CONFIG['vendordir'], 'gems',
9f96fe
-                  RbConfig::CONFIG['ruby_version']
9f96fe
+                  RbConfig::CONFIG['ruby_version_dir_name'] || RbConfig::CONFIG['ruby_version']
9f96fe
 
9f96fe
       assert_equal expected, Gem.vendor_dir
9f96fe
     end
9f96fe
-- 
9f96fe
2.1.0
9f96fe
9f96fe
9f96fe
From 88c38a030c22dbf9422ece847bdfbf87d6659313 Mon Sep 17 00:00:00 2001
9f96fe
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
9f96fe
Date: Wed, 1 Apr 2015 14:55:37 +0200
9f96fe
Subject: [PATCH 4/4] Let headers directories follow the configured version
9f96fe
 name.
9f96fe
9f96fe
---
9f96fe
 configure.ac | 2 +-
9f96fe
 1 file changed, 1 insertion(+), 1 deletion(-)
9f96fe
9f96fe
diff --git a/configure.ac b/configure.ac
9f96fe
index a00f2b6776..999e2d6d5d 100644
9f96fe
--- a/configure.ac
9f96fe
+++ b/configure.ac
9f96fe
@@ -108,7 +108,7 @@ RUBY_BASE_NAME=`echo ruby | sed "$program_transform_name"`
9f96fe
 RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
9f96fe
 AC_SUBST(RUBY_BASE_NAME)
9f96fe
 AC_SUBST(RUBYW_BASE_NAME)
9f96fe
-AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
9f96fe
+AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version_dir_name}')
9f96fe
 
9f96fe
 dnl checks for alternative programs
9f96fe
 AC_CANONICAL_BUILD
9f96fe
-- 
9f96fe
2.1.0
9f96fe