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