ruby-changes:23704
From: nobu <ko1@a...>
Date: Tue, 22 May 2012 11:11:09 +0900 (JST)
Subject: [ruby-changes:23704] nobu:r35755 (ruby_1_9_2): merge revision(s) 27939,29703,29704,30164:
nobu 2012-05-22 11:09:55 +0900 (Tue, 22 May 2012) New Revision: 35755 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35755 Log: merge revision(s) 27939,29703,29704,30164: * ruby.c (ruby_init_loadpath_safe): use real path for non-shared build. * configure.in (LIBRUBY_RELATIVE): use rpath token expansion. * tool/rbinstall.rb (bin-comm): prepend prolog shell script if necessary. * ruby.c (ruby_init_loadpath_safe): relatively called non-shared binary cannot be found in PATH, so use given pathname. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/configure.in branches/ruby_1_9_2/ruby.c branches/ruby_1_9_2/tool/rbinstall.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/configure.in =================================================================== --- ruby_1_9_2/configure.in (revision 35754) +++ ruby_1_9_2/configure.in (revision 35755) @@ -2107,6 +2107,8 @@ AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]), [enable_shared=$enableval]) LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)' +libprefix='$(libdir)' +LIBRUBY_RELATIVE=no if test "$enable_shared" = 'yes'; then LIBRUBY='$(LIBRUBY_SO)' LIBRUBYARG='$(LIBRUBYARG_SHARED)' @@ -2122,6 +2124,10 @@ [linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [ 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_RELATIVE=yes + fi ], [freebsd*|dragonfly*], [ SOLIBS='$(LIBS)' @@ -2175,8 +2181,7 @@ LIBRUBY_LDSHARED='$(CC) -dynamiclib' if test "$load_relative" = yes; then libprefix='@executable_path/../lib' - else - libprefix='$(libdir)' + LIBRUBY_RELATIVE=yes fi LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)' @@ -2194,10 +2199,12 @@ ]) fi if test "$enable_rpath" = yes; then - LIBRUBY_RPATHFLAGS="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir)" + test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS " + LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${linker_flag}-R ${linker_flag}${libprefix} -L\$(libdir)" LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED" LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC" fi +AC_SUBST(LIBRUBY_RELATIVE) LDFLAGS="-L. $LDFLAGS" AC_SUBST(ARCHFILE) Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 35754) +++ ruby_1_9_2/ChangeLog (revision 35755) @@ -1,3 +1,16 @@ +Tue May 22 11:09:52 2012 Nobuyoshi Nakada <nobu@r...> + + * ruby.c (ruby_init_loadpath_safe): use real path for non-shared + build. + + * configure.in (LIBRUBY_RELATIVE): use rpath token expansion. + + * tool/rbinstall.rb (bin-comm): prepend prolog shell script if + necessary. + + * ruby.c (ruby_init_loadpath_safe): relatively called non-shared + binary cannot be found in PATH, so use given pathname. + Mon May 21 16:27:24 2012 Akinori MUSHA <knu@i...> * ext/syslog/syslog.c (mSyslog_inspect): Make sure self is a Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 35754) +++ ruby_1_9_2/version.h (revision 35755) @@ -1,13 +1,13 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 322 +#define RUBY_PATCHLEVEL 323 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2012 #define RUBY_RELEASE_MONTH 5 -#define RUBY_RELEASE_DAY 21 -#define RUBY_RELEASE_DATE "2012-05-21" +#define RUBY_RELEASE_DAY 22 +#define RUBY_RELEASE_DATE "2012-05-22" #include "ruby/version.h" Index: ruby_1_9_2/ruby.c =================================================================== --- ruby_1_9_2/ruby.c (revision 35754) +++ ruby_1_9_2/ruby.c (revision 35755) @@ -370,9 +370,12 @@ #elif defined(HAVE_DLADDR) Dl_info dli; if (dladdr((void *)(VALUE)expand_include_path, &dli)) { - VALUE fname = rb_str_new_cstr(dli.dli_fname); - sopath = rb_file_absolute_path(fname, Qnil); - rb_str_resize(fname, 0); + VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); + char fbuf[MAXPATHLEN]; + char *f = dln_find_file_r(dli.dli_fname, getenv(PATH_ENV), fbuf, sizeof(fbuf)); + VALUE fname = rb_str_new_cstr(f ? f : dli.dli_fname); + rb_str_freeze(fname); + sopath = rb_realpath_internal(Qnil, fname, 1); } else { sopath = rb_str_new(0, 0); Index: ruby_1_9_2/tool/rbinstall.rb =================================================================== --- ruby_1_9_2/tool/rbinstall.rb (revision 35754) +++ ruby_1_9_2/tool/rbinstall.rb (revision 35755) @@ -300,6 +300,7 @@ dll = CONFIG["LIBRUBY_SO"] lib = CONFIG["LIBRUBY"] arc = CONFIG["LIBRUBY_A"] +load_relative = configure_args.include?("--enable-load-relative") install?(:local, :arch, :bin, :'bin-arch') do prepare "binary commands", bindir @@ -371,6 +372,23 @@ install_recursive "doc/capi", capidir, :mode => $data_mode end +if load_relative + PROLOG_SCRIPT = <<EOS +#!/bin/sh\n# -*- ruby -*- +bindir=`#{CONFIG["CHDIR"]} "${0%/*}" 2>/dev/null; pwd` +EOS + if CONFIG["LIBRUBY_RELATIVE"] != 'yes' and libpathenv = CONFIG["LIBPATHENV"] + pathsep = File::PATH_SEPARATOR + PROLOG_SCRIPT << <<EOS +prefix="${bindir%/bin}" +export #{libpathenv}="$prefix/lib${#{libpathenv}#{pathsep}+#{pathsep}$#{libpathenv}}" +EOS + end + PROLOG_SCRIPT << %Q[exec "$bindir/#{ruby_install_name}" -x "$0" "$@"\n] +else + PROLOG_SCRIPT = nil +end + install?(:local, :comm, :bin, :'bin-comm') do prepare "command scripts", bindir @@ -416,7 +434,11 @@ shebang = f.gets body = f.read end - shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang} + if PROLOG_SCRIPT + shebang.sub!(/\A(\#!.*?ruby\b)?/) {PROLOG_SCRIPT + ($1 || "#!ruby\n")} + else + shebang.sub!(/\A\#!.*?ruby\b/) {"#!" + ruby_shebang} + end shebang.sub!(/\r$/, '') body.gsub!(/\r$/, '') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/