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

78 lines
2.2 KiB
Diff
Raw Normal View History

From e24d97c938c481450ed80ec83e5399595946c1ae Mon Sep 17 00:00:00 2001
2013-02-08 23:54:37 +00:00
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Fri, 8 Feb 2013 22:48:41 +0100
Subject: [PATCH] Prevent duplicated paths when empty version string is
configured.
---
2018-01-03 11:06:40 +00:00
configure.ac | 3 ++-
loadpath.c | 12 ++++++++++++
tool/mkconfig.rb | 2 +-
2016-01-05 09:58:10 +00:00
3 files changed, 15 insertions(+), 2 deletions(-)
2013-02-08 23:54:37 +00:00
2018-01-03 11:06:40 +00:00
diff --git a/configure.ac b/configure.ac
index c42436c23d..d261ea57b5 100644
2018-01-03 11:06:40 +00:00
--- a/configure.ac
+++ b/configure.ac
@@ -4312,7 +4312,8 @@ AS_CASE(["$ruby_version_dir_name"],
2016-01-05 09:58:10 +00:00
ruby_version_dir=/'${ruby_version_dir_name}'
2013-12-17 15:56:33 +00:00
2016-01-05 09:58:10 +00:00
if test -z "${ruby_version_dir_name}"; then
2013-10-07 10:30:18 +00:00
- AC_MSG_ERROR([No ruby version, No place for bundled libraries])
2016-01-05 09:58:10 +00:00
+ unset ruby_version_dir
2013-10-07 10:30:18 +00:00
+ AC_DEFINE(RUBY_LIB_VERSION_BLANK, 1)
2013-02-08 23:54:37 +00:00
fi
2013-10-07 10:30:18 +00:00
2016-01-05 09:58:10 +00:00
rubylibdir='${rubylibprefix}'${ruby_version_dir}
2013-10-07 10:30:18 +00:00
diff --git a/loadpath.c b/loadpath.c
2013-12-17 15:56:33 +00:00
index 9160031..0d4d953 100644
2013-10-07 10:30:18 +00:00
--- a/loadpath.c
+++ b/loadpath.c
2018-01-03 11:06:40 +00:00
@@ -65,21 +65,33 @@ const char ruby_initial_load_paths[] =
2013-10-07 10:30:18 +00:00
RUBY_SEARCH_PATH "\0"
2013-02-08 23:54:37 +00:00
#endif
2013-10-07 10:30:18 +00:00
#ifndef NO_RUBY_SITE_LIB
2013-12-17 15:56:33 +00:00
+#ifdef RUBY_LIB_VERSION_BLANK
+ RUBY_SITE_LIB "\0"
+#else
2013-10-07 10:30:18 +00:00
RUBY_SITE_LIB2 "\0"
+#endif
#ifdef RUBY_THINARCH
2013-02-08 23:54:37 +00:00
RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
#endif
2013-12-17 15:56:33 +00:00
RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+#ifndef RUBY_LIB_VERSION_BLANK
RUBY_SITE_LIB "\0"
2013-02-08 23:54:37 +00:00
#endif
2013-12-17 15:56:33 +00:00
+#endif
2013-02-08 23:54:37 +00:00
#ifndef NO_RUBY_VENDOR_LIB
2013-12-17 15:56:33 +00:00
+#ifdef RUBY_LIB_VERSION_BLANK
+ RUBY_VENDOR_LIB "\0"
+#else
2013-10-07 10:30:18 +00:00
RUBY_VENDOR_LIB2 "\0"
2013-02-08 23:54:37 +00:00
+#endif
#ifdef RUBY_THINARCH
2013-10-07 10:30:18 +00:00
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
#endif
2013-12-17 15:56:33 +00:00
RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+#ifndef RUBY_LIB_VERSION_BLANK
RUBY_VENDOR_LIB "\0"
+#endif
2018-01-03 11:06:40 +00:00
#endif
2013-12-17 15:56:33 +00:00
RUBY_LIB "\0"
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 07076d4..35e6c3c 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -115,7 +115,7 @@
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
case name
when /^prefix$/
- val = "(TOPDIR || DESTDIR + #{val})"
+ val = "(((TOPDIR && TOPDIR.empty?) ? nil : TOPDIR) || DESTDIR + #{val})"
when /^ARCH_FLAG$/
val = "arch_flag || #{val}" if universal
when /^UNIVERSAL_ARCHNAMES$/