ruby-1.9.3-disable-versioned-paths.patch 4.8 KB

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