summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 08:39:25 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 08:39:25 +0000
commita281c996689240dc204f0c534cfe21ee6cbb6863 (patch)
tree348726e0095d2ffe63f663fcd130f8edd1f36636
parent8c17338001955f8a811997e441e2855c80a77bff (diff)
add mswin32_extmk.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/mswin32_extmk.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/ext/mswin32_extmk.rb b/ext/mswin32_extmk.rb
new file mode 100644
index 0000000000..c79284dd8c
--- /dev/null
+++ b/ext/mswin32_extmk.rb
@@ -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: