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