ruby/ruby-1.9.3-disable-versioned-paths.patch

150 lines
4.8 KiB
Diff
Raw Normal View History

2012-11-19 13:32:58 +00:00
From 23cfbaa371f82d0b4652c9e37189a2be82fa3d4c Mon Sep 17 00:00:00 2001
2012-01-18 14:54:01 +00:00
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 25 Aug 2011 14:33:51 +0200
Subject: [PATCH] Allow to disable versioned paths.
---
2012-11-19 13:32:58 +00:00
configure.in | 11 +++++++++++
lib/rdoc/ri/paths.rb | 4 ++--
tool/mkconfig.rb | 9 ++++++---
tool/rbinstall.rb | 2 +-
version.c | 10 ++++++++++
5 files changed, 30 insertions(+), 6 deletions(-)
2012-01-18 14:54:01 +00:00
diff --git a/configure.in b/configure.in
2012-11-19 13:32:58 +00:00
index f2d22ef..db3641b 100644
2012-01-18 14:54:01 +00:00
--- a/configure.in
+++ b/configure.in
2012-12-20 15:46:57 +00:00
@@ -3346,6 +3346,17 @@ else
2012-01-18 14:54:01 +00:00
fi
AC_SUBST(USE_RUBYGEMS)
+AC_ARG_ENABLE(versioned-paths,
+ AS_HELP_STRING([--disable-versioned-paths], [disable paths with version number]),
+ [enable_versioned_paths="$enableval"], [enable_versioned_paths=yes])
+if test x"$enable_versioned_paths" = xno; then
+ AC_DEFINE(DISABLE_VERSIONED_PATHS, 1)
+ USE_VERSIONED_PATHS=NO
+else
+ USE_VERSIONED_PATHS=YES
+fi
+AC_SUBST(USE_VERSIONED_PATHS)
+
arch_hdrdir="${EXTOUT}/include/${arch}/ruby"
AS_MKDIR_P("${arch_hdrdir}")
config_h="${arch_hdrdir}/config.h"
2012-11-19 13:32:58 +00:00
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index a3c65bf..a4e8559 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
2012-12-04 11:51:34 +00:00
@@ -12,9 +12,9 @@ module RDoc::RI::Paths
2012-11-19 13:32:58 +00:00
version = RbConfig::CONFIG['ruby_version']
2012-12-04 11:51:34 +00:00
BASE = if RbConfig::CONFIG.key? 'ridir' then
2012-11-19 13:32:58 +00:00
- File.join RbConfig::CONFIG['ridir'], version
+ File.join [RbConfig::CONFIG['ridir'], RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? version : nil].compact
else
- File.join RbConfig::CONFIG['datadir'], 'ri', version
+ File.join [RbConfig::CONFIG['datadir'], 'ri', RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? version : nil].compact
end
2012-12-04 11:51:34 +00:00
homedir = begin
2012-01-18 14:54:01 +00:00
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
2012-11-19 13:32:58 +00:00
index f9d97d3..d9e26c1 100755
2012-01-18 14:54:01 +00:00
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -43,6 +43,7 @@ v_runtime = {}
2012-01-18 14:54:01 +00:00
vars = {}
continued_name = nil
continued_line = nil
+path_version = "/$(ruby_version)"
File.foreach "config.status" do |line|
next if /^#/ =~ line
name = nil
@@ -142,6 +143,8 @@ File.foreach "config.status" do |line|
2012-01-18 14:54:01 +00:00
case name
when "ruby_version"
version = val[/\A"(.*)"\z/, 1]
+ when /^USE_VERSIONED_PATHS$/
+ path_version = nil if /NO/ =~ val
end
end
# break if /^CEOF/
@@ -207,15 +210,15 @@ end
2012-01-18 14:54:01 +00:00
print(*v_fast)
print(*v_others)
print <<EOS
- CONFIG["rubylibdir"] = "$(rubylibprefix)/$(ruby_version)"
+ CONFIG["rubylibdir"] = "$(rubylibprefix)#{path_version}"
CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
EOS
print <<EOS unless v_disabled["sitedir"]
- CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
+ CONFIG["sitelibdir"] = "$(sitedir)#{path_version}"
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
EOS
print <<EOS unless v_disabled["vendordir"]
- CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
+ CONFIG["vendorlibdir"] = "$(vendordir)#{path_version}"
CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
EOS
print <<EOS
2012-11-19 13:32:58 +00:00
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index f5facca..17294a2 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -392,7 +392,7 @@ end
install?(:doc, :rdoc) do
if $rdocdir
- ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system")
+ ridatadir = File.join([CONFIG['ridir'], RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? version : nil, "system"].compact)
prepare "rdoc", ridatadir
install_recursive($rdocdir, ridatadir, :mode => $data_mode)
end
2012-01-18 14:54:01 +00:00
diff --git a/version.c b/version.c
2012-11-19 13:32:58 +00:00
index 26e275a..05e5069 100644
2012-01-18 14:54:01 +00:00
--- a/version.c
+++ b/version.c
2012-04-18 17:40:36 +00:00
@@ -39,9 +39,15 @@
2012-01-18 14:54:01 +00:00
#define RUBY_VENDOR_LIB RUBY_LIB_PREFIX"/vendor_ruby"
#endif
+#ifdef DISABLE_VERSIONED_PATHS
+#define RUBY_LIB RUBY_LIB_PREFIX
+#define RUBY_SITE_LIB2 RUBY_SITE_LIB
+#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB
+#else
#define RUBY_LIB RUBY_LIB_PREFIX "/"RUBY_LIB_VERSION
#define RUBY_SITE_LIB2 RUBY_SITE_LIB "/"RUBY_LIB_VERSION
#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB "/"RUBY_LIB_VERSION
+#endif
#define RUBY_ARCHLIB RUBY_LIB "/"RUBY_ARCH
#define RUBY_SITE_ARCHLIB RUBY_SITE_LIB2 "/"RUBY_SITEARCH
#define RUBY_VENDOR_ARCHLIB RUBY_VENDOR_LIB2 "/"RUBY_SITEARCH
2012-04-18 17:40:36 +00:00
@@ -76,8 +82,10 @@ const char ruby_initial_load_paths[] =
2012-01-18 14:54:01 +00:00
RUBY_SITE_THIN_ARCHLIB "\0"
#endif
RUBY_SITE_ARCHLIB "\0"
+#ifndef DISABLE_VERSIONED_PATHS
RUBY_SITE_LIB "\0"
#endif
+#endif
#ifndef NO_RUBY_VENDOR_LIB
RUBY_VENDOR_LIB2 "\0"
2012-04-18 17:40:36 +00:00
@@ -85,8 +93,10 @@ const char ruby_initial_load_paths[] =
2012-01-18 14:54:01 +00:00
RUBY_VENDOR_THIN_ARCHLIB "\0"
#endif
RUBY_VENDOR_ARCHLIB "\0"
+#ifndef DISABLE_VERSIONED_PATHS
RUBY_VENDOR_LIB "\0"
#endif
+#endif
RUBY_LIB "\0"
#ifdef RUBY_THIN_ARCHLIB
--
2012-11-19 13:32:58 +00:00
1.8.0
2012-01-18 14:54:01 +00:00