vondruch / rpms / ruby

Forked from rpms/ruby 6 years ago
Clone
f49b015
From e24d97c938c481450ed80ec83e5399595946c1ae Mon Sep 17 00:00:00 2001
bf92566
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
bf92566
Date: Fri, 8 Feb 2013 22:48:41 +0100
bf92566
Subject: [PATCH] Prevent duplicated paths when empty version string is
bf92566
 configured.
bf92566
bf92566
---
c2db65d
 configure.ac     |  3 ++-
f49b015
 loadpath.c       | 12 ++++++++++++
f49b015
 tool/mkconfig.rb |  2 +-
4c12d4e
 3 files changed, 15 insertions(+), 2 deletions(-)
bf92566
c2db65d
diff --git a/configure.ac b/configure.ac
c2db65d
index 999e2d6d5d..11fc237552 100644
c2db65d
--- a/configure.ac
c2db65d
+++ b/configure.ac
c2db65d
@@ -4250,7 +4250,8 @@ AS_CASE(["$ruby_version_dir_name"],
4c12d4e
 ruby_version_dir=/'${ruby_version_dir_name}'
360d2b9
 
4c12d4e
 if test -z "${ruby_version_dir_name}"; then
a03b2d2
-    AC_MSG_ERROR([No ruby version, No place for bundled libraries])
4c12d4e
+    unset ruby_version_dir
a03b2d2
+    AC_DEFINE(RUBY_LIB_VERSION_BLANK, 1)
bf92566
 fi
a03b2d2
 
4c12d4e
 rubylibdir='${rubylibprefix}'${ruby_version_dir}
a03b2d2
diff --git a/loadpath.c b/loadpath.c
360d2b9
index 9160031..0d4d953 100644
a03b2d2
--- a/loadpath.c
a03b2d2
+++ b/loadpath.c
c2db65d
@@ -65,21 +65,33 @@ const char ruby_initial_load_paths[] =
a03b2d2
     RUBY_SEARCH_PATH "\0"
bf92566
 #endif
a03b2d2
 #ifndef NO_RUBY_SITE_LIB
360d2b9
+#ifdef RUBY_LIB_VERSION_BLANK
360d2b9
+    RUBY_SITE_LIB "\0"
360d2b9
+#else
a03b2d2
     RUBY_SITE_LIB2 "\0"
a03b2d2
+#endif
a03b2d2
 #ifdef RUBY_THINARCH
bf92566
     RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
bf92566
 #endif
360d2b9
     RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
360d2b9
+#ifndef RUBY_LIB_VERSION_BLANK
360d2b9
     RUBY_SITE_LIB "\0"
bf92566
 #endif
360d2b9
+#endif
bf92566
 
bf92566
 #ifndef NO_RUBY_VENDOR_LIB
360d2b9
+#ifdef RUBY_LIB_VERSION_BLANK
360d2b9
+    RUBY_VENDOR_LIB "\0"
360d2b9
+#else
a03b2d2
     RUBY_VENDOR_LIB2 "\0"
bf92566
+#endif
bf92566
 #ifdef RUBY_THINARCH
a03b2d2
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
a03b2d2
 #endif
360d2b9
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
360d2b9
+#ifndef RUBY_LIB_VERSION_BLANK
360d2b9
     RUBY_VENDOR_LIB "\0"
360d2b9
+#endif
c2db65d
 #endif
360d2b9
 
360d2b9
     RUBY_LIB "\0"
f49b015
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
f49b015
index 07076d4..35e6c3c 100755
f49b015
--- a/tool/mkconfig.rb
f49b015
+++ b/tool/mkconfig.rb
c2db65d
@@ -111,7 +111,7 @@
f49b015
     val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
f49b015
     case name
f49b015
     when /^prefix$/
f49b015
-      val = "(TOPDIR || DESTDIR + #{val})"
f49b015
+      val = "(((TOPDIR && TOPDIR.empty?) ? nil : TOPDIR) || DESTDIR + #{val})"
f49b015
     when /^ARCH_FLAG$/
f49b015
       val = "arch_flag || #{val}" if universal
f49b015
     when /^UNIVERSAL_ARCHNAMES$/
bf92566
-- 
f49b015
1.9.0
bf92566