ruby-changes:25103
From: usa <ko1@a...>
Date: Fri, 12 Oct 2012 16:25:14 +0900 (JST)
Subject: [ruby-changes:25103] usa:r37155 (ruby_1_9_3): merge revision(s) 36847,36873: [Backport #7115]
usa 2012-10-12 16:24:42 +0900 (Fri, 12 Oct 2012) New Revision: 37155 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37155 Log: merge revision(s) 36847,36873: [Backport #7115] * configure.in (LIBDIR_BASENAME): use configured libdir value to fix --enable-load-relative on systems where libdir is not default value, overridden in config.site files. [ruby-core:47267] [Bug #6903] * ruby.c (ruby_init_loadpath_safe): ditto. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/configure.in branches/ruby_1_9_3/ruby.c branches/ruby_1_9_3/version.h Index: ruby_1_9_3/configure.in =================================================================== --- ruby_1_9_3/configure.in (revision 37154) +++ ruby_1_9_3/configure.in (revision 37155) @@ -2355,6 +2355,13 @@ if test "$rb_cv_binary_elf" = yes; then SOLIBS='$(LIBS)' fi + # libdir can be overridden in config.site file (on OpenSUSE at least). + libdir_basename=lib + if test "$bindir" = '${exec_prefix}/bin'; then + AS_CASE(["$libdir"], ['${exec_prefix}/'*], [libdir_basename=`basename "$libdir"`]) + fi + AC_DEFINE_UNQUOTED(LIBDIR_BASENAME, ["${libdir_basename}"]) + AS_CASE(["$target_os"], [sunos4*], [ LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' @@ -2363,7 +2370,7 @@ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' if test "$load_relative" = yes; then - LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../lib'" + LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../${libdir_basename}'" LIBRUBY_RELATIVE=yes fi ], @@ -2420,7 +2427,7 @@ RUBY_SO_NAME="$RUBY_SO_NAME"'.$(MAJOR).$(MINOR).$(TEENY)' LIBRUBY_LDSHARED='$(CC) -dynamiclib' if test "$load_relative" = yes; then - libprefix='@executable_path/../lib' + libprefix="@executable_path/../${libdir_basename}" LIBRUBY_RELATIVE=yes fi LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)' Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 37154) +++ ruby_1_9_3/ChangeLog (revision 37155) @@ -1,3 +1,11 @@ +Fri Oct 12 16:11:23 2012 Nobuyoshi Nakada <nobu@r...> + + * configure.in (LIBDIR_BASENAME): use configured libdir value to fix + --enable-load-relative on systems where libdir is not default value, + overridden in config.site files. [ruby-core:47267] [Bug #6903] + + * ruby.c (ruby_init_loadpath_safe): ditto. + Fri Oct 12 13:56:01 2012 Ayumu AIZAWA <ayumu.aizawa@g...> * test/rexml/test_encoding.rb: Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 37154) +++ ruby_1_9_3/version.h (revision 37155) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 282 +#define RUBY_PATCHLEVEL 283 #define RUBY_RELEASE_DATE "2012-10-12" #define RUBY_RELEASE_YEAR 2012 Index: ruby_1_9_3/ruby.c =================================================================== --- ruby_1_9_3/ruby.c (revision 37154) +++ ruby_1_9_3/ruby.c (revision 37155) @@ -410,11 +410,23 @@ #endif p = strrchr(libpath, '/'); if (p) { + static const char bindir[] = "/bin"; +#ifdef LIBDIR_BASENAME + static const char libdir[] = "/"LIBDIR_BASENAME; +#else + static const char libdir[] = "/lib"; +#endif + const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1; + const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir) - 1; *p = 0; - if (p - libpath > 3 && !(STRCASECMP(p - 4, "/bin") && strcmp(p - 4, "/lib"))) { - p -= 4; + if (p - libpath >= bindir_len && !STRCASECMP(p - bindir_len, bindir)) { + p -= bindir_len; *p = 0; } + else if (p - libpath >= libdir_len && !STRCASECMP(p - libdir_len, libdir)) { + p -= libdir_len; + *p = 0; + } } #if !VARIABLE_LIBPATH else { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/