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