1 |
From fa1a50ad10814f724b8713865dc222724cb955ab Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> |
3 |
Date: Thu, 25 Aug 2011 14:33:51 +0200 |
4 |
Subject: [PATCH] Allow to disable versioned paths. |
5 |
|
6 |
--- |
7 |
configure.in | 11 +++++++++++ |
8 |
tool/mkconfig.rb | 9 ++++++--- |
9 |
version.c | 10 ++++++++++ |
10 |
3 files changed, 27 insertions(+), 3 deletions(-) |
11 |
|
12 |
diff --git a/configure.in b/configure.in |
13 |
index e742e74..86cb68f 100644 |
14 |
--- a/configure.in |
15 |
+++ b/configure.in |
16 |
@@ -2963,6 +2963,17 @@ else |
17 |
fi |
18 |
AC_SUBST(USE_RUBYGEMS) |
19 |
|
20 |
+AC_ARG_ENABLE(versioned-paths, |
21 |
+ AS_HELP_STRING([--disable-versioned-paths], [disable paths with version number]), |
22 |
+ [enable_versioned_paths="$enableval"], [enable_versioned_paths=yes]) |
23 |
+if test x"$enable_versioned_paths" = xno; then |
24 |
+ AC_DEFINE(DISABLE_VERSIONED_PATHS, 1) |
25 |
+ USE_VERSIONED_PATHS=NO |
26 |
+else |
27 |
+ USE_VERSIONED_PATHS=YES |
28 |
+fi |
29 |
+AC_SUBST(USE_VERSIONED_PATHS) |
30 |
+ |
31 |
arch_hdrdir="${EXTOUT}/include/${arch}/ruby" |
32 |
AS_MKDIR_P("${arch_hdrdir}") |
33 |
config_h="${arch_hdrdir}/config.h" |
34 |
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb |
35 |
index a2221f0..47d8c8f 100755 |
36 |
--- a/tool/mkconfig.rb |
37 |
+++ b/tool/mkconfig.rb |
38 |
@@ -42,6 +42,7 @@ v_others = [] |
39 |
vars = {} |
40 |
continued_name = nil |
41 |
continued_line = nil |
42 |
+path_version = "/$(ruby_version)" |
43 |
File.foreach "config.status" do |line| |
44 |
next if /^#/ =~ line |
45 |
name = nil |
46 |
@@ -138,6 +139,8 @@ File.foreach "config.status" do |line| |
47 |
case name |
48 |
when "ruby_version" |
49 |
version = val[/\A"(.*)"\z/, 1] |
50 |
+ when /^USE_VERSIONED_PATHS$/ |
51 |
+ path_version = nil if /NO/ =~ val |
52 |
end |
53 |
end |
54 |
# break if /^CEOF/ |
55 |
@@ -203,15 +206,15 @@ end |
56 |
print(*v_fast) |
57 |
print(*v_others) |
58 |
print <<EOS |
59 |
- CONFIG["rubylibdir"] = "$(rubylibprefix)/$(ruby_version)" |
60 |
+ CONFIG["rubylibdir"] = "$(rubylibprefix)#{path_version}" |
61 |
CONFIG["archdir"] = "$(rubylibdir)/$(arch)" |
62 |
EOS |
63 |
print <<EOS unless v_disabled["sitedir"] |
64 |
- CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)" |
65 |
+ CONFIG["sitelibdir"] = "$(sitedir)#{path_version}" |
66 |
CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)" |
67 |
EOS |
68 |
print <<EOS unless v_disabled["vendordir"] |
69 |
- CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)" |
70 |
+ CONFIG["vendorlibdir"] = "$(vendordir)#{path_version}" |
71 |
CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)" |
72 |
EOS |
73 |
print <<EOS |
74 |
diff --git a/version.c b/version.c |
75 |
index 59d4e5e..641dc33 100644 |
76 |
--- a/version.c |
77 |
+++ b/version.c |
78 |
@@ -38,9 +38,15 @@ |
79 |
#define RUBY_VENDOR_LIB RUBY_LIB_PREFIX"/vendor_ruby" |
80 |
#endif |
81 |
|
82 |
+#ifdef DISABLE_VERSIONED_PATHS |
83 |
+#define RUBY_LIB RUBY_LIB_PREFIX |
84 |
+#define RUBY_SITE_LIB2 RUBY_SITE_LIB |
85 |
+#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB |
86 |
+#else |
87 |
#define RUBY_LIB RUBY_LIB_PREFIX "/"RUBY_LIB_VERSION |
88 |
#define RUBY_SITE_LIB2 RUBY_SITE_LIB "/"RUBY_LIB_VERSION |
89 |
#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB "/"RUBY_LIB_VERSION |
90 |
+#endif |
91 |
#define RUBY_ARCHLIB RUBY_LIB "/"RUBY_ARCH |
92 |
#define RUBY_SITE_ARCHLIB RUBY_SITE_LIB2 "/"RUBY_SITEARCH |
93 |
#define RUBY_VENDOR_ARCHLIB RUBY_VENDOR_LIB2 "/"RUBY_SITEARCH |
94 |
@@ -75,8 +81,10 @@ const char ruby_initial_load_paths[] = |
95 |
RUBY_SITE_THIN_ARCHLIB "\0" |
96 |
#endif |
97 |
RUBY_SITE_ARCHLIB "\0" |
98 |
+#ifndef DISABLE_VERSIONED_PATHS |
99 |
RUBY_SITE_LIB "\0" |
100 |
#endif |
101 |
+#endif |
102 |
|
103 |
#ifndef NO_RUBY_VENDOR_LIB |
104 |
RUBY_VENDOR_LIB2 "\0" |
105 |
@@ -84,8 +92,10 @@ const char ruby_initial_load_paths[] = |
106 |
RUBY_VENDOR_THIN_ARCHLIB "\0" |
107 |
#endif |
108 |
RUBY_VENDOR_ARCHLIB "\0" |
109 |
+#ifndef DISABLE_VERSIONED_PATHS |
110 |
RUBY_VENDOR_LIB "\0" |
111 |
#endif |
112 |
+#endif |
113 |
|
114 |
RUBY_LIB "\0" |
115 |
#ifdef RUBY_THIN_ARCHLIB |
116 |
-- |
117 |
1.7.7.3 |
118 |
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb |
119 |
index a3c65bf..0575730 100644 |
120 |
--- a/lib/rdoc/ri/paths.rb |
121 |
+++ b/lib/rdoc/ri/paths.rb |
122 |
@@ -11,9 +11,9 @@ module RDoc::RI::Paths |
123 |
version = RbConfig::CONFIG['ruby_version'] |
124 |
|
125 |
base = if RbConfig::CONFIG.key? 'ridir' then |
126 |
- File.join RbConfig::CONFIG['ridir'], version |
127 |
+ File.join [RbConfig::CONFIG['ridir'], RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? version : nil].compact |
128 |
else |
129 |
- File.join RbConfig::CONFIG['datadir'], 'ri', version |
130 |
+ File.join [RbConfig::CONFIG['datadir'], 'ri', RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? version : nil].compact |
131 |
end |
132 |
|
133 |
SYSDIR = File.join base, "system" |
134 |
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb |
135 |
index cec8c9f..fed14d2 100755 |
136 |
--- a/tool/rbinstall.rb |
137 |
+++ b/tool/rbinstall.rb |
138 |
@@ -379,7 +379,7 @@ end |
139 |
|
140 |
install?(:doc, :rdoc) do |
141 |
if $rdocdir |
142 |
- ridatadir = File.join(CONFIG['ridir'], CONFIG['ruby_version'], "system") |
143 |
+ ridatadir = File.join([CONFIG['ridir'], RbConfig::CONFIG['USE_VERSIONED_PATHS'] == 'YES' ? CONFIG['ruby_version'] : nil, "system"].compact) |
144 |
prepare "rdoc", ridatadir |
145 |
install_recursive($rdocdir, ridatadir, :mode => $data_mode) |
146 |
end |
147 |
-- |
148 |
1.7.6 |
149 |
|