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