Blame SOURCES/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch

364bab
From e24d97c938c481450ed80ec83e5399595946c1ae Mon Sep 17 00:00:00 2001
364bab
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
364bab
Date: Fri, 8 Feb 2013 22:48:41 +0100
364bab
Subject: [PATCH] Prevent duplicated paths when empty version string is
364bab
 configured.
364bab
364bab
---
364bab
 configure.in     |  3 ++-
364bab
 loadpath.c       | 12 ++++++++++++
364bab
 tool/mkconfig.rb |  2 +-
364bab
 3 files changed, 15 insertions(+), 2 deletions(-)
364bab
364bab
diff --git a/configure.in b/configure.in
364bab
index db37cd6..ce8d149 100644
364bab
--- a/configure.in
364bab
+++ b/configure.in
95f66f
@@ -4276,7 +4276,8 @@ AS_CASE(["$ruby_version_dir_name"],
364bab
 ruby_version_dir=/'${ruby_version_dir_name}'
364bab
 
364bab
 if test -z "${ruby_version_dir_name}"; then
364bab
-    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
364bab
+    unset ruby_version_dir
364bab
+    AC_DEFINE(RUBY_LIB_VERSION_BLANK, 1)
364bab
 fi
364bab
 
364bab
 rubylibdir='${rubylibprefix}'${ruby_version_dir}
364bab
diff --git a/loadpath.c b/loadpath.c
364bab
index 9160031..0d4d953 100644
364bab
--- a/loadpath.c
364bab
+++ b/loadpath.c
364bab
@@ -65,22 +65,34 @@ const char ruby_initial_load_paths[] =
364bab
     RUBY_SEARCH_PATH "\0"
364bab
 #endif
364bab
 #ifndef NO_RUBY_SITE_LIB
364bab
+#ifdef RUBY_LIB_VERSION_BLANK
364bab
+    RUBY_SITE_LIB "\0"
364bab
+#else
364bab
     RUBY_SITE_LIB2 "\0"
364bab
+#endif
364bab
 #ifdef RUBY_THINARCH
364bab
     RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
364bab
 #endif
364bab
     RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
364bab
+#ifndef RUBY_LIB_VERSION_BLANK
364bab
     RUBY_SITE_LIB "\0"
364bab
 #endif
364bab
+#endif
364bab
 
364bab
 #ifndef NO_RUBY_VENDOR_LIB
364bab
+#ifdef RUBY_LIB_VERSION_BLANK
364bab
+    RUBY_VENDOR_LIB "\0"
364bab
+#else
364bab
     RUBY_VENDOR_LIB2 "\0"
364bab
+#endif
364bab
 #ifdef RUBY_THINARCH
364bab
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
364bab
 #endif
364bab
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
364bab
+#ifndef RUBY_LIB_VERSION_BLANK
364bab
     RUBY_VENDOR_LIB "\0"
364bab
 #endif
364bab
+#endif
364bab
 
364bab
     RUBY_LIB "\0"
364bab
 #ifdef RUBY_THINARCH
364bab
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
364bab
index 07076d4..35e6c3c 100755
364bab
--- a/tool/mkconfig.rb
364bab
+++ b/tool/mkconfig.rb
364bab
@@ -122,7 +122,7 @@ def config.write(arg)
364bab
     val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
364bab
     case name
364bab
     when /^prefix$/
364bab
-      val = "(TOPDIR || DESTDIR + #{val})"
364bab
+      val = "(((TOPDIR && TOPDIR.empty?) ? nil : TOPDIR) || DESTDIR + #{val})"
364bab
     when /^ARCH_FLAG$/
364bab
       val = "arch_flag || #{val}" if universal
364bab
     when /^UNIVERSAL_ARCHNAMES$/
364bab
-- 
364bab
1.9.0
364bab