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