diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rwxr-xr-x | instruby.rb | 26 | ||||
-rwxr-xr-x | mkconfig.rb | 33 | ||||
-rw-r--r-- | version.h | 4 |
4 files changed, 59 insertions, 9 deletions
@@ -1,3 +1,8 @@ +Fri Apr 10 03:01:24 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * instruby.rb, mkconfig.rb: deal with --program-transform-name + better. now supports s, y commands and single addressing. + Thu Apr 9 23:59:11 2009 Tanaka Akira <akr@fsij.org> * configure.in: don't override the rule for ruby. diff --git a/instruby.rb b/instruby.rb index fbbecbdac..5d3e3820e 100755 --- a/instruby.rb +++ b/instruby.rb @@ -381,11 +381,35 @@ install?(:local, :comm, :bin, :'bin-comm') do if File::ALT_SEPARATOR ruby_bin = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR) end + if trans = CONFIG["program_transform_name"] + exp = [] + trans.gsub!(/\$\$/, '$') + trans.scan(%r[\G[\s;]*(/(?:\\.|[^/])*/)?([sy])(\W)((?:\\.|(?!\3).)*)\3((?:\\.|(?!\3).)*)\3([gi]*)]) do + |addr, cmd, sep, pat, rep, opt| + addr &&= Regexp.new(addr[/\A\/(.*)\/\z/, 1]) + case cmd + when 's' + next if pat == '^' and rep.empty? + exp << [addr, (opt.include?('g') ? :gsub! : :sub!), + Regexp.new(pat, opt.include?('i')), rep] + when 'y' + exp << [addr, :tr!, Regexp.quote(pat), rep] + end + end + trans = proc do |base| + exp.each {|addr, opt, pat, rep| base.__send__(opt, pat, rep) if !addr or addr =~ base} + base + end + elsif /ruby/ =~ ruby_install_name + trans = proc {|base| ruby_install_name.sub(/ruby/, base)} + else + trans = proc {|base| base} + end for src in Dir[File.join(srcdir, "bin/*")] next unless File.file?(src) next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src - name = ruby_install_name.sub(/ruby/, File.basename(src)) + name = trans[File.basename(src)] shebang = '' body = '' diff --git a/mkconfig.rb b/mkconfig.rb index d715cc40d..2a1ec927f 100755 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -83,12 +83,33 @@ File.foreach "config.status" do |line| when /^\$\{ac_\w+\}$/; next when /^\$ac_\w+$/; next end - if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val - next if $install_name - sep = %r"#{Regexp.quote($1)}" - ptn = $2.gsub(/\$\$/, '$').split(sep, 2) - name = "ruby_install_name" - val = "ruby".sub(/#{ptn[0]}/, ptn[1]) + if /^program_transform_name$/ =~ name + val.sub!(/\As(\W)(?:\^|\$\$)\1\1(;|\z)/, '') + if val.empty? + $install_name ||= "ruby" + next + end + unless $install_name + $install_name = "ruby" + val.gsub!(/\$\$/, '$') + val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*/)?([sy])(\W)((?:\\.|(?!\3).)*)\3((?:\\.|(?!\3).)*)\3([gi]*)]) do + |addr, cmd, sep, pat, rep, opt| + if addr + Regexp.new(addr[/\A\/(.*)\/\z/, 1]) =~ $install_name or next + end + case cmd + when 's' + pat = Regexp.new(pat, opt.include?('i')) + if opt.include?('g') + $install_name.gsub!(pat, rep) + else + $install_name.sub!(pat, rep) + end + when 'y' + $install_name.tr!(Regexp.quote(pat), rep) + end + end + end end val.gsub!(/ +(?!-)/, "=") if name == "configure_args" && /mswin32/ =~ RUBY_PLATFORM val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2009-04-09" +#define RUBY_RELEASE_DATE "2009-04-10" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 9 +#define RUBY_RELEASE_DAY 10 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |