ruby-changes:17694
From: nobu <ko1@a...>
Date: Sat, 6 Nov 2010 07:31:18 +0900 (JST)
Subject: [ruby-changes:17694] Ruby:r29704 (trunk): * tool/rbinstall.rb (bin-comm): prepend prolog shell script if
nobu 2010-11-06 07:30:13 +0900 (Sat, 06 Nov 2010) New Revision: 29704 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29704 Log: * tool/rbinstall.rb (bin-comm): prepend prolog shell script if necessary. Modified files: trunk/ChangeLog trunk/tool/rbinstall.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 29703) +++ ChangeLog (revision 29704) @@ -1,5 +1,8 @@ -Sat Nov 6 07:28:39 2010 Nobuyoshi Nakada <nobu@r...> +Sat Nov 6 07:30:07 2010 Nobuyoshi Nakada <nobu@r...> + * tool/rbinstall.rb (bin-comm): prepend prolog shell script if + necessary. + * configure.in (LIBRUBY_RELATIVE): use rpath token expansion. Sat Nov 6 07:24:01 2010 Nobuyoshi Nakada <nobu@r...> Index: tool/rbinstall.rb =================================================================== --- tool/rbinstall.rb (revision 29703) +++ tool/rbinstall.rb (revision 29704) @@ -302,6 +302,7 @@ arc = CONFIG["LIBRUBY_A"] major = CONFIG["MAJOR"] minor = CONFIG["MINOR"] +load_relative = configure_args.include?("--enable-load-relative") install?(:local, :arch, :bin, :'bin-arch') do prepare "binary commands", bindir @@ -381,6 +382,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 @@ -426,7 +444,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/