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