1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* instruby.rb, mkconfig.rb: deal with --program-transform-name

better.  now supports s, y commands and single addressing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-04-09 18:01:26 +00:00
parent 7bce595970
commit 8191f129b5
4 changed files with 59 additions and 9 deletions

View file

@ -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.

View file

@ -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 = ''

View file

@ -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

View file

@ -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[];