Blame SOURCES/ruby-2.3.0-ruby_version.patch

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