pvalena / rpms / ruby

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