mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add mswin32_extmk.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8c17338001
commit
a281c99668
1 changed files with 41 additions and 0 deletions
41
ext/mswin32_extmk.rb
Normal file
41
ext/mswin32_extmk.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!./miniruby
|
||||
|
||||
def create_gsub_rb()
|
||||
f = open("mswin32_gsub.rb", "w")
|
||||
has_version = false
|
||||
f.print 'f = open("extmk.rb", "w")', "\n"
|
||||
f.print 'File.foreach "extmk.rb.in" do |$_|', "\n"
|
||||
File.foreach "../config.status" do |$_|
|
||||
next if /^#/
|
||||
if /^s%@(\w+)@%(.*)%g/
|
||||
name = $1
|
||||
val = $2 || ""
|
||||
next if name =~ /^(INSTALL|DEFS|configure_input|srcdir)$/
|
||||
val = ".." if name == "top_srcdir"
|
||||
val.gsub!(/\$\{([^{}]+)\}/) { "$(#{$1})" }
|
||||
f.print " gsub!(\"@#{name}@\", \"#{val}\")\n"
|
||||
has_version = true if name == "MAJOR"
|
||||
end
|
||||
end
|
||||
|
||||
if not has_version
|
||||
VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) {
|
||||
f.print " gsub!(\"@MAJOR@\", \"#{$1}\")\n"
|
||||
f.print " gsub!(\"@MINOR@\", \"#{$2}\")\n"
|
||||
f.print " gsub!(\"@TEENY@\", \"#{$3}\")\n"
|
||||
}
|
||||
end
|
||||
f.print ' f.print $_', "\n"
|
||||
f.print 'end', "\n"
|
||||
f.print 'f.close', "\n"
|
||||
f.close
|
||||
end
|
||||
|
||||
begin
|
||||
create_gsub_rb()
|
||||
load "mswin32_gsub.rb"
|
||||
ensure
|
||||
File.unlink "mswin32_gsub.rb"
|
||||
end
|
||||
|
||||
# vi:set sw=2:
|
Loading…
Reference in a new issue